Jnario
Jnario copied to clipboard
Unknown variable within should_be_null => NullPointerException in generator
Using undefined variables in should be null
or => null
expressions produces no validation error and then a NullPointerException during code generation.
Example:
package bootstrap
describe "something"{
fact "x" {
abc should be null
}
}
Caused by: java.lang.NullPointerException at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.getTypeForVariableDeclaration(AbstractXbaseCompiler.java:630) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.declareFreshLocalVariable(AbstractXbaseCompiler.java:617) at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler._toJavaStatement(FeatureCallCompiler.java:156) at org.jnario.compiler.JnarioCompiler._toJavaStatement(JnarioCompiler.java:444) at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler._toJavaStatement(FeatureCallCompiler.java:253) at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.doInternalToJavaStatement(FeatureCallCompiler.java:101) at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:405) at org.eclipse.xtend.core.compiler.XtendCompiler.doInternalToJavaStatement(XtendCompiler.java:348) at org.jnario.compiler.JnarioCompiler.doInternalToJavaStatement(JnarioCompiler.java:88) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:465) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.toJavaStatement(AbstractXbaseCompiler.java:477) at org.jnario.compiler.JnarioCompiler._toShouldBeNullExpression(JnarioCompiler.java:153) at org.jnario.compiler.JnarioCompiler._toShouldExpression(JnarioCompiler.java:130) at org.jnario.compiler.JnarioCompiler._toJavaStatement(JnarioCompiler.java:124) at org.jnario.compiler.JnarioCompiler.doInternalToJavaStatement(JnarioCompiler.java:82) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:465) at org.eclipse.xtext.xbase.compiler.XbaseCompiler._toJavaStatement(XbaseCompiler.java:428) at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:369) at org.eclipse.xtend.core.compiler.XtendCompiler.doInternalToJavaStatement(XtendCompiler.java:348) at org.jnario.compiler.JnarioCompiler.doInternalToJavaStatement(JnarioCompiler.java:88) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:465) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.compile(AbstractXbaseCompiler.java:290) at org.eclipse.xtext.xbase.compiler.XbaseCompiler.toAnonymousClass(XbaseCompiler.java:1564) at org.eclipse.xtext.xbase.compiler.XbaseCompiler._toJavaStatement(XbaseCompiler.java:1526) at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:373) at org.eclipse.xtend.core.compiler.XtendCompiler.doInternalToJavaStatement(XtendCompiler.java:348) at org.jnario.compiler.JnarioCompiler.doInternalToJavaStatement(JnarioCompiler.java:88) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:465) at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.prepareExpression(FeatureCallCompiler.java:431) at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler._toJavaStatement(FeatureCallCompiler.java:135) at org.jnario.compiler.JnarioCompiler._toJavaStatement(JnarioCompiler.java:449) at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.doInternalToJavaStatement(FeatureCallCompiler.java:103) at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:405) at org.eclipse.xtend.core.compiler.XtendCompiler.doInternalToJavaStatement(XtendCompiler.java:348) at org.jnario.compiler.JnarioCompiler.doInternalToJavaStatement(JnarioCompiler.java:88) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:465) at org.eclipse.xtext.xbase.compiler.XbaseCompiler._toJavaStatement(XbaseCompiler.java:430) at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:369) at org.eclipse.xtend.core.compiler.XtendCompiler.doInternalToJavaStatement(XtendCompiler.java:348) at org.jnario.compiler.JnarioCompiler.doInternalToJavaStatement(JnarioCompiler.java:88) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:465) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.compile(AbstractXbaseCompiler.java:290) at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.compile(AbstractXbaseCompiler.java:270) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.compile(JvmModelGenerator.java:1264) at org.eclipse.xtend.core.compiler.XtendGenerator.compile(XtendGenerator.java:193) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateExecutableBody(JvmModelGenerator.java:1230) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator._generateMember(JvmModelGenerator.java:930) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateMember(JvmModelGenerator.java:2008) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator$2.apply(JvmModelGenerator.java:317) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator$2.apply(JvmModelGenerator.java:1) at org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow(ObjectExtensions.java:139) at org.eclipse.xtext.xbase.compiler.LoopExtensions$1.apply(LoopExtensions.java:39) at org.eclipse.xtext.xbase.lib.IterableExtensions.forEach(IterableExtensions.java:399) at org.eclipse.xtext.xbase.compiler.LoopExtensions.forEach(LoopExtensions.java:42) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateMembersInBody(JvmModelGenerator.java:321) at org.eclipse.xtend.core.compiler.XtendGenerator.generateMembersInBody(XtendGenerator.java:429) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator._generateBody(JvmModelGenerator.java:279) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateBody(JvmModelGenerator.java:1980) at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateType(JvmModelGenerator.java:219) at org.jnario.compiler.JnarioStandaloneCompiler$9.apply(JnarioStandaloneCompiler.java:264) at org.jnario.compiler.JnarioStandaloneCompiler$9.apply(JnarioStandaloneCompiler.java:1) at org.eclipse.xtext.xbase.lib.IterableExtensions.forEach(IterableExtensions.java:399) at org.jnario.compiler.JnarioStandaloneCompiler.generateJavaFiles(JnarioStandaloneCompiler.java:277) at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.compile(XtendBatchCompiler.java:399) at org.jnario.compiler.CompilerMain.compile(CompilerMain.java:91) at org.jnario.compiler.CompilerMain.main(CompilerMain.java:45) ... 5 more