I recently moved a large codebase to Groovy 2.5.7. I use Eclipse as my programming environment. The system mostly works, but I get a strange error that puzzles me. One of my Groovy classes (PropertyDefinition) seems to generate a type-checking error, except that it seems that Eclipse is complaining about nothing and the program runs fine.Eclipse shows an error-marker at the top of the file but does NOT show an error in the project browser or give me a warning when I launch the program. The error-marker shows that the type-checker crashed, it does not complain about any particular line. The message associated with the error-marker is
General error during instruction selection: Failed to initialize members for type com.metaficient.core.objectmodel.PropertyDefinition java.lang.RuntimeException: Failed to initialize members for type
com.metaficient.core.objectmodel.PropertyDefinition at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initializeMembers(JDTClassNode.java:306) at
org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initialize(JDTClassNode.java:202) at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.lazyClassInit(JDTClassNode.java:169) at
org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1150) at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1139) at
and so on for many lines. This gets called by Groovy's StaticTypeCheckingVisitor, which in turn is invoked by Eclipse. A number of files (a small percent of the whole) give the same error message, including complaining about PropertyDefinition in the first line.
I have set @CompileStatic and if I comment out that line, the error message goes away. But I want it to be compiled statically!
How would I figure out what is causing this? I assume it is both a bug in the Groovy compiler (because it is not giving a property error message) and something I am doing wrong that is triggering the bug.
Also, the system is running about ten times slower than I expected. I wonder whether this bug is causing parts of the system to turn off @CompileStatic even though I declared it. Does that seem likely? If so, it is very important for me to fix this problem.