Compiler crash on annotation handling
Joel Borggrén-Franck
joel.franck at oracle.com
Tue Jul 16 00:40:23 PDT 2013
Hi Werner,
On 2013-07-15, Werner Dietl wrote:
> Joel, all,
>
> I added a test case in the type-annotations repository at:
>
> langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java
>
> It currently results in the NullPointerException reproduced below.
>
> The simplest fix is to add a guard against null. But I wanted to check
> whether we should look at a more general solution, setting the
> annotation position to non-null even for invalid annotation types.
>
> Thoughts?
>
I think your later suggestion is better, perhaps just add a shared
TypeAnnotationPosition INVALID instance?
While we can insert a guard my gut feeling is that we should not
construct TypeCompounds with a null position. TypeAnnotationPositions
sets type to UNKNOWN in the no-args ctor so it should be safe to look at
type if we just had a non-null pos.
cheers
/Joel
More information about the type-annotations-dev
mailing list