-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
QuarkusClassLoader ignores method hierarchy when overriding overloaded methods in v1.13.x #16576
Comments
Label is wrong it should be macOS. |
/cc @stuartwdouglas |
Any chance we can get a simple reproducer? |
Hey @geoand I've provided a small project as a zip in the original post which includes the problematic library. |
Thanks |
@mkouba sounds like an arc issue, looks like ArC is trying to override a final method. |
@stuartwdouglas I am just now looking into it, but that's also what I gathered from looking at the error message. I want to dump the actual output to see |
So indeed,
@mkouba ^ |
Hm, IIRC we try to remove the
Since 1.13 the container monitors business method invocations in the development mode by default. You can disable monitoring via quarkus.arc.dev-mode.monitoring-enabled=false and the error should go away because your bean is normally not intercepted. |
Of course I did... :(.
Hm, maybe we should document this somewhere? |
Hm, so even if we detect similar cases and omit the class from monitoring the error appears in the dev mode if a interceptor binding is explicitly declared. Maybe we should try to detect the problematic classes and fail the build?
Yes, we can a paragraph to the Development Mode section. I can send a PR later today... |
Yeah. I think there are 2 things here:
|
Can we detect this somehow? |
Thanks, we'll give this a go for now :) and thanks everyone for looking into it |
For example, when checking at quarkus/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java Line 221 in d4dd21b
it would be something like: ClassLoader tccl = Thread.currentThread().getContextClassLoader();
boolean isParentFirst = !tccl.loadClass(superClassInfo.name().toString()).getClassLoader().equals(tccl) But we could likely loosen the access restrictions on |
This can be used by extensions to determine if a class would be loaded parent first or. Relates to: quarkusio#16576 (comment)
This can be used by extensions to determine if a class would be loaded parent first or not. Relates to: quarkusio#16576 (comment)
#16617 is an implementation of the above idea |
This can be used by extensions to determine if a class would be loaded parent first or not. Relates to: quarkusio#16576 (comment)
@geoand Do you happen to know the status of this issue? ;-) |
I don't think we ever utilized the method I added in #16617 |
This can be used by extensions to determine if a class would be loaded parent first or not. Relates to: quarkusio/quarkus#16576 (comment)
I'm going to close this issue. I don't think it makes sense to implement the parent first check to solve a corner case like this (bean class extends a jboss logging class). FYI the monitoring feature in the dev mode will be disabled by default in 2.14+ so you should not see the problem unless you add an interceptor binding to the |
We seem to have encountered a bug, but it could very well be a configuration issue on our side as well. However, it's symptomatic that it only started happening after upgrading Quarkus to 1.13.x. Any help would be appreciated.
Describe the bug
We are extending an abstract class and thus overriding an abstract method from a third party library(https://github.com/jboss-logging/jboss-logmanager/blob/master/core/src/main/java/org/jboss/logmanager/ExtFormatter.java). This abstract method takes a child class(
ExtLogRecord
), and there's also an overloaded final method with the parent class(LogRecord
). Since upgrading to Quarkus 1.13.x we get ajava.lang.VerifyError
on build that we cannot override a final method thrown by theQuarkusClassLoader
. The verification incorrectly assumes we're trying to override the final(non-abstract) parent class method, instead of the abstract child one. The problem only seems to be present in dev mode(thus we believe is related to the changes done to QuarkusClassLoader);Expected behavior
The verification passes, as the override refers to the correct method. This should be possible and is expected use of the library, and works without any problems with Quarkus 1.12.x.
Actual behavior
The verification fails, as the application assumes we're trying to override the wrong method.
To Reproduce
Try extending the class mentioned in the description(or a custom one with the same setup), and run it in dev mode.
Steps to reproduce the behavior:
Example project
example.zip
Simple building the project and running
quarkusDev
should reproduce the issue.Screenshots
The overloaded methods of the class we're trying to override:
Our method:
The error(our package and class names have been omitted):
Environment (please complete the following information):
Output of
uname -a
orver
Darwin [user] 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
Also updated to latest MacOS(Big Sur) but problem still persists.
Output of
java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
Quarkus version or git rev
1.13.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 6.8.3
Additional context
Could be a macOS specific issue? One of our colleagues on Windows reported to not have an issue.
Edit: our colleague confirmed it also doesn't work on Windows. Provided sample project.
The text was updated successfully, but these errors were encountered: