Expressions for annotation values and parameterized types.

Gavin King gavin.king at gmail.com
Wed Jun 17 15:03:00 PDT 2009


Hi folks,

something that has come up in JSR-299 is the fact that Java provides
no easy expression syntax for:

* annotation values
* parameterized types

We have to jump through hoops instead of being able to write:

    Named named = @Named( getName() );

or:

    ParameterizedType<Set<Employee>> type = Set<Employee>.class;

These problems certainly have (ugly) workarounds, and that's why 299
introduces AnnotationLiteral and TypeLiteral, but it would be great if
these helper classes could be hidden by the compiler.

These issues are becoming more important as Java APIs move in the
direction of greater typesafety.

I'm happy to work on a more formal proposal if there is interest in
addressing these issues.


-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the coin-dev mailing list