Fully discarded annotations if repeated but not repeatable

Mickael Istria mistria at redhat.com
Wed Aug 6 09:02:16 UTC 2025


Hi all,

I'm seeing what we interpret as a limitation with Javac when comparing with
ECJ, which has impact on things like semantic search in the downstream
Eclipse IDE when Javac is used as backend for code-analysis.
I'm not sure it would qualify as a bug though, I would let people who are
more expert judge of the best way to consider this case, or not.

So from a bit of code in Test.java file
```
package pack;

@Ann
@Ann
class Test {
}

@interface Ann  {
}
```

Run the various compilation stage up to Analyze. This report an error thant
Ann is not repeatable; all good.
Then from the JCTree element, navigate to Test and read the typeSymbol that
is attached to it, and then inspect the value of
`typeSymbol.getAnnotationMirrors()`.
EXPECTED: 2 annotation mirrors anyway (maybe with ErrorType or whatever)
GOT: 0 annotaiton mirror
So in later analysis, those annotations are simply non-existant at all,
making it impossible eg to reliably report that Ann has a (faulty) consumer.

Cheers
-- 
Mickael Istria
Eclipse IDE <https://www.eclipse.org/eclipseide> developer, for Red Hat
<https://developers.redhat.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250806/5cde254d/attachment.htm>


More information about the compiler-dev mailing list