Evolution of annotation types - reducing set of supported targets

Gunnar Morling gunnar at hibernate.org
Wed Jun 28 08:23:42 UTC 2017


I'm trying to figure whether removing an element type from an
annotation's set of supported targets is considered to break binary
compatibility or not.

Some quick testing indicates it's non-breaking: I have an annotation
which in v1 supports {TYPE,FIELD} and in v2 just {FIELD}. Linking
against v2, I still can retrieve the annotation from a type definition
in a binary compiled against v1.

Is there some official confirmation of this? Esp. is it guaranteed
that the annotation can be retrieved from the now unsupported location
or could there theoretically be a runtime which performs a check of
the supported targets? I was looking in JLS 13.5.7. "Evolution of
Annotation Types", but couldn't find anything.



More information about the compiler-dev mailing list