Skip to content

Commit

Permalink
Client proxies - fix invalid warning
Browse files Browse the repository at this point in the history
- resolves quarkusio#2963
  • Loading branch information
mkouba committed Jun 26, 2019
1 parent 38a665f commit db6e42f
Showing 1 changed file with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,7 @@ static void addDelegatingMethods(IndexView index, ClassInfo classInfo, Map<Metho
}

private static boolean skipForClientProxy(MethodInfo method) {
short flags = method.flags();
String className = method.declaringClass().name().toString();
if (Modifier.isFinal(flags) && !className.startsWith("java.")) {
LOGGER.warn(String.format("Method %s.%s() is final, skipped during generation of corresponding client proxy",
className, method.name()));
}
if (Modifier.isStatic(flags) || Modifier.isFinal(flags) || Modifier.isPrivate(flags)) {
if (Modifier.isStatic(method.flags()) || Modifier.isPrivate(method.flags())) {
return true;
}
if (IGNORED_METHODS.contains(method.name())) {
Expand All @@ -91,6 +85,15 @@ private static boolean skipForClientProxy(MethodInfo method) {
if (method.declaringClass().name().equals(DotNames.OBJECT)) {
return true;
}
if (Modifier.isFinal(method.flags())) {
String className = method.declaringClass().name().toString();
if (!className.startsWith("java.")) {
LOGGER.warn(
String.format("Method %s.%s() is final, skipped during generation of the corresponding client proxy",
className, method.name()));
}
return true;
}
return false;
}

Expand All @@ -108,12 +111,23 @@ static void addInterceptedMethodCandidates(BeanDeployment beanDeployment, ClassI
Set<AnnotationInstance> merged = new HashSet<>();
merged.addAll(methodLevelBindings);
for (AnnotationInstance classLevelBinding : classLevelBindings) {
if (methodLevelBindings.stream().noneMatch(a -> classLevelBinding.name().equals(a.name()))) {
if (methodLevelBindings.isEmpty()
|| methodLevelBindings.stream().noneMatch(a -> classLevelBinding.name().equals(a.name()))) {
merged.add(classLevelBinding);
}
}
if (!merged.isEmpty()) {
candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged);
if (Modifier.isFinal(method.flags())) {
String className = method.declaringClass().name().toString();
if (!className.startsWith("java.")) {
LOGGER.warn(
String.format(
"Method %s.%s() is final, skipped during generation of the corresponding intercepted subclass",
className, method.name()));
}
} else {
candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged);
}
}
}
if (classInfo.superClassType() != null) {
Expand All @@ -125,14 +139,7 @@ static void addInterceptedMethodCandidates(BeanDeployment beanDeployment, ClassI
}

private static boolean skipForSubclass(MethodInfo method) {
short flags = method.flags();
String className = method.declaringClass().name().toString();
if (Modifier.isFinal(flags) && !className.startsWith("java.")) {
LOGGER.warn(
String.format("Method %s.%s() is final, skipped during generation of corresponding intercepted subclass",
className, method.name()));
}
if (Modifier.isStatic(flags) || Modifier.isFinal(flags)) {
if (Modifier.isStatic(method.flags())) {
return true;
}
if (IGNORED_METHODS.contains(method.name())) {
Expand All @@ -141,6 +148,7 @@ private static boolean skipForSubclass(MethodInfo method) {
if (method.declaringClass().name().equals(DotNames.OBJECT)) {
return true;
}
// We intentionally do not skip final methods here - these are handled later
return false;
}

Expand Down

0 comments on commit db6e42f

Please sign in to comment.