8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.lang.reflect;
27
28 /**
29 * Class file format versions of the Java virtual machine.
30 *
31 * See the appropriate edition of <cite>The Java Virtual Machine
32 * Specification</cite> for information about a particular class file
33 * format version.
34 *
35 * <p>Note that additional class file format version constants will be
36 * added to model future releases of the Java Virtual Machine
37 * Specification.
38 *
39 * @apiNote
40 * The complete version used in a class file includes a major version
41 * and a minor version; this enum only models the major version. A
42 * Java virtual machine implementation is required to support a range
43 * of major versions; see the corresponding edition of the <cite>The
44 * Java Virtual Machine Specification</cite> for details.
45 *
46 * @since 20
47 * @see System#getProperties System property {@code java.class.version}
378 *
379 * @since 26
380 *
381 * @see <a
382 * href="https://docs.oracle.com/en/java/javase/26/docs/specs/jvms/index.html">
383 * <cite>The Java Virtual Machine Specification, Java SE 26 Edition</cite></a>
384 */
385 RELEASE_26(70),
386
387 /**
388 * The version introduced by the Java Platform, Standard Edition
389 * 27.
390 *
391 * @since 27
392 *
393 * @see <a
394 * href="https://docs.oracle.com/en/java/javase/27/docs/specs/jvms/index.html">
395 * <cite>The Java Virtual Machine Specification, Java SE 27 Edition</cite></a>
396 */
397 RELEASE_27(71),
398 ; // Reduce code churn when appending new constants
399
400 // Note to maintainers: when adding constants for newer releases,
401 // the implementation of latest() must be updated too.
402
403 private final int major;
404
405 private ClassFileFormatVersion(int major) {
406 this.major = major;
407 }
408
409 /**
410 * {@return the latest class file format version}
411 */
412 public static ClassFileFormatVersion latest() {
413 return RELEASE_27;
414 }
415
416 /**
417 * {@return the major class file version as an integer}
418 * @jvms 4.1 The {@code ClassFile} Structure
419 */
420 public int major() {
421 return major;
422 }
|
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.lang.reflect;
27
28 import java.lang.classfile.ClassFile;
29
30 /**
31 * Class file format versions of the Java virtual machine.
32 *
33 * See the appropriate edition of <cite>The Java Virtual Machine
34 * Specification</cite> for information about a particular class file
35 * format version.
36 *
37 * <p>Note that additional class file format version constants will be
38 * added to model future releases of the Java Virtual Machine
39 * Specification.
40 *
41 * @apiNote
42 * The complete version used in a class file includes a major version
43 * and a minor version; this enum only models the major version. A
44 * Java virtual machine implementation is required to support a range
45 * of major versions; see the corresponding edition of the <cite>The
46 * Java Virtual Machine Specification</cite> for details.
47 *
48 * @since 20
49 * @see System#getProperties System property {@code java.class.version}
380 *
381 * @since 26
382 *
383 * @see <a
384 * href="https://docs.oracle.com/en/java/javase/26/docs/specs/jvms/index.html">
385 * <cite>The Java Virtual Machine Specification, Java SE 26 Edition</cite></a>
386 */
387 RELEASE_26(70),
388
389 /**
390 * The version introduced by the Java Platform, Standard Edition
391 * 27.
392 *
393 * @since 27
394 *
395 * @see <a
396 * href="https://docs.oracle.com/en/java/javase/27/docs/specs/jvms/index.html">
397 * <cite>The Java Virtual Machine Specification, Java SE 27 Edition</cite></a>
398 */
399 RELEASE_27(71),
400
401 // Reduce code churn when appending new constants
402 // Note to maintainers: when adding constants for newer releases,
403 // the implementation of latest() must be updated too.
404
405 /// The preview features of Valhalla.
406 /// @since 26
407 CURRENT_PREVIEW_FEATURES(ClassFile.latestMajorVersion());
408
409 private final int major;
410
411 private ClassFileFormatVersion(int major) {
412 this.major = major;
413 }
414
415 /**
416 * {@return the latest class file format version}
417 */
418 public static ClassFileFormatVersion latest() {
419 return RELEASE_27;
420 }
421
422 /**
423 * {@return the major class file version as an integer}
424 * @jvms 4.1 The {@code ClassFile} Structure
425 */
426 public int major() {
427 return major;
428 }
|