Thodoris Sotiropoulos created GROOVY-11427:
----------------------------------------------
Summary: unexpectec crash in class generation "On receiver: x with
message: getAt and arguments: 0"
Key: GROOVY-11427
URL: https://issues.apache.org/jira/browse/GROOVY-11427
Project: Groovy
Issue Type: Bug
Components: Static compilation, Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following (ill-typed) program:
{code:java}
class Test {
void test() {
Class<String> x = null;
x[0];
}
} {code}
h3.
Actual behavior
{code:java}
>>> a serious error occurred: BUG! exception in phase 'class generation' in
>>> source unit 'test.groovy' at line 4 column 5
On receiver: x with message: getAt and arguments: 0
This method should not have been called. Please try to create a simple example
reproducing this error and file a bug report at
https://issues.apache.org/jira/browse/GROOVY
>>> stacktrace:
BUG! exception in phase 'class generation' in source unit 'test.groovy' at line
4 column 5
On receiver: x with message: getAt and arguments: 0
This method should not have been called. Please try to create a simple example
reproducing this error and file a bug report at
https://issues.apache.org/jira/browse/GROOVY
at
org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:592)
at
org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:659)
at
org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:730)
at
org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:203)
at
org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:341)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:872)
at
org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:57)
at
org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:610)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:850)
at
org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:41)
at
org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:86)
at
org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:77)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:775)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:72)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:634)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:569)
at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:110)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:718)
at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1331)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1324)
at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:369)
at
org.codehaus.groovy.control.CompilationUnit$4.call(CompilationUnit.java:810)
at
org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:952)
at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:698)
at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:672)
at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:653)
at
org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:312)
at
org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:241)
at
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:166)
at
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:206)
at
org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:190)
{code}
Tested against master (commit: eb8448f0f74b5e404aabe1428d99151f75954018)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)