mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8332597: Remove redundant methods from j.l.classfile.ClassReader API
Reviewed-by: liach, jlahoda
This commit is contained in:
parent
57bfd0e393
commit
579cf705ff
5 changed files with 6 additions and 23 deletions
|
@ -71,22 +71,9 @@ public sealed interface ClassReader extends ConstantPool
|
|||
/** {@return the constant pool entry describing the name of the superclass, if any} */
|
||||
Optional<ClassEntry> superclassEntry();
|
||||
|
||||
/** {@return the offset into the classfile of the {@code this_class} field} */
|
||||
int thisClassPos();
|
||||
|
||||
/** {@return the length of the classfile, in bytes} */
|
||||
int classfileLength();
|
||||
|
||||
// Buffer related
|
||||
|
||||
/**
|
||||
* {@return the offset following the block of attributes starting at the
|
||||
* specified position}
|
||||
* @param offset the offset into the classfile at which the attribute block
|
||||
* starts
|
||||
*/
|
||||
int skipAttributeHolder(int offset);
|
||||
|
||||
// Constant pool
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,12 +51,12 @@ public abstract sealed class BoundAttribute<T extends Attribute<T>>
|
|||
|
||||
static final int NAME_AND_LENGTH_PREFIX = 6;
|
||||
private final AttributeMapper<T> mapper;
|
||||
final ClassReader classReader;
|
||||
final ClassReaderImpl classReader;
|
||||
final int payloadStart;
|
||||
|
||||
BoundAttribute(ClassReader classReader, AttributeMapper<T> mapper, int payloadStart) {
|
||||
this.mapper = mapper;
|
||||
this.classReader = classReader;
|
||||
this.classReader = (ClassReaderImpl)classReader;
|
||||
this.payloadStart = payloadStart;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -34,7 +34,6 @@ import java.lang.classfile.Attribute;
|
|||
import java.lang.classfile.Attributes;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.ClassModel;
|
||||
import java.lang.classfile.ClassReader;
|
||||
import java.lang.classfile.ClassFile;
|
||||
import java.lang.classfile.ClassFileVersion;
|
||||
import java.lang.classfile.CustomAttribute;
|
||||
|
@ -60,7 +59,7 @@ public final class ClassImpl
|
|||
extends AbstractElement
|
||||
implements ClassModel {
|
||||
|
||||
final ClassReader reader;
|
||||
final ClassReaderImpl reader;
|
||||
private final int attributesPos;
|
||||
private final List<MethodModel> methods;
|
||||
private final List<FieldModel> fields;
|
||||
|
@ -69,7 +68,6 @@ public final class ClassImpl
|
|||
|
||||
public ClassImpl(byte[] cfbytes, ClassFileImpl context) {
|
||||
this.reader = new ClassReaderImpl(cfbytes, context);
|
||||
ClassReaderImpl reader = (ClassReaderImpl) this.reader;
|
||||
int p = reader.interfacesPos;
|
||||
int icnt = reader.readU2(p);
|
||||
p += 2 + icnt * 2;
|
||||
|
|
|
@ -164,7 +164,6 @@ public final class ClassReaderImpl
|
|||
return superclass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int thisClassPos() {
|
||||
return thisClassPos;
|
||||
}
|
||||
|
@ -397,7 +396,6 @@ public final class ClassReaderImpl
|
|||
throw new ConstantPoolException("Not a UTF8 - index: " + index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int skipAttributeHolder(int offset) {
|
||||
int p = offset;
|
||||
int cnt = readU2(p);
|
||||
|
|
|
@ -121,7 +121,7 @@ public final class CodeImpl
|
|||
if (!inflated) {
|
||||
if (labels == null)
|
||||
labels = new LabelImpl[codeLength + 1];
|
||||
if (((ClassReaderImpl)classReader).context().lineNumbersOption() == ClassFile.LineNumbersOption.PASS_LINE_NUMBERS)
|
||||
if (classReader.context().lineNumbersOption() == ClassFile.LineNumbersOption.PASS_LINE_NUMBERS)
|
||||
inflateLineNumbers();
|
||||
inflateJumpTargets();
|
||||
inflateTypeAnnotations();
|
||||
|
@ -170,7 +170,7 @@ public final class CodeImpl
|
|||
inflateMetadata();
|
||||
boolean doLineNumbers = (lineNumbers != null);
|
||||
generateCatchTargets(consumer);
|
||||
if (((ClassReaderImpl)classReader).context().debugElementsOption() == ClassFile.DebugElementsOption.PASS_DEBUG)
|
||||
if (classReader.context().debugElementsOption() == ClassFile.DebugElementsOption.PASS_DEBUG)
|
||||
generateDebugElements(consumer);
|
||||
for (int pos=codeStart; pos<codeEnd; ) {
|
||||
if (labels[pos - codeStart] != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue