ajwang / groovypptest

Automatically exported from code.google.com/p/groovypptest
0 stars 0 forks source link

NPE during GString compilation #329

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
@Typed
String foo() {
  [1,2].collect { def elem ->
    def object = elem
    return "${object}"
  }
}

java.lang.NullPointerException
    at org.mbte.groovypp.compiler.CompilerStack.doStore(CompilerStack.java:480)
    at org.mbte.groovypp.compiler.CompilerStack.defineTypeInferenceVariable(CompilerStack.java:460)
    at org.mbte.groovypp.compiler.transformers.DeclarationExpressionTransformer$Dynamic.compile(DeclarationExpressionTransformer.java:150)
    at org.mbte.groovypp.compiler.bytecode.BytecodeExpr.visit(BytecodeExpr.java:43)
    at org.mbte.groovypp.compiler.StaticCompiler.visitExpressionStatement(StaticCompiler.java:352)
    at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
    at org.mbte.groovypp.compiler.StaticCompiler.visitBlockStatement(StaticCompiler.java:325)
    at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:51)
    at org.mbte.groovypp.compiler.StaticCompiler.execute(StaticCompiler.java:1148)
    at org.mbte.groovypp.compiler.StaticMethodBytecode.<init>(StaticMethodBytecode.java:75)
    at org.mbte.groovypp.compiler.StaticMethodBytecode.replaceMethodCode(StaticMethodBytecode.java:98)
    at org.mbte.groovypp.compiler.ClosureUtil.isMatch(ClosureUtil.java:163)
    at org.mbte.groovypp.compiler.transformers.MethodCallExpressionTransformer.inferTypesForClosure(MethodCallExpressionTransformer.java:810)
    at org.mbte.groovypp.compiler.transformers.MethodCallExpressionTransformer.foundMethodInference(MethodCallExpressionTransformer.java:742)
    at org.mbte.groovypp.compiler.transformers.MethodCallExpressionTransformer.findMethodVariatingArgs(MethodCallExpressionTransformer.java:630)
    at org.mbte.groovypp.compiler.transformers.MethodCallExpressionTransformer.findMethodWithClosureCoercion(MethodCallExpressionTransformer.java:845)
    at org.mbte.groovypp.compiler.transformers.MethodCallExpressionTransformer.createNormalMethodCall(MethodCallExpressionTransformer.java:126)
    at org.mbte.groovypp.compiler.transformers.MethodCallExpressionTransformer.transform(MethodCallExpressionTransformer.java:105)
    at org.mbte.groovypp.compiler.transformers.MethodCallExpressionTransformer.transform(MethodCallExpressionTransformer.java:49)
    at org.mbte.groovypp.compiler.transformers.ExprTransformer.transformExpression(ExprTransformer.java:120)
    at org.mbte.groovypp.compiler.CompilerTransformer.transform(CompilerTransformer.java:130)
    at org.mbte.groovypp.compiler.transformers.CastExpressionTransformer.transform(CastExpressionTransformer.java:239)
    at org.mbte.groovypp.compiler.transformers.CastExpressionTransformer.transform(CastExpressionTransformer.java:58)
    at org.mbte.groovypp.compiler.transformers.ExprTransformer.transformExpression(ExprTransformer.java:120)
    at org.mbte.groovypp.compiler.CompilerTransformer.transform(CompilerTransformer.java:130)
    at org.mbte.groovypp.compiler.CompilerTransformer.transformToGround(CompilerTransformer.java:148)
    at org.mbte.groovypp.compiler.StaticCompiler.visitReturnStatement(StaticCompiler.java:662)
    at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:47)
    at org.mbte.groovypp.compiler.StaticCompiler.visitBlockStatement(StaticCompiler.java:325)
    at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:51)
    at org.mbte.groovypp.compiler.StaticCompiler.execute(StaticCompiler.java:1148)
    at org.mbte.groovypp.compiler.StaticMethodBytecode.<init>(StaticMethodBytecode.java:75)
    at org.mbte.groovypp.compiler.StaticMethodBytecode.replaceMethodCode(StaticMethodBytecode.java:98)
    at org.mbte.groovypp.compiler.CompileASTTransform.visit(CompileASTTransform.java:108)
    at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:129)
    at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:172)
    at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:932)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:509)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
    at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:43)
    at org.jetbrains.groovy.compiler.rt.GroovycRunner.main(GroovycRunner.java:128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:75)

Original issue reported on code.google.com by gromop...@gmail.com on 13 Dec 2010 at 10:22

GoogleCodeExporter commented 8 years ago

Original comment by alex.tka...@gmail.com on 21 Dec 2010 at 10:17