[ 
https://issues.apache.org/jira/browse/GROOVY-7909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15579707#comment-15579707
 ] 

ASF GitHub Bot commented on GROOVY-7909:
----------------------------------------

Github user blindpirate commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/432#discussion_r83548596
  
    --- Diff: 
src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java ---
    @@ -36,13 +38,19 @@
     
     import java.util.List;
     
    +import static org.objectweb.asm.Opcodes.ACC_ABSTRACT;
    +import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
    +import static org.objectweb.asm.Opcodes.ACC_STATIC;
    +import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC;
    +
     /**
      * This transformer is used to transform calls to 
<code>SomeTrait.super.foo()</code> into the appropriate trait call.
      *
      * @author Cédric Champeau
      * @since 2.3.0
      */
     class SuperCallTraitTransformer extends ClassCodeExpressionTransformer {
    +    public static final String UNRESOLVED_HELPER_CLASS = 
"UNRESOLVED_HELPER_CLASS";
    --- End diff --
    
    Yes, I haven't realize it. Done as you say.


> Calling parents method from trait using Parent.super.method() fail depending 
> on trait declaration order
> -------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7909
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7909
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.7
>         Environment: Grails 3.1.9
>            Reporter: Sébastien Collin
>            Priority: Critical
>
> I'm using trait for multiple inheritance and I faced an issue when compiling 
> my project (using Grails 3.1.9, so with the gradle task CompileGroovy).
> My traits are sharing a common method ({{def method()}}) and I'm referencing 
> parent's version through ParentClassName.super.method()
> I'm seeing this error:
> {quote}
> > BUG! exception in phase 'semantic analysis' in source unit 'xxx.groovy' 
> > ClassNode#getTypeClass for YYY is called before the type class is set
> {quote}
> When testing different cases it seems that this problem appears because 
> classes are not compiled in the right order.
> For example, a script with 
> {code}
> trait Three implements One, Two {
>     def postMake() {
>         One.super.postMake()
>         Two.super.postMake()
>         println "Three"
>     }
> }
> trait One {
>     def postMake() { println "One"}
> }
> trait Two {
>     def postMake() { println "Two"}
> }
> class Four implements Three {
>     def make() {
>         Three.super.postMake()
>         println "All done?"
>     }
> }
> Four f = new Four()
> f.make()
> {code}
> will fail, whereas putting Three method after One and Two will succeed.
> Beside, keeping this trait's declaration order but changing method names to 
> be unique (and removing {{XXX.super}}) will compile and execute correctly.
> I hope I'm clear enough...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to