The compiled enumeration with maven vs. ant: Differences

I compiled the same listing with Maven and Ant (Java 7). Class files are different. The order of some elements in the constant pool seems to be different, and in addition, the generated methods have different byte codes. The "values ​​()" method looks like this for Maven:

public static de.continentale.vs.common.model.enums.PartnerRolle[] values();
    Code:
       0: getstatic     #1                  // Field $VALUES:[Lde/continentale/vs/common/model/enums/PartnerRolle;
       3: invokevirtual #2                  // Method "[Lde/continentale/vs/common/model/enums/PartnerRolle;".clone:()Ljava/lang/Object;
       6: checkcast     #3                  // class "[Lde/continentale/vs/common/model/enums/PartnerRolle;"
       9: areturn     

Another version (Ant) is this:

 public static de.continentale.vs.common.model.enums.PartnerRolle[] values();
    Code:
       0: getstatic     #115                // Field ENUM$VALUES:[Lde/continentale/vs/common/model/enums/PartnerRolle;
       3: dup           
       4: astore_0      
       5: iconst_0      
       6: aload_0       
       7: arraylength   
       8: dup           
       9: istore_1      
      10: anewarray     #1                  // class de/continentale/vs/common/model/enums/PartnerRolle
      13: dup           
      14: astore_2      
      15: iconst_0      
      16: iload_1       
      17: invokestatic  #147                // Method java/lang/System.arraycopy:(Ljava/lang/Object;ILjava/lang/Object;II)V
      20: aload_2       
      21: areturn

This is like all the listings I compile. Any idea what happened?

+4
source share
1 answer

Ant jdk 1.7.0_67, Eclipse, . Ant Eclipse, Ant . Eclipse -.

+2

Source: https://habr.com/ru/post/1663321/


All Articles