Accessing type annotations via annotation processor

Joe Darcy joe.darcy at
Mon Aug 11 18:20:25 UTC 2014

On 08/11/2014 03:22 AM, Gunnar Morling wrote:
> Hi,
> I'm looking for a way to obtain annotations given on type uses using a 
> JSR 269 annotation processor.
> E.g. I'd like to obtain the @NotNull annotation from the following 
> field declaration:
>     ...
>     private List<@NotNull String> values;
> Based on a post of Joe [1] I assumed this to be possible, but a 
> discussion on this list now makes me believe this cannot be done as of 
> Java 8. Is this true? If so, will this be the case in SE 9?
> On a tangent, Joe referenced a diff of the JavaDocs of two versions of 
> the JSR 269 API, containing nicely colored mark-up highlighting the 
> changes. What's the tool used for creating this diff?

On the last point, I used a tool called "specdiff." This tool was 
developed by Sun and Oracle, but is not currently available externally.



More information about the compiler-dev mailing list