[ https://issues.apache.org/jira/browse/GROOVY-8008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16518916#comment-16518916 ]
ASF GitHub Bot commented on GROOVY-8008: ---------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/757 > @CompileStatic causes failure to compile Groovy class that calls overloaded > Java method > --------------------------------------------------------------------------------------- > > Key: GROOVY-8008 > URL: https://issues.apache.org/jira/browse/GROOVY-8008 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.4.5, 2.4.7, 2.4.8 > Environment: Mac OS / Java 8_u112 > Reporter: Renato Athaydes > Priority: Major > > This bug is not making sense to me, but I want to report it because it's > incredibly frustrating to get an error message that won't even tell me which > file the compiler was trying to compile before throwing an Exception. > Here's the stacktrace: > Error:Groovyc: While compiling osgiaas-cli-groovy_main: > java.lang.ArrayIndexOutOfBoundsException: 2 > at org.codehaus.groovy.vmplugin.v5.Java5.makeParameters(Java5.java:443) > at > org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:376) > at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:265) > at org.codehaus.groovy.ast.ClassNode.getAnnotations(ClassNode.java:1431) > at org.codehaus.groovy.ast.ClassNode.getAnnotations(ClassNode.java:1430) > at > org.codehaus.groovy.transform.trait.Traits.isAnnotatedWithTrait(Traits.java:170) > at org.codehaus.groovy.transform.trait.Traits.isTrait(Traits.java:149) > at > org.codehaus.groovy.transform.trait.Traits.collectSelfTypes(Traits.java:309) > at > org.codehaus.groovy.transform.trait.Traits.collectSelfTypes(Traits.java:291) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.addSelfTypes(StaticTypeCheckingVisitor.java:3102) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.makeOwnerList(StaticTypeCheckingVisitor.java:3083) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2852) > at > org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) > at > org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2735) > at > org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) > at > org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2735) > at > org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) > at > org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2735) > at > org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) > at > org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) > at > org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitProperty(ClassCodeVisitorSupport.java:144) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitProperty(StaticTypeCheckingVisitor.java:1518) > at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1074) > at > org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53) > at > org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249) > at > org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:122) > at > org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:63) > at > org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134) > at > org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178) > at > org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1055) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) > at > org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62) > at > org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:136) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:156) > at > org.jetbrains.jps.incremental.groovy.InProcessGroovyc.access$000(InProcessGroovyc.java:51) > at > org.jetbrains.jps.incremental.groovy.InProcessGroovyc$1.call(InProcessGroovyc.java:85) > at > org.jetbrains.jps.incremental.groovy.InProcessGroovyc$1.call(InProcessGroovyc.java:82) > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > at java.lang.Thread.run(Thread.java:745) > All I can tell you is that [this > commit](https://github.com/renatoathaydes/osgiaas/commit/3b04f1d22b3b612d49a5af6fab402b2f4fe316d7) > (to a Java class in another module!) started causing this error. Basically, > it adds a new overload to a method > (`com.athaydes.osgiaas.cli.args.ArgsSpec.ArgsSpecBuilder#accepts(java.lang.String, > java.lang.String)`) which no class even calls yet. > The error happens when compiling the > [:modules:cli:osgiaas-cli-grab](https://github.com/renatoathaydes/osgiaas/tree/master/modules/cli/osgiaas-cli-grab/src/main/groovy/com/athaydes/osgiaas/cli/grab) > module, which only contains 2 groovy classes (so it should be possible to > determine why this is happening a little more easily). > Reverting the commit, the code compiles and all tests pass. > Removing `@CompileStatic` from the classes also seems to fix the problem, but > then other Groovy classes (which also have `@CompileStatic`) start failing! > Please let me know if there's anything I can do to help figure this out... > but for now, that's all the information I can provide! -- This message was sent by Atlassian JIRA (v7.6.3#76005)