Please review this simple to change to give a more informative error message 
for `UnsupportedClassVersionError` when trying to run a recent classfile on an 
older VM. The wording used has already been finalized - see JBS.

Testing:

- added a `println` to `test/jdk/java/lang/System/Versions.java` to allow 
manual verification via the jtr file. Sample output:

java.lang.UnsupportedClassVersionError: ClassVersionTest requires a newer Java 
runtime. The runtime in use, Java 28, supports class file versions up to 72.0, 
but the class file version of ClassVersionTest is 73.0. 

- added a new test case to 
`test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java` to show preview 
classfiles are also handled as expected

Tier 1 sanity testing.

Thanks

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8385593: Clarify the wording of UnsupportedClassVersionError

Changes: https://git.openjdk.org/jdk/pull/32117/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32117&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8385593
  Stats: 22 lines in 3 files changed: 19 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/32117.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32117/head:pull/32117

PR: https://git.openjdk.org/jdk/pull/32117

Reply via email to