@@ -119,9 +119,9 @@ private static void allBeanPostProcessorBeanMethodsShouldBeStaticAndNotCausePrem
119119 .stream ()
120120 .filter (notAnnotatedWithLazy )
121121 .filter ((parameter ) -> notOfASafeType .test (parameter .getRawType ()))
122- .forEach ((parameter ) -> events . add ( SimpleConditionEvent . violated ( parameter ,
122+ .forEach ((parameter ) -> addViolation ( events , parameter ,
123123 parameter .getDescription () + " will cause eager initialization as it is "
124- + notAnnotatedWithLazy .getDescription () + " and is " + notOfASafeType .getDescription ()))) ;
124+ + notAnnotatedWithLazy .getDescription () + " and is " + notOfASafeType .getDescription ()));
125125 }
126126
127127 private static ArchRule allBeanFactoryPostProcessorBeanMethodsShouldBeStaticAndHaveNoParameters () {
@@ -193,8 +193,8 @@ private static ArchCondition<? super JavaMethod> notSpecifyOnlyATypeThatIsTheSam
193193 if (!properties .containsKey ("type" ) && !properties .containsKey ("name" )) {
194194 conditionalAnnotation .get ("value" ).ifPresent ((value ) -> {
195195 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" );
198198 }
199199 });
200200 }
@@ -265,6 +265,10 @@ public void check(T item, ConditionEvents events) {
265265 };
266266 }
267267
268+ private static void addViolation (ConditionEvents events , Object correspondingObject , String message ) {
269+ events .add (SimpleConditionEvent .violated (correspondingObject , message ));
270+ }
271+
268272 private static String shouldUse (String string ) {
269273 return string + " should be used instead" ;
270274 }
0 commit comments