8308753: Class-File API transition to Preview

Reviewed-by: ihse, mchung, vromero
This commit is contained in:
Adam Sotona 2023-12-04 07:07:57 +00:00
parent b9df827adc
commit 2b00ac0d02
681 changed files with 7518 additions and 6502 deletions

View file

@ -25,18 +25,14 @@
* @test
* @bug 8272564
* @summary Correct resolution of toString() (and other similar calls) on interfaces
* @modules java.base/jdk.internal.classfile
* java.base/jdk.internal.classfile.attribute
* java.base/jdk.internal.classfile.constantpool
* java.base/jdk.internal.classfile.instruction
* java.base/jdk.internal.classfile.components
* @enablePreview
* @compile NoObjectToString.java
* @run main NoObjectToString
*/
import java.io.*;
import jdk.internal.classfile.*;
import jdk.internal.classfile.constantpool.*;
import java.lang.classfile.*;
import java.lang.classfile.constantpool.*;
public class NoObjectToString {
public static void main(String... args) throws Exception {
@ -48,7 +44,7 @@ public class NoObjectToString {
//Verify there are no references to Object.toString() in a Test:
try (InputStream in = NoObjectToString.class.getResourceAsStream("NoObjectToString$Test.class")) {
assert in != null;
ClassModel cm = Classfile.of().parse(in.readAllBytes());
ClassModel cm = ClassFile.of().parse(in.readAllBytes());
for (PoolEntry pe : cm.constantPool()) {
if (pe instanceof MethodRefEntry ref) {
String methodDesc = ref.owner().name() + "." + ref.nameAndType().name() + ":" + ref.nameAndType().type();