@@ -119,9 +119,9 @@ private static void allBeanPostProcessorBeanMethodsShouldBeStaticAndNotCausePrem
119
119
.stream ()
120
120
.filter (notAnnotatedWithLazy )
121
121
.filter ((parameter ) -> notOfASafeType .test (parameter .getRawType ()))
122
- .forEach ((parameter ) -> events . add ( SimpleConditionEvent . violated ( parameter ,
122
+ .forEach ((parameter ) -> addViolation ( events , parameter ,
123
123
parameter .getDescription () + " will cause eager initialization as it is "
124
- + notAnnotatedWithLazy .getDescription () + " and is " + notOfASafeType .getDescription ()))) ;
124
+ + notAnnotatedWithLazy .getDescription () + " and is " + notOfASafeType .getDescription ()));
125
125
}
126
126
127
127
private static ArchRule allBeanFactoryPostProcessorBeanMethodsShouldBeStaticAndHaveNoParameters () {
@@ -193,8 +193,8 @@ private static ArchCondition<? super JavaMethod> notSpecifyOnlyATypeThatIsTheSam
193
193
if (!properties .containsKey ("type" ) && !properties .containsKey ("name" )) {
194
194
conditionalAnnotation .get ("value" ).ifPresent ((value ) -> {
195
195
if (containsOnlySingleType ((JavaType []) value , item .getReturnType ())) {
196
- events . add ( SimpleConditionEvent . violated ( item , conditionalAnnotation .getDescription ()
197
- + " should not specify only a value that is the same as the method's return type" )) ;
196
+ addViolation ( events , item , conditionalAnnotation .getDescription ()
197
+ + " should not specify only a value that is the same as the method's return type" );
198
198
}
199
199
});
200
200
}
@@ -265,6 +265,10 @@ public void check(T item, ConditionEvents events) {
265
265
};
266
266
}
267
267
268
+ private static void addViolation (ConditionEvents events , Object correspondingObject , String message ) {
269
+ events .add (SimpleConditionEvent .violated (correspondingObject , message ));
270
+ }
271
+
268
272
private static String shouldUse (String string ) {
269
273
return string + " should be used instead" ;
270
274
}
0 commit comments