From 77a723b81ccff0d73bb1f7909582d502c64fdf5e Mon Sep 17 00:00:00 2001 From: liach Date: Thu, 12 Dec 2024 16:19:14 -0600 Subject: [PATCH 1/3] CFFV evolution comments --- .../lang/reflect/ClassFileFormatVersion.java | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java index b2fa39e166170..e03b8e51e465d 100644 --- a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java +++ b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,6 +49,41 @@ */ @SuppressWarnings("doclint:reference") // cross-module links public enum ClassFileFormatVersion { + /* + * Summary of class file format evolution; previews are listed for + * convenience, but they are not modeled by this enum + * 1: InnerClasses; Synthetic; Deprecated + * 2: ACC_STRICT + * 3: no changes + * 4: no changes + * 5: annotations (Runtime(Inv/V)isible(Parameter)Annotations); + * generics (Signature, LocalVariableTypeTable); EnclosingMethod + * 6: verification by type checking (StackMapTable) + * 7: verification by type checking enforced (jsr and ret obsolete); + * JSR 292 support (java.lang.invoke) (CONSTANT_MethodHandle, + * CONSTANT_MethodType, CONSTANT_InvokeDynamic, BoostrapMethods); + * must be ACC_STATIC + * 8: private, static, and non-abstract (default) methods in interfaces; + * type annotations (Runtime(Inv/V)isibleTypeAnnotations); + * MethodParameters + * 9: modules (Module, ModuleMainClass, ModulePackages, CONSTANT_Module, + * CONSTANT_Package, ACC_MODULE) + * 10: minor tweak to requires_flags in Module attribute + * 11: nestmate (NestHost, NestMembers); CONSTANT_Dynamic + * 12: preview features (minor version must be 0 or 65535) + * 13: no changes + * 14: no changes; (record in preview) + * 15: no changes; (record in 2nd preview, sealed classes in preview) + * 16: record (Record); (sealed classes in 2nd preview) + * 17: sealed classes (PermittedSubclasses); ACC_STRICT obsolete + * 18: no changes + * 19: no changes + * 20: no changes + * 21: no changes + * 22: no changes + * 23: no changes + * 24: no changes + */ /** * The original version. From 133962978dc002459715863e7034d5af461c5d16 Mon Sep 17 00:00:00 2001 From: liach Date: Mon, 6 Jan 2025 15:17:20 -0600 Subject: [PATCH 2/3] Add JEP/JSR numbers, clarify if something is attribute/modifier/etc. --- .../lang/reflect/ClassFileFormatVersion.java | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java index e03b8e51e465d..cb47d72d3d4f3 100644 --- a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java +++ b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java @@ -51,31 +51,37 @@ public enum ClassFileFormatVersion { /* * Summary of class file format evolution; previews are listed for - * convenience, but they are not modeled by this enum - * 1: InnerClasses; Synthetic; Deprecated - * 2: ACC_STRICT + * convenience, but they are not modeled by this enum. + * 1: InnerClasses, Synthetic, Deprecated attributes + * 2: ACC_STRICT modifier * 3: no changes * 4: no changes - * 5: annotations (Runtime(Inv/V)isible(Parameter)Annotations); - * generics (Signature, LocalVariableTypeTable); EnclosingMethod - * 6: verification by type checking (StackMapTable) - * 7: verification by type checking enforced (jsr and ret obsolete); - * JSR 292 support (java.lang.invoke) (CONSTANT_MethodHandle, - * CONSTANT_MethodType, CONSTANT_InvokeDynamic, BoostrapMethods); - * must be ACC_STATIC + * 5: Annotations (Runtime(Inv/V)isible(Parameter)Annotations attributes); + * Generics (Signature, LocalVariableTypeTable attributes); + * EnclosingMethod attribute + * 6: Verification by type checking (StackMapTable attribute) + * 7: Verification by type checking enforced (jsr and ret opcodes + * obsolete); java.lang.invoke support (JSR 292) (CONSTANT_MethodHandle, + * CONSTANT_MethodType, CONSTANT_InvokeDynamic constant pool entries, + * BoostrapMethods attribute); method must be ACC_STATIC * 8: private, static, and non-abstract (default) methods in interfaces; - * type annotations (Runtime(Inv/V)isibleTypeAnnotations); - * MethodParameters - * 9: modules (Module, ModuleMainClass, ModulePackages, CONSTANT_Module, - * CONSTANT_Package, ACC_MODULE) + * Type Annotations (JEP 104) (Runtime(Inv/V)isibleTypeAnnotations + * attribute); MethodParameters attribute + * 9: JSR 376 - modules (JSR 376, JEP 261) (Module, ModuleMainClass, + * ModulePackages attributes, CONSTANT_Module, CONSTANT_Package constant + * pool entries, ACC_MODULE modifier) * 10: minor tweak to requires_flags in Module attribute - * 11: nestmate (NestHost, NestMembers); CONSTANT_Dynamic - * 12: preview features (minor version must be 0 or 65535) + * 11: Nest mates (JEP 181) (NestHost, NestMembers attributes); + * CONSTANT_Dynamic (JEP 309) constant pool entry + * 12: Preview Features (JEP 12) (minor version must be 0 or 65535) * 13: no changes - * 14: no changes; (record in preview) - * 15: no changes; (record in 2nd preview, sealed classes in preview) - * 16: record (Record); (sealed classes in 2nd preview) - * 17: sealed classes (PermittedSubclasses); ACC_STRICT obsolete + * 14: no changes; (JEP 359 Records in Preview) + * 15: no changes; (JEP 384 Records in 2nd Preview, JEP 360 Sealed Classes + * in Preview) + * 16: Records (JEP 395) (Record attribute); (JEP 397 Sealed Classes in 2nd + * Preview) + * 17: Sealed Classes (JEP 409) (PermittedSubclasses attribute); ACC_STRICT + * modifier obsolete (JEP 306) * 18: no changes * 19: no changes * 20: no changes From f34c91c29369cae356871fa47171615283e4dbe1 Mon Sep 17 00:00:00 2001 From: liach Date: Tue, 7 Jan 2025 23:46:46 -0600 Subject: [PATCH 3/3] Use since-style versions --- .../lang/reflect/ClassFileFormatVersion.java | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java index cb47d72d3d4f3..70eb921a12454 100644 --- a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java +++ b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java @@ -52,43 +52,43 @@ public enum ClassFileFormatVersion { /* * Summary of class file format evolution; previews are listed for * convenience, but they are not modeled by this enum. - * 1: InnerClasses, Synthetic, Deprecated attributes - * 2: ACC_STRICT modifier - * 3: no changes - * 4: no changes - * 5: Annotations (Runtime(Inv/V)isible(Parameter)Annotations attributes); - * Generics (Signature, LocalVariableTypeTable attributes); - * EnclosingMethod attribute - * 6: Verification by type checking (StackMapTable attribute) - * 7: Verification by type checking enforced (jsr and ret opcodes - * obsolete); java.lang.invoke support (JSR 292) (CONSTANT_MethodHandle, - * CONSTANT_MethodType, CONSTANT_InvokeDynamic constant pool entries, - * BoostrapMethods attribute); method must be ACC_STATIC - * 8: private, static, and non-abstract (default) methods in interfaces; - * Type Annotations (JEP 104) (Runtime(Inv/V)isibleTypeAnnotations - * attribute); MethodParameters attribute - * 9: JSR 376 - modules (JSR 376, JEP 261) (Module, ModuleMainClass, - * ModulePackages attributes, CONSTANT_Module, CONSTANT_Package constant - * pool entries, ACC_MODULE modifier) - * 10: minor tweak to requires_flags in Module attribute - * 11: Nest mates (JEP 181) (NestHost, NestMembers attributes); - * CONSTANT_Dynamic (JEP 309) constant pool entry - * 12: Preview Features (JEP 12) (minor version must be 0 or 65535) - * 13: no changes - * 14: no changes; (JEP 359 Records in Preview) - * 15: no changes; (JEP 384 Records in 2nd Preview, JEP 360 Sealed Classes - * in Preview) - * 16: Records (JEP 395) (Record attribute); (JEP 397 Sealed Classes in 2nd - * Preview) - * 17: Sealed Classes (JEP 409) (PermittedSubclasses attribute); ACC_STRICT - * modifier obsolete (JEP 306) - * 18: no changes - * 19: no changes - * 20: no changes - * 21: no changes - * 22: no changes - * 23: no changes - * 24: no changes + * 1.1: InnerClasses, Synthetic, Deprecated attributes + * 1.2: ACC_STRICT modifier + * 1.3: no changes + * 1.4: no changes + * 1.5: Annotations (Runtime(Inv/V)isible(Parameter)Annotations attributes); + * Generics (Signature, LocalVariableTypeTable attributes); + * EnclosingMethod attribute + * 1.6: Verification by type checking (StackMapTable attribute) + * 1.7: Verification by type checking enforced (jsr and ret opcodes + * obsolete); java.lang.invoke support (JSR 292) (CONSTANT_MethodHandle, + * CONSTANT_MethodType, CONSTANT_InvokeDynamic constant pool entries, + * BoostrapMethods attribute); method must be ACC_STATIC + * 1.8: private, static, and non-abstract (default) methods in interfaces; + * Type Annotations (JEP 104) (Runtime(Inv/V)isibleTypeAnnotations + * attribute); MethodParameters attribute + * 9: JSR 376 - modules (JSR 376, JEP 261) (Module, ModuleMainClass, + * ModulePackages attributes, CONSTANT_Module, CONSTANT_Package + * constant pool entries, ACC_MODULE modifier) + * 10: minor tweak to requires_flags in Module attribute + * 11: Nest mates (JEP 181) (NestHost, NestMembers attributes); + * CONSTANT_Dynamic (JEP 309) constant pool entry + * 12: Preview Features (JEP 12) (minor version must be 0 or 65535) + * 13: no changes + * 14: no changes; (JEP 359 Records in Preview) + * 15: no changes; (JEP 384 Records in 2nd Preview, JEP 360 Sealed Classes + * in Preview) + * 16: Records (JEP 395) (Record attribute); (JEP 397 Sealed Classes in 2nd + * Preview) + * 17: Sealed Classes (JEP 409) (PermittedSubclasses attribute); ACC_STRICT + * modifier obsolete (JEP 306) + * 18: no changes + * 19: no changes + * 20: no changes + * 21: no changes + * 22: no changes + * 23: no changes + * 24: no changes */ /**