mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8331291: java.lang.classfile.Attributes class performs a lot of static initializations
Reviewed-by: liach, redestad, vromero
This commit is contained in:
parent
0c934ff4e2
commit
cfdc64fcb4
149 changed files with 1669 additions and 1323 deletions
|
@ -47,14 +47,14 @@ public class SyntheticClasses {
|
|||
for (File classFile : Objects.requireNonNull(testClasses.listFiles(f -> f.getName().endsWith(".class")))) {
|
||||
ClassModel cf = ClassFile.of().parse(classFile.toPath());
|
||||
if (cf.thisClass().asInternalName().matches(".*\\$[0-9]+")) {
|
||||
EnclosingMethodAttribute encl = cf.findAttribute(Attributes.ENCLOSING_METHOD).orElse(null);
|
||||
EnclosingMethodAttribute encl = cf.findAttribute(Attributes.enclosingMethod()).orElse(null);
|
||||
if (encl != null) {
|
||||
if (encl.enclosingMethodName().isPresent())
|
||||
throw new IllegalStateException("Invalid EnclosingMethod.method: " +
|
||||
encl.enclosingMethodName().get().stringValue() + ".");
|
||||
}
|
||||
}
|
||||
InnerClassesAttribute attr = cf.findAttribute(Attributes.INNER_CLASSES).orElse(null);
|
||||
InnerClassesAttribute attr = cf.findAttribute(Attributes.innerClasses()).orElse(null);
|
||||
if (attr != null) {
|
||||
for (InnerClassInfo info : attr.classes()) {
|
||||
if (cf.majorVersion() < 51)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue