Unnecessary Signature attribute generated for enum constructors

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8, 9
    • Component/s: tools
    • None

      Consider:
      ---
      enum E { A; }
      ---

      This compiled&decompiled leads to:
      ---
        private E();
          descriptor: (Ljava/lang/String;I)V
          flags: ACC_PRIVATE
          Code:
            stack=3, locals=3, args_size=3
               0: aload_0
               1: aload_1
               2: iload_2
               3: invokespecial #6 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
               6: return
            LineNumberTable:
              line 1: 0
          Signature: #24 // ()V
      ---

      The Signature attribute is not mandatory in this case (as the constructor's parameters are not generic). Avoiding the attribute may provide smaller, cleaner classfiles, and so should be considered.

            Assignee:
            Jan Lahoda
            Reporter:
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: