Skip to content

Commit

Permalink
8311020: Typo cleanup in Classfile API
Browse files Browse the repository at this point in the history
Reviewed-by: asotona
  • Loading branch information
liach authored and asotona committed Jun 29, 2023
1 parent f4b900b commit cbf418a
Show file tree
Hide file tree
Showing 30 changed files with 53 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@

/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ protected void writeBody(BufWriter buf, SignatureAttribute attr) {
}
};

/** 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static ClassHierarchyResolver defaultResolver() {
* {@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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ default List<VerifyError> verify(Consumer<String> debugOutput) {
*
* @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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@
*
* @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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/**
* 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})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static MethodSignature of(Signature result,
/**
* @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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ sealed interface LocalVarTarget extends TargetInfo
permits TargetInfoImpl.LocalVarTargetImpl {

/**
* @return the table of local variable location/indicies.
* @return the table of local variable location/indices.
*/
List<LocalVarTargetInfo> table();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -71,7 +71,7 @@ default MethodSignature asMethodSignature() {
}

/**
* Parse the siganture as a type signature.
* Parse the signature as a type signature.
* @return the type signature
*/
default Signature asTypeSignature() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
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}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ public ClassDesc commonAncestor(ClassDesc symbol1, ClassDesc symbol2) {
}

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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private static Node[] elementValueToTree(AnnotationValue v) {
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))))};
Expand Down Expand Up @@ -535,7 +535,7 @@ private static Stream<ConstantDesc> convertVTIs(CodeAttribute lr, List<Verificat
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()));
}
});
}
Expand Down Expand Up @@ -914,7 +914,7 @@ private static Node[] attributesToTree(List<Attribute<?>> attributes, Verbosity
"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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ static record RawExceptionCatch(int start, int end, int handler, Type catchType)
* 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
*/
Expand Down Expand Up @@ -826,7 +826,7 @@ private void generatorError(String msg) {
/**
* 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(
Expand Down Expand Up @@ -1291,7 +1291,7 @@ static Type uninitializedType(int bci) {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ String name() {
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,
Expand All @@ -131,7 +131,7 @@ String name() {
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,
Expand Down Expand Up @@ -212,7 +212,7 @@ boolean is_category1(VerifierImpl context) {
// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -61,7 +61,7 @@ static LoadInstruction of(TypeKind kind, int slot) {
*
* @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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -59,7 +59,7 @@ static StoreInstruction of(TypeKind kind, int slot) {
*
* @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);
Expand Down
Loading

1 comment on commit cbf418a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.