groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milles, Eric (TR Technology & Ops)" <>
Subject Help with traits compilation
Date Fri, 14 Sep 2018 15:54:53 GMT
Groovy devs,
I am looking into these issues:

When 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"
         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.

View raw message