Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.5
-
Happens with the Groovy eclipse plugin and with IDEA using Groovy 2.0.5
Description
Running the code below created a runtime error:
@CompileStatic public class InnerType<T> { public T value = "" } @CompileStatic public class MyType<T> { public InnerType<T> inner = new InnerType<>() @CompileStatic public static main(args) { MyType<String> type = new MyType<>() // type.inner.value = "123" // println(type.inner.value) } }
Runtime error:
Groovyc: java.lang.ArrayIndexOutOfBoundsException: 0 at org.codehaus.groovy.ast.GenericsType$GenericsTypeMatcher.compareGenericsWithBound(GenericsType.java:344) at org.codehaus.groovy.ast.GenericsType$GenericsTypeMatcher.checkGenerics(GenericsType.java:273) at org.codehaus.groovy.ast.GenericsType$GenericsTypeMatcher.matches(GenericsType.java:244) at org.codehaus.groovy.ast.GenericsType.isCompatibleWith(GenericsType.java:173) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.typeCheckAssignment(StaticTypeCheckingVisitor.java:708) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitField(StaticTypeCheckingVisitor.java:1065) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1048) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:222) at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:108) at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:58) at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:132) at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:176) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1027) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:564) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:542) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:519) at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:44) at org.jetbrains.groovy.compiler.rt.GroovycRunner.main(GroovycRunner.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:112)