-
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
Interceptor doesn't allow subclasses to be passed as parameter to intercepted method #16274
Comments
/cc @mkouba |
Thorntail doesn't require an exact class match, that's why I figured Quarkus shouldn't either, but I'll admin that I have not actually read the spec 😇 |
Seems like a useful addition |
Yeah, it ought to be safe to allow subtypes, so +1. |
FTR this is the Weld impl of |
Allowing subtypes should indeed be safe. Agree to add this. (And the Weld implementation is funny :-) ) |
Describe the bug
When an @AroundInvoke interceptor is used on a method that accepts one or many parameters,
and a parameter is assigned a subtype of the formal argument type, the application crashes with an IllegalArgumentException.
Expected behavior
Should not crash.
Actual behavior
Crashes.
To Reproduce
I've attached a simple reproducer. It's just the getting-started-reactive project with the addition of a simple interceptor
that attempts to change the first argument to the intercepted method.
getting-started-reactive.tar.gz
The interceptor is applied to this method in ReactiveGreetingService that is modified to accept a CharSequence instad of a String
and the bug is triggered by GET http://localhost:8080/hello/greeting/johan
after starting the app in dev mode.
Environment
Output of
java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-Ubuntu-1)
OpenJDK 64-Bit Server VM (build 14.0.2+12-Ubuntu-1, mixed mode, sharing)
Quarkus version or git rev
1.13.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)pache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/.../.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 14.0.2, vendor: Private Build, runtime: /usr/lib/jvm/java-14-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.8.0-45-generic", arch: "amd64", family: "unix"
The text was updated successfully, but these errors were encountered: