Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7966

Change in source order changes output in Java+Groovy joint compilation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.7
    • Fix Version/s: 2.4.8
    • Component/s: None
    • Labels:
      None

      Description

      When compiling these three classes

      AbstractThing.groovy:

      class AbstractThing {}
      

      Thing.groovy:

      class Thing extends AbstractThing {}
      

      JavaThing.java:

      public class JavaThing {}
      

      Two different results are produced for Thing.class based on the order of the source files provided to the Groovy compiler:

      $ groovyc -d output -j AbstrctThing.groovy Thing.groovy JavaThing.java
      $ javap output/Thing.class
      Compiled from "Thing.groovy"
      public class Thing extends AbstractThing {
        public static transient boolean __$stMC;
        public Thing();
        protected groovy.lang.MetaClass $getStaticMetaClass();
        public groovy.lang.MetaClass super$2$$getStaticMetaClass();
      }
      $ groovyc -d output -j Thing.groovy AbstrctThing.groovy JavaThing.java
      $ javap output/Thing.class
      Compiled from "Thing.groovy"
      public class Thing extends AbstractThing implements groovy.lang.GroovyObject {
        public static transient boolean __$stMC;
        public Thing();
        protected groovy.lang.MetaClass $getStaticMetaClass();
        public groovy.lang.MetaClass super$2$$getStaticMetaClass();
      }
      

      Notice that when the source for the abstract superclass follows the source of the concrete class, the concrete class ends up implementing GroovyObject, but not if the order of the two source files is reversed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                lptr Lóránt Pintér
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: