-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intercepted subclasses generation - fix evaluation of skipped methods #21781
Conversation
independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it took me a while to realize that by "do not skip methods with a private param", you mean "do not skip methods with a private param declared in the same package", but that obviously makes sense.
- do not skip methods with a private param - also do not evaluate methods that declare no interceptor bindings; these methods are skipped automatically - related to quarkusio#19177 Co-authored-by: Ladislav Thon <[email protected]>
} | ||
// e.g. parameters whose class is package-private and the package is not the same as the package of the method for which we are checking can not be loaded, | ||
// as we would end up with IllegalAccessError when trying to access the use the load the class | ||
if (!DotNames.packageName(param.name()).equals(originalClassPackage)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this should be an error rather than a warning. We have seen cases where security interceptors are not applied even though the user was expecting them to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree but the problem is that if you annotate a class with an interceptor binding then all methods (incl. inherited ones) should be intercepted and sometimes you need to extend a class from a different package which you don't control. Such an extended class may declare e.g. a package-private method that accepts a private param type. And since you're not able to modify the extended class you'd be screwed. An example from the original issue is java.util.concurrent.ThreadPoolExecutor
and ThreadPoolExecutor.runWorker(Worker)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to merge this PR. @stuartwdouglas if you really think that the current behavior is wrong (actually, before this PR the method is ignored and no warning is logged) then pls file a new issue.
@mkouba This PR seems to cause warnings for primitive arrays. Specifically the check following this: quarkus/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java Line 559 in 277523b
Causes the following warnings.
|
these methods are skipped automatically