Use Runtime.version() instead of reflection

See gh-31444
This commit is contained in:
dreis2211
2022-06-17 15:22:43 +02:00
committed by Stephane Nicoll
parent 98eb21712f
commit b687e1c7ee
2 changed files with 2 additions and 27 deletions

View File

@@ -57,19 +57,7 @@ class JarFileEntries implements CentralDirectoryVisitor, Iterable<JarEntry> {
private static final int BASE_VERSION = 8;
private static final int RUNTIME_VERSION;
static {
int version;
try {
Object runtimeVersion = Runtime.class.getMethod("version").invoke(null);
version = (int) runtimeVersion.getClass().getMethod("major").invoke(runtimeVersion);
}
catch (Throwable ex) {
version = BASE_VERSION;
}
RUNTIME_VERSION = version;
}
private static final int RUNTIME_VERSION = Runtime.version().feature();
private static final long LOCAL_FILE_HEADER_SIZE = 30;
@@ -110,9 +98,6 @@ class JarFileEntries implements CentralDirectoryVisitor, Iterable<JarEntry> {
JarFileEntries(JarFile jarFile, JarEntryFilter filter) {
this.jarFile = jarFile;
this.filter = filter;
if (RUNTIME_VERSION == BASE_VERSION) {
this.multiReleaseJar = false;
}
}
@Override