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

ArC: filter out class-retained or missing annotations #29452

Merged
merged 1 commit into from Nov 24, 2022

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Nov 23, 2022

Sometimes, ArC used to call the AnnotationLiteralProcessor with annotations that are either class-retained, or their classes are missing (which is perfectly legal). It is a minority of callers though -- most of them only call AnnotationLiteralProcessor with qualifiers or interceptor bindings. Those must always be runtime-retained and their classes must be present, and it is an error if they are not.

At the same time, we don't want to generate annotation literals for class-retained annotations or for annotations whose classes are missing.

The AnnotationLiteralProcessor already checks that the annotation class exists, so with this commit, it also checks that the annotation for which the literal is generated is runtime-retained. If not, an exception is thrown. This lets us know that there's a problem somewhere.

There are 2 places where ArC deals with arbitrary annotations and may need to generate annotation literals for them; in both cases, the code has to process all annotations present on an injection point. In these cases, it is straightforward to filter out class-retained annotations and missing annotation classes.

Fixes #29425

Sometimes, ArC used to call the `AnnotationLiteralProcessor` with
annotations that are either class-retained, or their classes are missing
(which is perfectly legal). It is a minority of callers though -- most
of them only call `AnnotationLiteralProcessor` with qualifiers or
interceptor bindings. Those must always be runtime-retained and their
classes must be present, and it is an error if they are not.

At the same time, we don't want to generate annotation literals for
class-retained annotations or for annotations whose classes are missing.

The `AnnotationLiteralProcessor` already checks that the annotation class
exists, so with this commit, it also checks that the annotation for which
the literal is generated is runtime-retained. If not, an exception is
thrown. This lets us know that there's a problem somewhere.

There are 2 places where ArC deals with arbitrary annotations and may need
to generate annotation literals for them; in both cases, the code has to
process all annotations present on an injection point. In these cases, it
is straightforward to filter out class-retained annotations and missing
annotation classes.
@quarkus-bot quarkus-bot bot added the area/arc Issue related to ARC (dependency injection) label Nov 23, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 24, 2022

Failing Jobs - Building 46268e3

Status Name Step Failures Logs Raw logs
JVM Tests - JDK 11 Build Failures Logs Raw logs
✔️ JVM Tests - JDK 17
✔️ JVM Tests - JDK 17 MacOS M1
✔️ JVM Tests - JDK 18

Full information is available in the Build summary check run.

Failures

⚙️ JVM Tests - JDK 11 #

- Failing: integration-tests/reactive-messaging-hibernate-orm 

📦 integration-tests/reactive-messaging-hibernate-orm

io.quarkus.it.kafka.KafkaConnectorTest.testFruits line 50 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Assertion condition defined as a io.quarkus.it.kafka.KafkaConnectorTest expected: <6> but was: <1> within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)

@mkouba mkouba merged commit 252697a into quarkusio:main Nov 24, 2022
@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Nov 24, 2022
@Ladicek Ladicek deleted the filter-annotation-literals branch November 24, 2022 11:09
@gsmet gsmet modified the milestones: 2.15 - main, 2.14.2.Final Nov 24, 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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indexed provided annotation breaks build goal (or app startup) in 2.14
4 participants