mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8237508: Simplify JarFile.isInitializing
Reviewed-by: dfuchs, coffeys, lancea
This commit is contained in:
parent
4aab3078a2
commit
fdbea219a1
3 changed files with 15 additions and 10 deletions
|
@ -146,11 +146,13 @@ import java.util.zip.ZipFile;
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public class JarFile extends ZipFile {
|
public class JarFile extends ZipFile {
|
||||||
private final static Runtime.Version BASE_VERSION;
|
private static final Runtime.Version BASE_VERSION;
|
||||||
private final static int BASE_VERSION_FEATURE;
|
private static final int BASE_VERSION_FEATURE;
|
||||||
private final static Runtime.Version RUNTIME_VERSION;
|
private static final Runtime.Version RUNTIME_VERSION;
|
||||||
private final static boolean MULTI_RELEASE_ENABLED;
|
private static final boolean MULTI_RELEASE_ENABLED;
|
||||||
private final static boolean MULTI_RELEASE_FORCED;
|
private static final boolean MULTI_RELEASE_FORCED;
|
||||||
|
private static final ThreadLocal<Boolean> isInitializing = new ThreadLocal<>();
|
||||||
|
|
||||||
private SoftReference<Manifest> manRef;
|
private SoftReference<Manifest> manRef;
|
||||||
private JarEntry manEntry;
|
private JarEntry manEntry;
|
||||||
private JarVerifier jv;
|
private JarVerifier jv;
|
||||||
|
@ -159,8 +161,6 @@ public class JarFile extends ZipFile {
|
||||||
private final Runtime.Version version; // current version
|
private final Runtime.Version version; // current version
|
||||||
private final int versionFeature; // version.feature()
|
private final int versionFeature; // version.feature()
|
||||||
private boolean isMultiRelease; // is jar multi-release?
|
private boolean isMultiRelease; // is jar multi-release?
|
||||||
static final ThreadLocal<Boolean> isInitializing =
|
|
||||||
ThreadLocal.withInitial(() -> Boolean.FALSE);
|
|
||||||
|
|
||||||
// indicates if Class-Path attribute present
|
// indicates if Class-Path attribute present
|
||||||
private boolean hasClassPathAttribute;
|
private boolean hasClassPathAttribute;
|
||||||
|
@ -1043,6 +1043,11 @@ public class JarFile extends ZipFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean isInitializing() {
|
||||||
|
Boolean value = isInitializing.get();
|
||||||
|
return (value == null) ? false : value;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a versioned {@code JarFileEntry} for the given entry,
|
* Returns a versioned {@code JarFileEntry} for the given entry,
|
||||||
* if there is one. Otherwise returns the original entry. This
|
* if there is one. Otherwise returns the original entry. This
|
||||||
|
|
|
@ -69,7 +69,7 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
|
||||||
jar.ensureInitialization();
|
jar.ensureInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isInitializing() {
|
public boolean isInitializing() {
|
||||||
return JarFile.isInitializing.get();
|
return JarFile.isInitializing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,5 +45,5 @@ public interface JavaUtilJarAccess {
|
||||||
public List<Object> getManifestDigests(JarFile jar);
|
public List<Object> getManifestDigests(JarFile jar);
|
||||||
public Attributes getTrustedAttributes(Manifest man, String name);
|
public Attributes getTrustedAttributes(Manifest man, String name);
|
||||||
public void ensureInitialization(JarFile jar);
|
public void ensureInitialization(JarFile jar);
|
||||||
public Boolean isInitializing();
|
public boolean isInitializing();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue