mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8311020: Typo cleanup in Classfile API
Reviewed-by: asotona
This commit is contained in:
parent
f4b900b607
commit
cbf418a486
30 changed files with 53 additions and 53 deletions
|
@ -30,9 +30,8 @@ import java.lang.reflect.AccessFlag;
|
|||
|
||||
/**
|
||||
* Models the access flags for a class, method, or field. Delivered as a
|
||||
* {@link jdk.internal.classfile.ClassElement}, {@link jdk.internal.classfile.FieldElement}, or
|
||||
* {@link jdk.internal.classfile.MethodElement} when traversing
|
||||
* the corresponding model type.
|
||||
* {@link ClassElement}, {@link FieldElement}, or {@link MethodElement}
|
||||
* when traversing the corresponding model type.
|
||||
*/
|
||||
public sealed interface AccessFlags
|
||||
extends ClassElement, MethodElement, FieldElement
|
||||
|
|
|
@ -653,7 +653,7 @@ public class Attributes {
|
|||
}
|
||||
};
|
||||
|
||||
/** Attribute mapper for the {@code SourceDebug} attribute */
|
||||
/** Attribute mapper for the {@code SourceDebugExtension} attribute */
|
||||
public static final AttributeMapper<SourceDebugExtensionAttribute>
|
||||
SOURCE_DEBUG_EXTENSION = new AbstractAttributeMapper<>(NAME_SOURCE_DEBUG_EXTENSION, Classfile.JAVA_5_VERSION) {
|
||||
@Override
|
||||
|
|
|
@ -59,6 +59,7 @@ public interface ClassHierarchyResolver {
|
|||
* {@return the {@link ClassHierarchyInfo} for a given class name, or null
|
||||
* if the name is unknown to the resolver}
|
||||
* @param classDesc descriptor of the class
|
||||
* @throws IllegalArgumentException if a class shouldn't be queried for hierarchy
|
||||
*/
|
||||
ClassHierarchyInfo getClassInfo(ClassDesc classDesc);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public sealed interface ClassModel
|
|||
*
|
||||
* @param debugOutput handler to receive debug information
|
||||
* @param classHierarchyResolver class hierarchy resolver to provide
|
||||
* additional information about the class hiearchy
|
||||
* additional information about the class hierarchy
|
||||
* @return a list of verification errors, or an empty list if no errors are
|
||||
* found
|
||||
*/
|
||||
|
|
|
@ -40,9 +40,8 @@ import jdk.internal.classfile.constantpool.ConstantPoolBuilder;
|
|||
*
|
||||
* @see ClassfileTransform
|
||||
*/
|
||||
public
|
||||
interface ClassfileBuilder<E extends ClassfileElement, B extends ClassfileBuilder<E, B>>
|
||||
extends Consumer<E> {
|
||||
public sealed interface ClassfileBuilder<E extends ClassfileElement, B extends ClassfileBuilder<E, B>>
|
||||
extends Consumer<E> permits ClassBuilder, FieldBuilder, MethodBuilder, CodeBuilder {
|
||||
|
||||
/**
|
||||
* Integrate the {@link ClassfileElement} into the entity being built.
|
||||
|
|
|
@ -28,7 +28,7 @@ import jdk.internal.classfile.impl.LabelImpl;
|
|||
|
||||
/**
|
||||
* A marker for a position within the instructions of a method body. The
|
||||
* assocation between a label's identity and the position it represents is
|
||||
* association between a label's identity and the position it represents is
|
||||
* managed by the entity managing the method body (a {@link CodeModel} or {@link
|
||||
* CodeBuilder}), not the label itself; this allows the same label to have a
|
||||
* meaning both in an existing method (as managed by a {@linkplain CodeModel})
|
||||
|
|
|
@ -82,7 +82,7 @@ public sealed interface MethodSignature
|
|||
/**
|
||||
* @return method signature
|
||||
* @param typeParameters signatures for the type parameters
|
||||
* @param exceptions sigantures for the exceptions
|
||||
* @param exceptions signatures for the exceptions
|
||||
* @param result signature for the return type
|
||||
* @param arguments signatures for the method arguments
|
||||
*/
|
||||
|
|
|
@ -454,7 +454,7 @@ public sealed interface TypeAnnotation
|
|||
permits TargetInfoImpl.LocalVarTargetImpl {
|
||||
|
||||
/**
|
||||
* @return the table of local variable location/indicies.
|
||||
* @return the table of local variable location/indices.
|
||||
*/
|
||||
List<LocalVarTargetInfo> table();
|
||||
}
|
||||
|
|
|
@ -54,8 +54,7 @@ public sealed interface InnerClassInfo
|
|||
Optional<ClassEntry> outerClass();
|
||||
|
||||
/**
|
||||
* {@return the name of the class or interface of which this class is a
|
||||
* member, if it is a member of a class or interface}
|
||||
* {@return the simple name of this class, or empty if this class is anonymous}
|
||||
*/
|
||||
Optional<Utf8Entry> innerName();
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public sealed interface MethodParametersAttribute
|
|||
|
||||
/**
|
||||
* {@return information about the parameters of the method} The i'th entry
|
||||
* in the list correponds to the i'th parameter in the method declaration.
|
||||
* in the list corresponds to the i'th parameter in the method declaration.
|
||||
*/
|
||||
List<MethodParameterInfo> parameters();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
|||
import jdk.internal.classfile.impl.Util;
|
||||
|
||||
/**
|
||||
* Models a single "exports" declaration in the {@link jdk.internal.classfile.attribute.ModuleAttribute}.
|
||||
* Models a single "exports" declaration in the {@link ModuleAttribute}.
|
||||
*/
|
||||
public sealed interface ModuleExportInfo
|
||||
permits UnboundAttribute.UnboundModuleExportInfo {
|
||||
|
|
|
@ -30,7 +30,7 @@ import jdk.internal.classfile.impl.TemporaryConstantPool;
|
|||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
/**
|
||||
* Models hash information for a single module in the {@link jdk.internal.classfile.attribute.ModuleHashesAttribute}.
|
||||
* Models hash information for a single module in the {@link ModuleHashesAttribute}.
|
||||
*/
|
||||
public sealed interface ModuleHashInfo
|
||||
permits UnboundAttribute.UnboundModuleHashInfo {
|
||||
|
|
|
@ -39,7 +39,7 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
|||
import jdk.internal.classfile.impl.Util;
|
||||
|
||||
/**
|
||||
* Models a single "opens" declaration in the {@link jdk.internal.classfile.attribute.ModuleAttribute}.
|
||||
* Models a single "opens" declaration in the {@link ModuleAttribute}.
|
||||
*/
|
||||
public sealed interface ModuleOpenInfo
|
||||
permits UnboundAttribute.UnboundModuleOpenInfo {
|
||||
|
|
|
@ -34,7 +34,7 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
|||
import jdk.internal.classfile.impl.Util;
|
||||
|
||||
/**
|
||||
* Models a single "provides" declaration in the {@link jdk.internal.classfile.attribute.ModuleAttribute}.
|
||||
* Models a single "provides" declaration in the {@link ModuleAttribute}.
|
||||
*/
|
||||
public sealed interface ModuleProvideInfo
|
||||
permits UnboundAttribute.UnboundModuleProvideInfo {
|
||||
|
|
|
@ -37,7 +37,7 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
|||
import jdk.internal.classfile.impl.Util;
|
||||
|
||||
/**
|
||||
* Models a single "requires" declaration in the {@link jdk.internal.classfile.attribute.ModuleAttribute}.
|
||||
* Models a single "requires" declaration in the {@link ModuleAttribute}.
|
||||
*/
|
||||
public sealed interface ModuleRequireInfo
|
||||
permits UnboundAttribute.UnboundModuleRequiresInfo {
|
||||
|
|
|
@ -77,7 +77,7 @@ public sealed interface ModuleResolutionAttribute
|
|||
|
||||
/**
|
||||
* {@return a {@code ModuleResolution} attribute}
|
||||
* @param resolutionFlags the resolution falgs
|
||||
* @param resolutionFlags the resolution flags
|
||||
*/
|
||||
static ModuleResolutionAttribute of(int resolutionFlags) {
|
||||
return new UnboundAttribute.UnboundModuleResolutionAttribute(resolutionFlags);
|
||||
|
|
|
@ -55,7 +55,7 @@ public sealed interface SignatureAttribute
|
|||
Utf8Entry signature();
|
||||
|
||||
/**
|
||||
* Parse the siganture as a class signature.
|
||||
* Parse the signature as a class signature.
|
||||
* @return the class signature
|
||||
*/
|
||||
default ClassSignature asClassSignature() {
|
||||
|
@ -71,7 +71,7 @@ public sealed interface SignatureAttribute
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse the siganture as a type signature.
|
||||
* Parse the signature as a type signature.
|
||||
* @return the type signature
|
||||
*/
|
||||
default Signature asTypeSignature() {
|
||||
|
|
|
@ -31,7 +31,9 @@ import jdk.internal.classfile.impl.BoundAttribute;
|
|||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
/**
|
||||
* SourceDebugExtensionAttribute.
|
||||
* Models the {@code SourceDebugExtension} attribute (@@@ need reference).
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when traversing the elements of
|
||||
* a {@link jdk.internal.classfile.ClassModel}.
|
||||
*/
|
||||
public sealed interface SourceDebugExtensionAttribute
|
||||
extends Attribute<SourceDebugExtensionAttribute>, ClassElement
|
||||
|
|
|
@ -34,7 +34,7 @@ import jdk.internal.classfile.impl.TemporaryConstantPool;
|
|||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
/**
|
||||
* Models the {@code SourceFile} attribute (@@@ reference needed), which can
|
||||
* Models the {@code SourceID} attribute (@@@ reference needed), which can
|
||||
* appear on classes. Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing a {@link ClassModel}.
|
||||
*/
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
* Arrays of reference types are always decomposed, mapped as the base reference
|
||||
* types and composed back to arrays.
|
||||
* <p>
|
||||
* Single class remappigng example:
|
||||
* Single class remapping example:
|
||||
* {@snippet lang="java" class="PackageSnippets" region="singleClassRemap"}
|
||||
* <p>
|
||||
* Remapping of all classes under specific package:
|
||||
|
@ -90,7 +90,7 @@
|
|||
*
|
||||
* <h3>{@link CodeRelabeler}</h3>
|
||||
* {@link CodeRelabeler} is a {@link jdk.internal.classfile.CodeTransform}
|
||||
* replacing all occurences of {@link jdk.internal.classfile.Label} in the
|
||||
* replacing all occurrences of {@link jdk.internal.classfile.Label} in the
|
||||
* transformed code with new instances.
|
||||
* All {@link jdk.internal.classfile.instruction.LabelTarget} instructions are
|
||||
* adjusted accordingly.
|
||||
|
|
|
@ -103,14 +103,14 @@ public final class ClassHierarchyImpl {
|
|||
}
|
||||
|
||||
public boolean isAssignableFrom(ClassDesc thisClass, ClassDesc fromClass) {
|
||||
//extra check if fromClass is an interface is necessay to handle situation when thisClass might not been fully resolved and so it is potentially an unidentified interface
|
||||
//this special corner-case handling has been added based on better success rate of constructing stack maps with simulated broken resulution of classes and interfaces
|
||||
//extra check if fromClass is an interface is necessary to handle situation when thisClass might not been fully resolved and so it is potentially an unidentified interface
|
||||
//this special corner-case handling has been added based on better success rate of constructing stack maps with simulated broken resolution of classes and interfaces
|
||||
if (isInterface(fromClass)) return resolve(thisClass).superClass() == null;
|
||||
//regular calculation of assignability is based on common ancestor calculation
|
||||
var anc = commonAncestor(thisClass, fromClass);
|
||||
//if common ancestor does not exist (as the class hierarchy could not be fully resolved) we optimistically assume the classes might be accessible
|
||||
//if common ancestor is equal to thisClass then the classes are clearly accessible
|
||||
//if other common ancestor is calculated (which works even when their grand-parents could not be resolved) then it is clear that thisClass could not be asigned from fromClass
|
||||
//if other common ancestor is calculated (which works even when their grandparents could not be resolved) then it is clear that thisClass could not be assigned from fromClass
|
||||
return anc == null || thisClass.equals(anc);
|
||||
}
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ public final class ClassPrinterImpl {
|
|||
case OfBoolean cv -> leafs("boolean", String.valueOf((int)cv.constantValue() != 0));
|
||||
case OfClass clv -> leafs("class", clv.className().stringValue());
|
||||
case OfEnum ev -> leafs("enum class", ev.className().stringValue(),
|
||||
"contant name", ev.constantName().stringValue());
|
||||
"constant name", ev.constantName().stringValue());
|
||||
case OfAnnotation av -> leafs("annotation class", av.annotation().className().stringValue());
|
||||
case OfArray av -> new Node[]{new ListNodeImpl(FLOW, "array", av.values().stream().map(
|
||||
ev -> new MapNodeImpl(FLOW, "value").with(elementValueToTree(ev))))};
|
||||
|
@ -535,7 +535,7 @@ public final class ClassPrinterImpl {
|
|||
case ObjectVerificationTypeInfo o ->
|
||||
ret.accept(o.className().name().stringValue());
|
||||
case UninitializedVerificationTypeInfo u ->
|
||||
ret.accept("UNITIALIZED @" + lr.labelToBci(u.newTarget()));
|
||||
ret.accept("UNINITIALIZED @" + lr.labelToBci(u.newTarget()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ public final class ClassPrinterImpl {
|
|||
"method type", ema.enclosingMethodType()
|
||||
.map(Utf8Entry::stringValue).orElse("null")));
|
||||
case ExceptionsAttribute exa ->
|
||||
nodes.add(list("excceptions", "exc", exa.exceptions().stream()
|
||||
nodes.add(list("exceptions", "exc", exa.exceptions().stream()
|
||||
.map(e -> e.name().stringValue())));
|
||||
case InnerClassesAttribute ica ->
|
||||
nodes.add(new ListNodeImpl(BLOCK, "inner classes", ica.classes().stream()
|
||||
|
|
|
@ -205,14 +205,14 @@ public final class StackMapGenerator {
|
|||
* New <code>Generator</code> instance must be created for each individual class/method.
|
||||
* Instance contains only immutable results, all the calculations are processed during instance construction.
|
||||
*
|
||||
* @param labelContext <code>LableContext</code> instance used to resolve or patch <code>ExceptionHandler</code>
|
||||
* @param labelContext <code>LabelContext</code> instance used to resolve or patch <code>ExceptionHandler</code>
|
||||
* labels to bytecode offsets (or vice versa)
|
||||
* @param thisClass class to generate stack maps for
|
||||
* @param methodName method name to generate stack maps for
|
||||
* @param methodDesc method descriptor to generate stack maps for
|
||||
* @param isStatic information whether the method is static
|
||||
* @param bytecode R/W <code>ByteBuffer</code> wrapping method bytecode, the content is altered in case <code>Generator</code> detects and patches dead code
|
||||
* @param cp R/W <code>ConstantPoolBuilder</code> instance used to resolve all involved CP entries and also generate new entries referenced from the generted stack maps
|
||||
* @param cp R/W <code>ConstantPoolBuilder</code> instance used to resolve all involved CP entries and also generate new entries referenced from the generated stack maps
|
||||
* @param handlers R/W <code>ExceptionHandler</code> list used to detect mandatory frame offsets as well as to determine stack maps in exception handlers
|
||||
* and also to be altered when dead code is detected and must be excluded from exception handlers
|
||||
*/
|
||||
|
@ -826,7 +826,7 @@ public final class StackMapGenerator {
|
|||
/**
|
||||
* Throws <code>java.lang.VerifyError</code> with given error message
|
||||
* @param msg error message
|
||||
* @param offset bytecode offset where the error occured
|
||||
* @param offset bytecode offset where the error occurred
|
||||
*/
|
||||
private void generatorError(String msg, int offset) {
|
||||
var sb = new StringBuilder("%s at bytecode offset %d of method %s(%s)".formatted(
|
||||
|
@ -1291,7 +1291,7 @@ public final class StackMapGenerator {
|
|||
return new Type(ITEM_UNINITIALIZED, null, bci);
|
||||
}
|
||||
|
||||
@Override //mandatory overrride to avoid use of method reference during JDK bootstrap
|
||||
@Override //mandatory override to avoid use of method reference during JDK bootstrap
|
||||
public boolean equals(Object o) {
|
||||
return (o instanceof Type t) && t.tag == tag && t.bci == bci && Objects.equals(sym, t.sym);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class VerificationType {
|
|||
Category1 = (Category1Flag << BitsPerByte) | Primitive,
|
||||
Category2 = (Category2Flag << BitsPerByte) | Primitive,
|
||||
Category2_2nd = (Category2_2ndFlag << BitsPerByte) | Primitive,
|
||||
// Primitive values (type descriminator stored in most-signifcant bytes)
|
||||
// Primitive values (type discriminator stored in most-significant bytes)
|
||||
// Bogus needs the " | Primitive". Else, isReference(Bogus) returns TRUE.
|
||||
Bogus = (ITEM_Bogus << 2 * BitsPerByte) | Primitive,
|
||||
Boolean = (ITEM_Boolean << 2 * BitsPerByte) | Category1,
|
||||
|
@ -131,7 +131,7 @@ class VerificationType {
|
|||
Double_2nd = (ITEM_Double_2nd << 2 * BitsPerByte) | Category2_2nd,
|
||||
// Used by Uninitialized (second and third bytes hold the bci)
|
||||
BciMask = 0xffff << BitsPerByte,
|
||||
// A bci of -1 is an Unintialized-This
|
||||
// A bci of -1 is an Uninitialized-This
|
||||
BciForThis = 0xffff,
|
||||
// Query values
|
||||
ReferenceQuery = (ReferenceFlag << BitsPerByte) | TypeQuery,
|
||||
|
@ -212,7 +212,7 @@ class VerificationType {
|
|||
// the 'query' types should technically return 'false' here, if we
|
||||
// allow this to return true, we can perform the test using only
|
||||
// 2 operations rather than 8 (3 masks, 3 compares and 2 logical 'ands').
|
||||
// Since noone should call this on a query type anyway, this is ok.
|
||||
// Since no one should call this on a query type anyway, this is ok.
|
||||
if(is_check()) context.verifyError("Must not be a check type (wrong value returned)");
|
||||
// should only return false if it's a primitive, and the category1 flag
|
||||
// is not set.
|
||||
|
|
|
@ -67,8 +67,8 @@ public sealed interface ExceptionCatch extends PseudoInstruction
|
|||
/**
|
||||
* {@return an exception table pseudo-instruction}
|
||||
* @param handler the handler for the exception
|
||||
* @param tryStart the beginning of the instruction range for the gaurded instructions
|
||||
* @param tryEnd the end of the instruction range for the gaurded instructions
|
||||
* @param tryStart the beginning of the instruction range for the guarded instructions
|
||||
* @param tryEnd the end of the instruction range for the guarded instructions
|
||||
* @param catchTypeEntry the type of exception to catch, or empty if this
|
||||
* handler is unconditional
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,7 @@ public sealed interface LoadInstruction extends Instruction
|
|||
* {@return a local variable load instruction}
|
||||
*
|
||||
* @param kind the type of the value to be loaded
|
||||
* @param slot the local varaible slot to load from
|
||||
* @param slot the local variable slot to load from
|
||||
*/
|
||||
static LoadInstruction of(TypeKind kind, int slot) {
|
||||
return of(BytecodeHelpers.loadOpcode(kind, slot), slot);
|
||||
|
@ -61,7 +61,7 @@ public sealed interface LoadInstruction extends Instruction
|
|||
*
|
||||
* @param op the opcode for the specific type of load instruction,
|
||||
* which must be of kind {@link Opcode.Kind#LOAD}
|
||||
* @param slot the local varaible slot to load from
|
||||
* @param slot the local variable slot to load from
|
||||
*/
|
||||
static LoadInstruction of(Opcode op, int slot) {
|
||||
Util.checkKind(op, Opcode.Kind.LOAD);
|
||||
|
|
|
@ -45,7 +45,7 @@ public sealed interface NewMultiArrayInstruction extends Instruction
|
|||
ClassEntry arrayType();
|
||||
|
||||
/**
|
||||
* {@return the number of dimensions of the aray}
|
||||
* {@return the number of dimensions of the array}
|
||||
*/
|
||||
int dimensions();
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public sealed interface StoreInstruction extends Instruction
|
|||
* {@return a local variable store instruction}
|
||||
*
|
||||
* @param kind the type of the value to be stored
|
||||
* @param slot the local varaible slot to store to
|
||||
* @param slot the local variable slot to store to
|
||||
*/
|
||||
static StoreInstruction of(TypeKind kind, int slot) {
|
||||
return of(BytecodeHelpers.storeOpcode(kind, slot), slot);
|
||||
|
@ -59,7 +59,7 @@ public sealed interface StoreInstruction extends Instruction
|
|||
*
|
||||
* @param op the opcode for the specific type of store instruction,
|
||||
* which must be of kind {@link Opcode.Kind#STORE}
|
||||
* @param slot the local varaible slot to store to
|
||||
* @param slot the local variable slot to store to
|
||||
*/
|
||||
static StoreInstruction of(Opcode op, int slot) {
|
||||
Util.checkKind(op, Opcode.Kind.STORE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue