tandraschko commented on code in PR #175:
URL: https://github.com/apache/bval/pull/175#discussion_r1932119712


##########
bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java:
##########
@@ -201,32 +217,55 @@ public void afterStart(@Observes final 
AfterDeploymentValidation clearEvent) {
         notBValAnnotation.clear();
     }
 
-    private boolean hasValidationAnnotation(final Collection<? extends 
Annotated> annotateds) {
-        return annotateds.stream().anyMatch(this::hasValidation);
+    private boolean hasValidation(final AnnotatedElement[] elements) {
+        for (int i = 0; i < elements.length; i++) {
+            if (hasValidation(elements[i])) {
+                return true;
+            }
+        }
+
+        return false;
     }
 
-    private boolean hasValidation(final Annotated m) {
-        return m.getAnnotations().stream()
-                .anyMatch(it -> {
-                    final Class<? extends Annotation> type = 
it.annotationType();
-                    if (type == ValidateOnExecution.class || type == 
Valid.class) {
-                        return true;
-                    }
-                    if (isSkippedAnnotation(type)) {
-                        return false;
-                    }
-                    if 
(type.getName().startsWith("jakarta.validation.constraints")) {
-                        return true;
-                    }
-                    if (notBValAnnotation.contains(type)) { // more likely so 
faster first
-                        return false;
-                    }
-                    if (potentiallyBValAnnotation.contains(type)) {
-                        return true;
-                    }
-                    cacheIsBvalAnnotation(type);
-                    return potentiallyBValAnnotation.contains(type);
-                });
+    private boolean hasParamsWithValidation(Executable[] executables) {
+        for (int i = 0; i < executables.length; i++) {
+            Parameter[] params = executables[i].getParameters();
+            for (int j = 0; j < params.length; j++) {
+                if (hasValidation(params[j])) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    private boolean hasValidation(final AnnotatedElement element) {
+        Annotation[] annotations = element.getAnnotations();
+        for (int i = 0; i < annotations.length; i++) {

Review Comment:
   for-each loop?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@bval.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to