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}
366 *
367 * @since 25
368 *
369 * @see <a
370 * href="https://docs.oracle.com/javase/specs/jvms/se25/html/index.html">
371 * <cite>The Java Virtual Machine Specification, Java SE 25 Edition</cite></a>
372 */
373 RELEASE_25(69),
374
375 /**
376 * The version introduced by the Java Platform, Standard Edition
377 * 26.
378 *
379 * @since 26
380 *
381 * @see <a
382 * href="https://docs.oracle.com/javase/specs/jvms/se26/html/index.html">
383 * <cite>The Java Virtual Machine Specification, Java SE 26 Edition</cite></a>
384 */
385 RELEASE_26(70),
386 ; // Reduce code churn when appending new constants
387
388 // Note to maintainers: when adding constants for newer releases,
389 // the implementation of latest() must be updated too.
390
391 private final int major;
392
393 private ClassFileFormatVersion(int major) {
394 this.major = major;
395 }
396
397 /**
398 * {@return the latest class file format version}
399 */
400 public static ClassFileFormatVersion latest() {
401 return RELEASE_26;
402 }
403
404 /**
405 * {@return the major class file version as an integer}
406 * @jvms 4.1 The {@code ClassFile} Structure
407 */
408 public int major() {
409 return major;
410 }
|
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}
368 *
369 * @since 25
370 *
371 * @see <a
372 * href="https://docs.oracle.com/javase/specs/jvms/se25/html/index.html">
373 * <cite>The Java Virtual Machine Specification, Java SE 25 Edition</cite></a>
374 */
375 RELEASE_25(69),
376
377 /**
378 * The version introduced by the Java Platform, Standard Edition
379 * 26.
380 *
381 * @since 26
382 *
383 * @see <a
384 * href="https://docs.oracle.com/javase/specs/jvms/se26/html/index.html">
385 * <cite>The Java Virtual Machine Specification, Java SE 26 Edition</cite></a>
386 */
387 RELEASE_26(70),
388
389 // Reduce code churn when appending new constants
390
391 // Note to maintainers: when adding constants for newer releases,
392 // the implementation of latest() must be updated too.
393
394 /// The preview features of Valhalla.
395 /// @since 25
396 CURRENT_PREVIEW_FEATURES(ClassFile.latestMajorVersion());
397
398 private final int major;
399
400 private ClassFileFormatVersion(int major) {
401 this.major = major;
402 }
403
404 /**
405 * {@return the latest class file format version}
406 */
407 public static ClassFileFormatVersion latest() {
408 return RELEASE_26;
409 }
410
411 /**
412 * {@return the major class file version as an integer}
413 * @jvms 4.1 The {@code ClassFile} Structure
414 */
415 public int major() {
416 return major;
417 }
|