[antlr-interest] GUnit: NPE on JUnitCodeGeneration

Tilman Bender tbender at stud.hs-heilbronn.de
Thu Apr 2 09:28:48 PDT 2009


Hi folks,

Tried to setup a testsuite for my tree grammar. The testsuite can be  
run (allthough all tests fail) via the normal org.antlr.gunit.Interp  
command but
when I try to generate JUnit-Code for it I get an NPE:

  java -cp ../../../target/classes/:$CLASSPATH org.antlr.gunit.Interp - 
o Optimizer.testsuite
Exception in thread "main" java.lang.NullPointerException
	at org.antlr.gunit.JUnitCodeGen.changeFirstCapital(JUnitCodeGen.java: 
322)
	at org.antlr.gunit.JUnitCodeGen.genTestRuleMethods(JUnitCodeGen.java: 
193)
	at org.antlr.gunit.JUnitCodeGen.compileToBuffer(JUnitCodeGen.java:121)
	at org.antlr.gunit.JUnitCodeGen.compile(JUnitCodeGen.java:113)
	at org.antlr.gunit.Interp.main(Interp.java:55)

I am using antlr-3.1.3 and the respective version of antlr3-maven- 
plugin to do the grammar code-generation and compilation.
 From what I found so far it seems to be that :

- gUnitTestSuite doesnt correctly set the treerule field
- JUnitCodeGen doesn't check for null in genTestRuleMethods

I attached my grammars so you can reproduce the problem.

NB: If anybody has a neat solution to integrate gunit with maven  
pleeease answer my prior thread :)




kind regards

Tilman Bender
Student des Software Engineering
Hochschule Heilbronn
tbender at stud.hs-heilbronn.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090402/869c185a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Arith.g
Type: application/octet-stream
Size: 3781 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20090402/869c185a/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090402/869c185a/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Optimizer.g
Type: application/octet-stream
Size: 1633 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20090402/869c185a/attachment-0001.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090402/869c185a/attachment-0002.html 


More information about the antlr-interest mailing list