You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected a FooService bean to be created as a SomeFooServiceDecorator wrapping (decorating) real service bean of type DefaultFooService.
Actual behavior
Dependency injection fails with NullPointerException errors. The exception trace contains no relevant information on the cause of the error.
A typical exception trace:
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.13.4.Final:build (default) on project hello-decorator: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.arc.deployment.ArcProcessor#generateResources threw an exception: java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
[ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:918)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
[ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:829)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
[ERROR] at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
[ERROR] at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
[ERROR] at io.quarkus.arc.processor.BeanProcessor.generateResources(BeanProcessor.java:322)
[ERROR] at io.quarkus.arc.deployment.ArcProcessor.generateResources(ArcProcessor.java:565)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
[ERROR] ... 6 more
[ERROR] Caused by: java.lang.NullPointerException
[ERROR] at io.quarkus.gizmo.BytecodeCreatorImpl.allocateLocalVariables(BytecodeCreatorImpl.java:1202)
[ERROR] at io.quarkus.gizmo.MethodCreatorImpl.write(MethodCreatorImpl.java:122)
[ERROR] at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:202)
[ERROR] at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:225)
[ERROR] at io.quarkus.arc.processor.SubclassGenerator.generate(SubclassGenerator.java:127)
[ERROR] at io.quarkus.arc.processor.BeanProcessor$4$2.call(BeanProcessor.java:289)
[ERROR] at io.quarkus.arc.processor.BeanProcessor$4$2.call(BeanProcessor.java:286)
[ERROR] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR] ... 5 more
Linux optiplex 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64 GNU/Linux
Output of java -version
openjdk version "11.0.14" 2022-01-18 OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05) OpenJDK 64-Bit Server VM GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.13.4
Build tool (ie. output of mvnw --version or gradlew --version)
If we rename the overloaded method (e.g findById to findById1), everything works fine and Arc manages to resolve dependencies. But this is not a practical solution as it is very common for interfaces to contain overloaded methods.
The text was updated successfully, but these errors were encountered:
I can confirm that quarkus fails to generate the intercepted subclass and the NPE thrown from gizmo does not really help. I'll try to investigate the issue and if possible fix the problem in Arc and improve the error handling in gizmo.
mkouba
added a commit
to mkouba/quarkus
that referenced
this issue
Nov 21, 2022
Describe the bug
I am trying to create a simple CDI decorator on an interface with multiple methods. Some of the interface methods are overloaded.
We have an interface like:
And a decorator like:
And finally, a bean class like:
Expected behavior
Expected a FooService bean to be created as a
SomeFooServiceDecorator
wrapping (decorating) real service bean of typeDefaultFooService
.Actual behavior
Dependency injection fails with
NullPointerException
errors. The exception trace contains no relevant information on the cause of the error.A typical exception trace:
How to Reproduce?
A reproducer project is available at:
https://github.com/drmalex07/reproducer-for-arc-bug-on-decorator
Just run Maven build (
mvn package -DskipTests
)Output of
uname -a
orver
Linux optiplex 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64 GNU/Linux
Output of
java -version
openjdk version "11.0.14" 2022-01-18 OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05) OpenJDK 64-Bit Server VM GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.13.4
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) Maven home: /home/malex/opt/apache-maven-3.8.5 Java version: 11.0.14, vendor: GraalVM Community, runtime: /home/malex/opt/graalvm-ce-java11-22.0.0.2 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.9.0-15-amd64", arch: "amd64", family: "unix"
Additional information
If we rename the overloaded method (e.g
findById
tofindById1
), everything works fine and Arc manages to resolve dependencies. But this is not a practical solution as it is very common for interfaces to contain overloaded methods.The text was updated successfully, but these errors were encountered: