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

ArrayIndexOutOfBoundsException when compiling method call with many overloaded methods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.14
    • 2.5.15, 3.0.8, 4.0.0-alpha-3
    • Compiler
    • None
    • Gradle 6.7.1, no other specifics

    Description

      I have a small demonstration project where the error during compilation can be observed: https://github.com/chbriem/groovy-compile-error

      After upgrading from 2.5.13 to 2.5.14, the compiler now throws the following exception:

      startup failed:
      General error during semantic analysis: Index 3 out of bounds for length 3
      
      java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
      	at org.codehaus.groovy.ast.ClassNode.hasExactMatchingCompatibleType(ClassNode.java:1315)
      	at org.codehaus.groovy.ast.ClassNode.tryFindPossibleMethod(ClassNode.java:1298)
      	at org.codehaus.groovy.control.StaticImportVisitor.transformMethodCallExpression(StaticImportVisitor.java:252)
      	at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:113)
      	at org.codehaus.groovy.ast.expr.DeclarationExpression.transformExpression(DeclarationExpression.java:175)
      	at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:149)
      	at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:142)
      	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
      	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
      	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.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:53)
      	at org.codehaus.groovy.control.StaticImportVisitor.visitConstructorOrMethod(StaticImportVisitor.java:89)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:132)
      	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1103)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
      	at org.codehaus.groovy.control.StaticImportVisitor.visitClass(StaticImportVisitor.java:83)
      	at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:708)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1084)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:640)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:618)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:595)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:574)
      	at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:277)
      	at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:67)
      	at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:98)
      	at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:77)
      	at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
      	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
      	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
      	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
      	at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
      	at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
      	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
      	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
      	at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:85)
      	at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:55)
      	at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
      	at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
      	at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
      	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:414)
      	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)
      

      If some information is missing, feel free to contact me.

      Attachments

        Activity

          People

            emilles Eric Milles
            ChrisBriem Chris Briem
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m