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

NPE on build when decorator is injected a delegate that is a subtype of the decorated interface #22142

Closed
xtaixe opened this issue Dec 13, 2021 · 11 comments
Labels
area/arc Issue related to ARC (dependency injection) kind/bug Something isn't working triage/invalid This doesn't seem right triage/needs-reproducer We are waiting for a reproducer.

Comments

@xtaixe
Copy link

xtaixe commented Dec 13, 2021

Describe the bug

Getting:

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.NullPointerException
[ERROR] 	at io.quarkus.arc.processor.SubclassGenerator.processDecorator(SubclassGenerator.java:572)
[ERROR] 	at io.quarkus.arc.processor.SubclassGenerator.createConstructor(SubclassGenerator.java:199)
[ERROR] 	at io.quarkus.arc.processor.SubclassGenerator.generate(SubclassGenerator.java:118)
[ERROR] 	at io.quarkus.arc.processor.BeanProcessor.generateResources(BeanProcessor.java:205)
[ERROR] 	at io.quarkus.arc.deployment.ArcProcessor.generateResources(ArcProcessor.java:462)

when using a subtype as a delegate instead of the decorated interface.

Expected behavior

Project builds and decorator and beans are handled properly.

Actual behavior

NPE on build

How to Reproduce?

No response

Output of uname -a or ver

Darwin xtaixe 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk 11.0.13 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.5.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.8.4

Additional information

No response

@xtaixe xtaixe added the kind/bug Something isn't working label Dec 13, 2021
@xtaixe
Copy link
Author

xtaixe commented Dec 13, 2021

Unfortunately I haven't been able to create a small reproducer for now. Hopefully the stacktrace gives an idea of what might be happening. Happy to answer any questions that might help figuring this out or taking any suggestions on what could be causing the error to try to create a small reproducer.

@xtaixe
Copy link
Author

xtaixe commented Dec 13, 2021

It seems it's related to priority of decorators cause if I add a priority to the decorator that uses the subtype the build works fine. So that it's easier to understand, I have something like this:

public interface A {}

@ApplicationScoped
public class B implements A {}


@Decorator
public class C implements A {

    private final A a;

    @Inject
    public C(@Delegate A a) {
        this.a = a;
    }

}

@Decorator
public class D implements A {

    private final A a;

    @Inject
    public D(@Delegate B b) {
        this.a = b;
    }

}

but I still haven't been able to make it fail on a small reproducer like this.

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

quarkus-bot bot commented Dec 13, 2021

/cc @manovotn, @mkouba

@mkouba mkouba self-assigned this Dec 13, 2021
@mkouba
Copy link
Contributor

mkouba commented Dec 13, 2021

@xtaixe I wasn't able to reproduce this particular error either but I found other problem and this PR should fix it.

@xtaixe
Copy link
Author

xtaixe commented Dec 13, 2021

Interesting... @mkouba would the test you added not pass without the changes? Anyway, I can test if this fixes my issue as soon as there's a release with those changes. Are there daily builds or similar?

@mkouba
Copy link
Contributor

mkouba commented Dec 13, 2021

Interesting... @mkouba would the test you added not pass without the changes?

Well, I only added the ping() method so that I can test the decoration itself...

Anyway, I can test if this fixes my issue as soon as there's a release with those changes. Are there daily builds or similar?

I don't think that this PR can actually fix your problem but +1 if you can try it ;-)

Are there daily builds or similar?

I believe that snapshots are deployed to https://s01.oss.sonatype.org/content/repositories/snapshots/ once a day or so. But it's very easy to build the snapshot locally - just clone the repo and run mvn clean install -Dquickly -T 1.

@mkouba
Copy link
Contributor

mkouba commented Apr 4, 2022

@xtaixe would you care to verify that the problem still exists?

@xtaixe
Copy link
Author

xtaixe commented Apr 4, 2022

@mkouba yes, still happening on 2.7.5.Final

@mkouba
Copy link
Contributor

mkouba commented Apr 4, 2022

@mkouba yes, still happening on 2.7.5.Final

Well, in that case we'll need more information. Would you care to create a simple reproducer app/test?

@xtaixe
Copy link
Author

xtaixe commented Apr 4, 2022

I already tried unsuccessfully at the time I raised the issue. I'll try again if I find the time, but I doubt my luck will change.

@mkouba mkouba added the triage/needs-reproducer We are waiting for a reproducer. label Aug 4, 2022
@mkouba mkouba removed their assignment Aug 4, 2022
@geoand
Copy link
Contributor

geoand commented Oct 14, 2022

Closing as we never got a reproducer

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2022
@geoand geoand added the triage/invalid This doesn't seem right label Oct 14, 2022
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 triage/invalid This doesn't seem right triage/needs-reproducer We are waiting for a reproducer.
Projects
None yet
Development

No branches or pull requests

3 participants