pashapm / cofoja

Automatically exported from code.google.com/p/cofoja
GNU Lesser General Public License v3.0
0 stars 0 forks source link

NPE in LineNumberingMethodAdapter#onMethodEnter when using the Eclipse compiler #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When running the annotation processor with the Eclipse compiler (ecj.jar), upon 
executing the contracted code a null pointer exception is thrown in 
LineNumberingMethodAdapter#onMethodEnter. The attached patch adds an extra null 
check, which makes it work for me in Eclipse.

Original issue reported on code.google.com by fst...@gmail.com on 6 Feb 2011 at 6:25

Attachments:

GoogleCodeExporter commented 9 years ago
Indeed, the check is made in visitLocalVariable() below and not in 
onMethodEnter(). I've rearranged the patch so it looks like the code in 
visitLocalVariable() but otherwise it should work now in r67. Can you confirm?

Also, this seems to indicate that Eclipse does not support the javac extension 
APIs, which means that among other things, line numbering won't work properly 
(e.g. in the stack traces when an exception is thrown for contract violation). 
Am I right? Maybe it exposes its own API; since Eclipse is so widely used, it 
could be worthwhile to add support, though I don't know much about Eclipse.

Original comment by nhat.min...@gmail.com on 6 Feb 2011 at 6:58

GoogleCodeExporter commented 9 years ago
Yes, it works with ecj in r67 and there are no line numbers for annotations in 
stack traces for contract violations.

I don't really know any details about this, but I suppose if it was supported 
in ecj it would be available using the same API as in javac, so my guess is it 
isn't supported yet.

Many thanks for fixing this so quickly!

Original comment by fst...@gmail.com on 6 Feb 2011 at 8:06