Help with traits compilation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help with traits compilation

Milles, Eric (TR Technology & Ops)
Groovy devs,

When grails.testing.services.ServiceUnitTest is compiled, it produces the following class files in the build directory:
ServiceUnitTest.class
ServiceUnitTest$Trait$FieldHelper.class
ServiceUnitTest$Trait$Helper.class
ServiceUnitTest$Trait$Helper$_mockArtefact_closure1.class
ServiceUnitTest$Trait$Helper$_mockArtefact_closure1$_closure2.class

However, the javap output of the class tells a different story with regards to inner types:
    SourceFile: "ServiceUnitTest.groovy"
    InnerClasses:
         public static abstract #19= #18 of #2; //Helper=class grails/testing/services/ServiceUnitTest$Trait$Helper of class grails/testing/services/ServiceUnitTest
         public static #22= #21 of #2; //FieldHelper=class grails/testing/services/ServiceUnitTest$Trait$FieldHelper of class grails/testing/services/ServiceUnitTest
         static #25= #24 of #2; //1=class grails/testing/services/ServiceUnitTest$Trait$FieldHelper$1 of class grails/testing/services/ServiceUnitTest

It is this last type -- ServiceUnitTest$Trait$FieldHelper$1 -- that cannot be resolved.  Can someone familiar with traits compilation say if this class belongs in the bytecode and therefore should also be one of the output class files?  Or if this is an errant entry in the class file?  When the Compiler/IDE tries to resolve the type, it of course gets an error since it is missing.

Eric M.