nhatminhle / cofoja

Contracts for Java
GNU Lesser General Public License v3.0
151 stars 18 forks source link

NPE when compiling with 1.3 release in Eclipse #48

Closed ngorogiannis closed 8 years ago

ngorogiannis commented 8 years ago

The error is triggered in AnnotationProcessor.getJavacOptions, which sounds related to one of the changes in 1.3 (pass-through javac options). Presumably javacProcessingEnvironmentClass is null and there is no guard against that. Judging by the statement that initialises that variable, line 140 fails with a class-not-found error.

I am not sure what this is for, so I cannot debug any further. How could I add javac in the classpath to work around this?

Thanks for the great library, it's very useful for teaching contracts!

log.txt

nhatminhle commented 8 years ago

Yes, there's a missing guard on that statement. I've pushed a new version that should fix that (just add the guard) and updated the release page.

You're not supposed to add javac to your classpath; if you're using a non-Sun javac, the test is supposed to fail. The feature has been around for so long, it didn't occur to me that maybe nobody had tried it in Eclipse.

Can you tell me if the new version with the guard runs fine in Eclipse?

ngorogiannis commented 8 years ago

I haven't tested this extensively yet, but no more NPEs with the latest jars. Thank you for the instant fix!