8331291: java.lang.classfile.Attributes class performs a lot of static initializations

Reviewed-by: liach, redestad, vromero
This commit is contained in:
Adam Sotona 2024-05-24 15:58:34 +00:00
parent 0c934ff4e2
commit cfdc64fcb4
149 changed files with 1669 additions and 1323 deletions

View file

@ -743,8 +743,8 @@ public class SourceLauncherTest extends TestRunner {
private static void markModuleAsIncubator(Path moduleInfoFile) throws Exception {
ClassModel cf = ClassFile.of().parse(moduleInfoFile);
ModuleResolutionAttribute newAttr = ModuleResolutionAttribute.of(WARN_INCUBATING);
byte[] newBytes = ClassFile.of().transform(cf, ClassTransform.dropping(ce -> ce instanceof Attributes)
.andThen(ClassTransform.endHandler(classBuilder -> classBuilder.with(newAttr))));
byte[] newBytes = ClassFile.of().transform(cf,
ClassTransform.endHandler(classBuilder -> classBuilder.with(newAttr)));
try (OutputStream out = Files.newOutputStream(moduleInfoFile)) {
out.write(newBytes);
}