Compiler crash on annotation handling

Joel Borggrén-Franck joel.franck at
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/
> 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.


More information about the type-annotations-dev mailing list