-
Enhancement
-
Resolution: Fixed
-
P3
-
None
-
b26
The proposed enhancement is for javac to omit the reference to the enclosing instance when translating inner classes that don't capture any enclosing instance state.
That is, given
class T {
class I {
}
}
before:
{
final T this$0;
descriptor: LT;
flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
T$I(T);
descriptor: (LT;)V
flags: (0x0000)
Code:
stack=2, locals=2, args_size=2
0: aload_0
1: aload_1
2: putfield #1 // Field this$0:LT;
5: aload_0
6: invokespecial #2 // Method java/lang/Object."<init>":()V
9: return
LineNumberTable:
line 2: 0
}
after:
{
T$I(T);
descriptor: (LT;)V
flags: (0x0000)
Code:
stack=1, locals=2, args_size=2
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 2: 0
}
Related discussion:
* https://bugs.openjdk.java.net/browse/JDK-6324535?focusedCommentId=12265883&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-12265883
* https://mail.openjdk.java.net/pipermail/amber-spec-experts/2021-July/003061.html
* https://mail.openjdk.java.net/pipermail/amber-spec-experts/2021-July/003062.html
* https://mail.openjdk.java.net/pipermail/amber-spec-experts/2021-August/003065.html
* https://mail.openjdk.java.net/pipermail/amber-spec-experts/2021-August/003066.html
- csr for
-
JDK-8271717 Omit enclosing instance fields from inner classes that don't use it
- Closed
- relates to
-
JDK-8277718 [BACKOUT] JDK-8271623 Omit enclosing instance fields from inner classes that don't use it
- Closed
-
JDK-8277965 Enclosing instance optimization affects serialization
- Closed
-
JDK-8278178 Omit enclosing instance fields from serializable inner classes that don't use it
- Open
-
JDK-8277803 vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001 fails with "Synthetic fields not found"
- Resolved
-
JDK-6324535 Allow static anonymous classes
- Open