Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9171

Static compiler ASM error for methods with identical names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.7
    • 2.5.8, 3.0.0-beta-3
    • None
    • None

    Description

      After updating Gradle from Groovy 2.5.4 to 2.5.7 the following file fails to compile:

      https://github.com/gradle/gradle/blob/979d243c0eb81008a84e42a24cb43afc166f2bce/buildSrc/subprojects/performance/src/main/groovy/org/gradle/testing/RebaselinePerformanceTests.groovy#L34

       

      The error is the following:

      Method: MethodNode@1932705[org.gradle.testing.RebaselinePerformanceTests$_rebaseline_closure1#java.lang.Object doCall(java.lang.Object)]
      Line 34, expecting casting to java.lang.Object but operand stack is empty
      
      java.lang.ArrayIndexOutOfBoundsException: Internal compiler error while compiling /home/tcagent1/agent/work/668602365d1521fc/buildSrc/subprojects/performance/src/main/groovy/org/gradle/testing/RebaselinePerformanceTests.groovy
      Method: MethodNode@1932705[org.gradle.testing.RebaselinePerformanceTests$_rebaseline_closure1#java.lang.Object doCall(java.lang.Object)]
      Line 34, expecting casting to java.lang.Object but operand stack is empty
         at org.codehaus.groovy.classgen.asm.OperandStack.throwExceptionForNoStackElement(OperandStack.java:331)
         at org.codehaus.groovy.classgen.asm.OperandStack.doConvertAndCast(OperandStack.java:336)
         at org.codehaus.groovy.classgen.asm.OperandStack.doGroovyCast(OperandStack.java:300)
         at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:607)
         at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:685)
         at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:47)
         at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:93)
         at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:81)
         at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:635)
         at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
         at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:495)
         at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:431)
         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:132)
         at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:576)
         at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1103)
         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
         at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:269)
         at org.codehaus.groovy.control.CompilationUnit$18.call(CompilationUnit.java:854)
         at org.codehaus.groovy.control.CompilationUnit$18.call(CompilationUnit.java:871)
         at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1084)
         at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:645)
         at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:623)
         at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:600)
         at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
         at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:179)
         at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:57)
         at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:84)
         at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:72)
         at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:99)
         at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:79)
         at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:44)
         at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:34)
         at org.gradle.workers.internal.IsolatedClassloaderWorker.execute(IsolatedClassloaderWorker.java:55)
         at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:55)
         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
         at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:116)
         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
         at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
         at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
         at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
         at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
         at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:412)
         at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
         at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
         at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
         at java.base/java.lang.Thread.run(Thread.java:834)
      

       

      The related PR is https://github.com/gradle/gradle/pull/9627#discussion_r292402763

       

      Changing each to for loop reveals a different stack and a hint at an ASM related problem:

      groovy.lang.GroovyRuntimeException: ASM reporting processing error for org.gradle.testing.RebaselinePerformanceTests#rebaseline with signature void rebaseline() in RebaselinePerformanceTests.groovy:31. /home/tcagent1/agent/work/668602365d1521fc/buildSrc/subprojects/performance/src/main/groovy/org/gradle/testing/RebaselinePerformanceTests.groovy
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:455)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:132)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:576)
      	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1103)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:269)
      	at org.codehaus.groovy.control.CompilationUnit$18.call(CompilationUnit.java:854)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1084)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:645)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:623)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:600)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
      	at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:179)
      	at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:57)
      	at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:84)
      	at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:72)
      	at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:99)
      	at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:79)
      	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:44)
      	at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:34)
      	at org.gradle.workers.internal.IsolatedClassloaderWorker.execute(IsolatedClassloaderWorker.java:55)
      	at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:55)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:116)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
      	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
      	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
      	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
      	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:412)
      	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
      	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
      	at groovyjarjarasm.asm.Frame.merge(Frame.java:1268)
      	at groovyjarjarasm.asm.Frame.merge(Frame.java:1233)
      	at groovyjarjarasm.asm.MethodWriter.computeAllFrames(MethodWriter.java:1607)
      	at groovyjarjarasm.asm.MethodWriter.visitMaxs(MethodWriter.java:1543)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:436)
      	... 41 more
      

      Attachments

        Activity

          People

            paulk Paul King
            paplorinc Lőrinc Pap
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: