From 4c6af3956b8520f99305b07f524ce6b1e55565a5 Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Fri, 22 Nov 2024 11:43:10 +0100 Subject: [PATCH] ArC: improve how intercepted methods are searched for If there are no interceptor binding annotations on the method, we can interrupt the search process a bit earlier and don't have to call the "skip this method?" predicate. This slightly improves the user experience, because the predicate can pring warnings (which would be useless in this case). --- .../src/main/java/io/quarkus/arc/processor/Methods.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java index a13a392dda3cd..07375e98f895d 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java @@ -194,11 +194,15 @@ private static Set addInterceptedMethodCandidates(BeanDeployment bea Set bindings = mergeBindings(beanDeployment, originalClassInfo, classLevelBindings, ignoreMethodLevelBindings, method, noClassInterceptorsMethods, bindingsDiscovery); boolean possiblyIntercepted = !bindings.isEmpty() || targetHasAroundInvokes; + if (!possiblyIntercepted) { + candidates.put(key, bindings); + continue; + } if (skipPredicate.test(method)) { continue; } boolean addToCandidates = true; - if (Modifier.isFinal(method.flags()) && possiblyIntercepted) { + if (Modifier.isFinal(method.flags())) { if (transformUnproxyableClasses && !isNoninterceptableKotlinMethod(method)) { methodsFromWhichToRemoveFinal.add(new MethodKey(method)); } else { @@ -207,7 +211,7 @@ private static Set addInterceptedMethodCandidates(BeanDeployment bea } } if (addToCandidates) { - candidates.putIfAbsent(key, bindings); + candidates.put(key, bindings); } } skipPredicate.methodsProcessed();