Sunday, June 29, 2008

Got an NPE when compiling from the compiler. Its very annoying since its the compiler bug and very hard to get to the class that freaked it out (no appropriate message). The error is:

java.lang.NullPointerException at com.sun.tools.javac.code.Types$IsSameTypeFcn.visitClassType at com.sun.tools.javac.code.Type$ClassType.accept at com.sun.tools.javac.code.Types$IsSameTypeFcn.isSameType at com.sun.tools.javac.code.Types$IsSameTypeFcn.visitClassType at com.sun.tools.javac.code.Type$ClassType.accept .....

I know it look strange, but that's what I needed. Actually I had this code in a test class, but I do use this funky structure in the business logic. Anyway it seems to trigger an edge case in the Sun compiler. The Eclipse JDT incremental Java compiler did not have any problems with the code, it compiled and run it without problems.I really don't have time now to submit the bug and full sample, maybe later.By the way it happened on my Mac java version "1.5.0_13". To solved the problem I used the same data sutucture but without the generics, i.e.: