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.
---
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.
- relates to
-
JDK-8024694 javac always expects signature attribute for enum constructors
- Closed