Repository navigation
Add regression test for Java annotation @Retention visibility (#389) - #26339
Merged
SolalPirelli merged 2 commits intoJun 23, 2026
Merged
Conversation
jozanek
force-pushed
the
issue-389-annotation-retention-test
branch
from
June 15, 2026 22:36
a0019fa to
8fe98f2
Compare
Contributor
|
Hey, I know this is still a draft, so just a reminder before this is tagged as ready to review - please remember to use the PR template and answer the questions contained there in the PR description. |
jozanek
marked this pull request as ready for review
June 16, 2026 09:47
SolalPirelli
left a comment
Contributor
There was a problem hiding this comment.
Can the test be kept as an end-to-end test in tests using reflection? Manually invoking part of the compiler is less maintainable, we try to keep most tests e2e if they can be.
Contributor
Author
|
@SolalPirelli test/PR desc updated, please have a look again. |
SolalPirelli
enabled auto-merge (squash)
June 22, 2026 07:05
Contributor
|
Seems the CI isn't running. |
Gedochao
force-pushed
the
issue-389-annotation-retention-test
branch
from
June 23, 2026 09:20
f0b02fd to
9dfacae
Compare
Contributor
|
(rebased) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #389.
The original request — having the backend honour a Java annotation's
@Retentionrather than assuming everything is runtime-visible — is already resolved: the Java parser now reads meta-annotations on@interfacedeclarations (JavaParsers.modifiers/annotationDecl), so an explicit@Retentionis respected end-to-end. This PR is therefore coverage + documentation, not a behavioral change: it locks in the existing behavior and documents the one remaining compatibility default. It replaces the disabled, partest-basedtests/disabled/reflect/run/t4788.How much have you relied on LLM-based tools in this contribution?
Extensively, for codebase investigation, writing the regression test, and drafting this description. I have reviewed every line and am responsible for the contribution (per LLM_POLICY.md).
How was the solution tested?
New automated test, an end-to-end
tests/run/i389test that uses Java reflection to assert a Java-defined annotation's@Retentionis honored:RUNTIMEis visible at runtime, whileCLASS/SOURCEare not, checked on both a class and a method. The Java annotation sources are read by dotty's Java parser, so this exercises the path #389 was about. Verified withtestCompilation i389.