mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8261404: Class.getReflectionFactory() is not thread-safe
Reviewed-by: rriggs, mchung
This commit is contained in:
parent
022e4f0f1c
commit
905b763942
1 changed files with 6 additions and 5 deletions
|
@ -3820,12 +3820,13 @@ public final class Class<T> implements java.io.Serializable,
|
|||
// Fetches the factory for reflective objects
|
||||
@SuppressWarnings("removal")
|
||||
private static ReflectionFactory getReflectionFactory() {
|
||||
if (reflectionFactory == null) {
|
||||
reflectionFactory =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new ReflectionFactory.GetReflectionFactoryAction());
|
||||
var factory = reflectionFactory;
|
||||
if (factory != null) {
|
||||
return factory;
|
||||
}
|
||||
return reflectionFactory;
|
||||
return reflectionFactory =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new ReflectionFactory.GetReflectionFactoryAction());
|
||||
}
|
||||
private static ReflectionFactory reflectionFactory;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue