It does appear to be Eclipse related. Can you compile outside Eclipse? If so, does the resulting class have the same inefficiency problem?

FYI, there are a small number of cases where we still call into the dynamic runtime even when @CompileStatic is in place. That is also a possibility. Looking at the bytecode can sometimes indicate such edge cases. There are sometimes ways to avoid those edge cases with some alternative coding.

Cheers, Paul.

On Fri, Sep 20, 2019 at 2:34 AM Ralph Johnson <> wrote:
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( at 

 org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initialize( at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.lazyClassInit( at 

 org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass( at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass( 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.

-Ralph Johnson