Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8072024

Different classfiles depending on source order with fields of inner enum type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7u76, 8u25
    • tools
    • None

      If fields in source A have an enum type where that enum is an inner class of another source B, the class file of A is different depending if the source compile order is A.java B.java, or B.java A.java.

      Either:
            static #6= #5 of #18; //MyEnum=class HasEnum$MyEnum of class HasEnum
      or
             static abstract #6= #5 of #18; //MyEnum=class HasEnum$MyEnum of class HasEnum

      Steps to reproduce:
      javac UseEnum.java HasEnum.java
      javap -v -cp . UseEnum

      javac HasEnum.java UseEnum.java
      javap -v -cp . UseEnum

      Compare the two outputs.

        1. HasEnum.java
          0.2 kB
          Keimpe Bronkhorst
        2. UseEnum.java
          0.0 kB
          Keimpe Bronkhorst

            Unassigned Unassigned
            kbronkho Keimpe Bronkhorst (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: