Skip to content
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

Indexing error with unhelpful error message when a generated class is registered as an additional bean instead of a generated bean #13464

Closed
Christopher-Chianelli opened this issue Nov 25, 2020 · 3 comments · Fixed by #32681
Labels
area/arc Issue related to ARC (dependency injection) kind/bug Something isn't working
Milestone

Comments

@Christopher-Chianelli
Copy link
Contributor

Describe the bug
An indexing error with an unhelpful error message is displayed if you add a generated class
as an additional bean at build message

Expected behavior
An error message that suggests to use GeneratedBeanGizmoAdaptor .
Ex: "Unable to find class file for ${className}. Maybe ${className} was registered as an additional bean via AdditionalBeanBuildItem. In that case, remove the producer of AdditionalBeanBuildItem and use a GeneratedBeanGizmoAdaptor as the class output for ClassCreator."

Actual behavior
An unhelpful "java.lang.IllegalArgumentException: stream cannot be null" is shown

java.lang.IllegalArgumentException: stream cannot be null
[ERROR] 	at org.jboss.jandex.Indexer.index(Indexer.java:1584)
[ERROR] 	at io.quarkus.deployment.index.IndexingUtil.indexClass(IndexingUtil.java:32)
[ERROR] 	at io.quarkus.arc.deployment.BeanArchiveProcessor.build(BeanArchiveProcessor.java:73)
[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$2.execute(ExtensionLoader.java:936)
[ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] 	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

To Reproduce
https://github.com/Christopher-Chianelli/issue-reproducer/tree/gizmo-cannot-be-indexed-error
mvn clean install; the error will occur during the build of the example project.

Configuration

# Add your application.properties here, if applicable.

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver:
  • Output of java -version:
openjdk 11.0.9 2020-10-20
OpenJDK Runtime Environment 18.9 (build 11.0.9+11)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.9+11, mixed mode, sharing)
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 1.9.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

Additional context
(Add any other context about the problem here.)

@Christopher-Chianelli Christopher-Chianelli added the kind/bug Something isn't working label Nov 25, 2020
@ghost ghost added the triage/needs-triage label Nov 25, 2020
@mkouba
Copy link
Contributor

mkouba commented Dec 21, 2022

Quarkus 1.9.2.Final is very old. @Christopher-Chianelli could you try to update your reproducer and try it with 2.15.0.Final?

@mkouba
Copy link
Contributor

mkouba commented Dec 23, 2022

Ok, so I've tried to reproduce the problem and I can see the same error in 2.15.0. You're right that in this case, the best thing to do is to use the GeneratedBeanBuildItem or GeneratedBeanGizmoAdaptor.

I'm not sure if we could detect this special case easily. However, we should definitely improve the javadoc of AdditionalBeanBuildItem and make it clear that it should not be used for generated classes.

@mkouba mkouba added area/arc Issue related to ARC (dependency injection) and removed triage/needs-triage labels Dec 23, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 23, 2022

/cc @manovotn(arc)

mkouba added a commit to mkouba/quarkus that referenced this issue Apr 17, 2023
- make it clear that it should not be used for generated classes
- resolves quarkusio#13464
mkouba added a commit to mkouba/quarkus that referenced this issue Apr 17, 2023
- make it clear that it should not be used for generated classes
- resolves quarkusio#13464
@quarkus-bot quarkus-bot bot added this to the 3.1 - main milestone Apr 17, 2023
cescoffier pushed a commit to cescoffier/quarkus that referenced this issue Apr 18, 2023
- make it clear that it should not be used for generated classes
- resolves quarkusio#13464
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Apr 20, 2023
- make it clear that it should not be used for generated classes
- resolves quarkusio#13464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants