8334734: Remove specialized readXxxEntry methods from ClassReader

Reviewed-by: asotona
This commit is contained in:
Chen Liang 2024-07-03 02:43:41 +00:00
parent 3a2d426489
commit 8a664a4c35
9 changed files with 58 additions and 168 deletions

View file

@ -27,10 +27,6 @@ package java.lang.classfile;
import java.lang.classfile.constantpool.ClassEntry;
import java.lang.classfile.constantpool.ConstantPool;
import java.lang.classfile.constantpool.ConstantPoolException;
import java.lang.classfile.constantpool.MethodHandleEntry;
import java.lang.classfile.constantpool.ModuleEntry;
import java.lang.classfile.constantpool.NameAndTypeEntry;
import java.lang.classfile.constantpool.PackageEntry;
import java.lang.classfile.constantpool.PoolEntry;
import java.lang.classfile.constantpool.Utf8Entry;
import jdk.internal.classfile.impl.ClassReaderImpl;
@ -130,77 +126,6 @@ public sealed interface ClassReader extends ConstantPool
*/
<T extends PoolEntry> T readEntryOrNull(int offset, Class<T> cls);
/**
* {@return the UTF8 entry whose index is given at the specified
* offset within the classfile}
* @param offset the offset of the index within the classfile
* @throws ConstantPoolException if the index is out of range of the
* constant pool size, or zero, or the index does not correspond to
* a UTF8 entry
*/
Utf8Entry readUtf8Entry(int offset);
/**
* {@return the UTF8 entry whose index is given at the specified
* offset within the classfile, or null if the index at the specified
* offset is zero}
* @param offset the offset of the index within the classfile
* @throws ConstantPoolException if the index is out of range of the
* constant pool size, or the index does not correspond to
* a UTF8 entry
*/
Utf8Entry readUtf8EntryOrNull(int offset);
/**
* {@return the module entry whose index is given at the specified
* offset within the classfile}
* @param offset the offset of the index within the classfile
* @throws ConstantPoolException if the index is out of range of the
* constant pool size, or zero, or the index does not correspond to
* a module entry
*/
ModuleEntry readModuleEntry(int offset);
/**
* {@return the package entry whose index is given at the specified
* offset within the classfile}
* @param offset the offset of the index within the classfile
* @throws ConstantPoolException if the index is out of range of the
* constant pool size, or zero, or the index does not correspond to
* a package entry
*/
PackageEntry readPackageEntry(int offset);
/**
* {@return the class entry whose index is given at the specified
* offset within the classfile}
* @param offset the offset of the index within the classfile
* @throws ConstantPoolException if the index is out of range of the
* constant pool size, or zero, or the index does not correspond to
* a class entry
*/
ClassEntry readClassEntry(int offset);
/**
* {@return the name-and-type entry whose index is given at the specified
* offset within the classfile}
* @param offset the offset of the index within the classfile
* @throws ConstantPoolException if the index is out of range of the
* constant pool size, or zero, or the index does not correspond to
* a name-and-type entry
*/
NameAndTypeEntry readNameAndTypeEntry(int offset);
/**
* {@return the method handle entry whose index is given at the specified
* offset within the classfile}
* @param offset the offset of the index within the classfile
* @throws ConstantPoolException if the index is out of range of the
* constant pool size, or zero, or the index does not correspond to
* a method handle entry
*/
MethodHandleEntry readMethodHandleEntry(int offset);
/**
* {@return the unsigned byte at the specified offset within the classfile}
* @param offset the offset within the classfile