-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ArC: defer unproxyability errors to runtime in strict mode
The CDI specification demands that if an injection point resolves to a bean, unproxyability of that bean should be treated as a deployment problem. ArC used to treat all unproxyable beans uniformly, even those that are not injected anywhere. This commit changes that: in strict mode, only unproxyable beans that are actually injected somewhere trigger a deployment-time error. Unproxyable beans that are not injected anywhere do not cause a deployment-time error and instead, the `Bean` class (its `get(CreationalContext)` method, specifically) is generated in a way that `UnproxyableResolutionException` is thrown when obtaining a contextual reference, as expected by the CDI spec.
- Loading branch information
Showing
8 changed files
with
141 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...va/io/quarkus/arc/test/clientproxy/finalmethod/FinalMethodIllegalWhenNotInjectedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.quarkus.arc.test.clientproxy.finalmethod; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.inject.UnproxyableResolutionException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.Arc; | ||
import io.quarkus.arc.test.ArcTestContainer; | ||
|
||
public class FinalMethodIllegalWhenNotInjectedTest { | ||
@RegisterExtension | ||
public ArcTestContainer container = ArcTestContainer.builder() | ||
.beanClasses(Moo.class) | ||
.strictCompatibility(true) | ||
.shouldFail() | ||
.build(); | ||
|
||
@Test | ||
public void test() { | ||
assertThrows(UnproxyableResolutionException.class, () -> { | ||
Arc.container().instance(Moo.class).get(); | ||
}); | ||
} | ||
|
||
@ApplicationScoped | ||
static class Moo { | ||
final int getVal() { | ||
return -1; | ||
} | ||
} | ||
} |