Skip to content
Permalink
Browse files
8263995: Incorrect double-checked locking in Types.arraySuperType()
Reviewed-by: mcimadamore, jlahoda
  • Loading branch information
shipilev committed Mar 23, 2021
1 parent d7268fa commit c087f3ed40feac9e7978edee0da4722a3de18130
Showing 1 changed file with 4 additions and 8 deletions.
@@ -4076,17 +4076,13 @@ List<Type> erasedSupertypes(Type t) {
return buf.toList();
}

private Type arraySuperType = null;
private Type arraySuperType;
private Type arraySuperType() {
// initialized lazily to avoid problems during compiler startup
if (arraySuperType == null) {
synchronized (this) {
if (arraySuperType == null) {
// JLS 10.8: all arrays implement Cloneable and Serializable.
arraySuperType = makeIntersectionType(List.of(syms.serializableType,
syms.cloneableType), true);
}
}
// JLS 10.8: all arrays implement Cloneable and Serializable.
arraySuperType = makeIntersectionType(List.of(syms.serializableType,
syms.cloneableType), true);
}
return arraySuperType;
}

0 comments on commit c087f3e

Please sign in to comment.