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 63dd492940a05..930c8f4066860 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 @@ -188,6 +188,20 @@ static Set addInterceptedMethodCandidates(BeanDeployment beanDeploym List methodLevelBindings = methodAnnnotations.stream() .flatMap(a -> beanDeployment.extractInterceptorBindings(a).stream()) .collect(Collectors.toList()); + if (Modifier.isPrivate(method.flags()) + && !methodLevelBindings.isEmpty() + && !Annotations.contains(methodAnnnotations, DotNames.OBSERVES) + && !Annotations.contains(methodAnnnotations, DotNames.OBSERVES_ASYNC)) { + if (merged.size() == 1) { + LOGGER.warnf("%s will have no effect on method %s.%s() because the method is private", + methodLevelBindings.iterator().next(), classInfo.name(), method.name()); + } else { + LOGGER.warnf("Annotations %s will have no effect on method %s.%s() because the method is private", + methodLevelBindings.stream().map(AnnotationInstance::toString).collect(Collectors.joining(",")), + classInfo.name(), method.name()); + } + + } merged.addAll(methodLevelBindings); for (AnnotationInstance classLevelBinding : classLevelBindings) { if (methodLevelBindings.isEmpty() @@ -197,30 +211,18 @@ static Set addInterceptedMethodCandidates(BeanDeployment beanDeploym } } if (!merged.isEmpty()) { - if (Modifier.isPrivate(method.flags())) { - if (merged.size() == 1) { - LOGGER.warnf("%s will have no effect on method %s.%s() because the method is private", - merged.iterator().next(), classInfo.name(), method.name()); + boolean addToCandidates = true; + if (Modifier.isFinal(method.flags())) { + if (transformUnproxyableClasses) { + methodsFromWhichToRemoveFinal.add(NameAndDescriptor.fromMethodInfo(method)); } else { - LOGGER.warnf("Annotations %s will have no effect on method %s.%s() because the method is private", - merged.stream().map(AnnotationInstance::toString).collect(Collectors.joining(",")), - classInfo.name(), method.name()); - } - - } else { - boolean addToCandidates = true; - if (Modifier.isFinal(method.flags())) { - if (transformUnproxyableClasses) { - methodsFromWhichToRemoveFinal.add(NameAndDescriptor.fromMethodInfo(method)); - } else { - addToCandidates = false; - finalMethodsFoundAndNotChanged.add(method); - } - } - if (addToCandidates) { - candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged); + addToCandidates = false; + finalMethodsFoundAndNotChanged.add(method); } } + if (addToCandidates) { + candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged); + } } } skipPredicate.methodsProcessed();