You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/04/11 19:25:00 UTC
[jira] [Resolved] (GROOVY-11001) AIOOBE when using method reference in nested lambda
[ https://issues.apache.org/jira/browse/GROOVY-11001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-11001.
----------------------------------
Resolution: Fixed
https://github.com/apache/groovy/commit/74faadd52effe6f3ade30cc9221af43e79ce5652
> AIOOBE when using method reference in nested lambda
> ---------------------------------------------------
>
> Key: GROOVY-11001
> URL: https://issues.apache.org/jira/browse/GROOVY-11001
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 4.0.11
> Reporter: Christopher Smith
> Assignee: Eric Milles
> Priority: Major
>
> When using (1) the method-reference operator (but not the method-closure operator) (2) inside a nested lambda, the STC throws an AIOOBE.
> {code:groovy}
> @Grapes([
> @Grab(group = 'software.amazon.awssdk', module = 'utils', version = '2.18.31'),
> @Grab(group = 'io.vavr', module = 'vavr', version = '0.10.3'),
> ])
> @CompileStatic
> class Bug {
> Object bug() {
> Try.success('1234')
> .flatMap {
> Try.success(it)
> .map(StringInputStream::new)
> }
> }
> }
> {code}
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> General error during instruction selection: Internal compiler error while compiling Bug.groovy
> Method: org.codehaus.groovy.ast.MethodNode@782bf610[software.amazon.awssdk.utils.StringInputStream ctorRef$doCall$0(java.lang.String) from Bug$_bug_closure1]
> Line -1, expecting casting to software.amazon.awssdk.utils.StringInputStream but operand stack is empty
> java.lang.ArrayIndexOutOfBoundsException: Internal compiler error while compiling Bug.groovy
> Method: org.codehaus.groovy.ast.MethodNode@782bf610[software.amazon.awssdk.utils.StringInputStream ctorRef$doCall$0(java.lang.String) from Bug$_bug_closure1]
> Line -1, expecting casting to software.amazon.awssdk.utils.StringInputStream but operand stack is empty
> at org.codehaus.groovy.classgen.asm.OperandStack.throwExceptionForNoStackElement(OperandStack.java:335)
> at org.codehaus.groovy.classgen.asm.OperandStack.doConvertAndCast(OperandStack.java:340)
> at org.codehaus.groovy.classgen.asm.OperandStack.doGroovyCast(OperandStack.java:305)
> at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:593)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:812)
> at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:73)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:601)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:546)
> at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:110)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:685)
> at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1142)
> at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1124)
> at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:365)
> at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:797)
> at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:814)
> at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:937)
> at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:692)
> at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:666)
> at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:647)
> at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:311)
> at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:240)
> at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:165)
> at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:205)
> at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:189)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:568)
> at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
> at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:132)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)