Commit dadb41c1 authored by Eric Bruneton's avatar Eric Bruneton

Merge branch 'small-code-quality-improvements' into 'master'

Small code quality improvements, hopefully the last ones for the core package.

See merge request !77
parents b08b5a26 39138ebe
Pipeline #422 passed with stage
in 10 minutes and 14 seconds
......@@ -61,14 +61,15 @@ public abstract class AnnotationVisitor {
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param av the annotation visitor to which this visitor must delegate method calls. May be null.
* @param annotationVisitor the annotation visitor to which this visitor must delegate method
* calls. May be null.
*/
public AnnotationVisitor(final int api, final AnnotationVisitor av) {
public AnnotationVisitor(final int api, final AnnotationVisitor annotationVisitor) {
if (api < Opcodes.ASM4 || api > Opcodes.ASM6) {
throw new IllegalArgumentException();
}
this.api = api;
this.av = av;
this.av = annotationVisitor;
}
/**
......@@ -77,12 +78,12 @@ public abstract class AnnotationVisitor {
* @param name the value name.
* @param value the actual value, whose type must be {@link Byte}, {@link Boolean}, {@link
* Character}, {@link Short}, {@link Integer} , {@link Long}, {@link Float}, {@link Double},
* {@link String} or {@link Type} of OBJECT or ARRAY sort. This value can also be an array of
* byte, boolean, short, char, int, long, float or double values (this is equivalent to using
* {@link #visitArray visitArray} and visiting each array element in turn, but is more
* convenient).
* {@link String} or {@link Type} of {@link Type#OBJECT} or {@link Type#ARRAY} sort. This
* value can also be an array of byte, boolean, short, char, int, long, float or double values
* (this is equivalent to using {@link #visitArray} and visiting each array element in turn,
* but is more convenient).
*/
public void visit(String name, Object value) {
public void visit(final String name, final Object value) {
if (av != null) {
av.visit(name, value);
}
......@@ -92,12 +93,12 @@ public abstract class AnnotationVisitor {
* Visits an enumeration value of the annotation.
*
* @param name the value name.
* @param desc the class descriptor of the enumeration class.
* @param descriptor the class descriptor of the enumeration class.
* @param value the actual enumeration value.
*/
public void visitEnum(String name, String desc, String value) {
public void visitEnum(final String name, final String descriptor, final String value) {
if (av != null) {
av.visitEnum(name, desc, value);
av.visitEnum(name, descriptor, value);
}
}
......@@ -105,14 +106,14 @@ public abstract class AnnotationVisitor {
* Visits a nested annotation value of the annotation.
*
* @param name the value name.
* @param desc the class descriptor of the nested annotation class.
* @param descriptor the class descriptor of the nested annotation class.
* @return a visitor to visit the actual nested annotation value, or <tt>null</tt> if this visitor
* is not interested in visiting this nested annotation. <i>The nested annotation value must
* be fully visited before calling other methods on this annotation visitor</i>.
*/
public AnnotationVisitor visitAnnotation(String name, String desc) {
public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
if (av != null) {
return av.visitAnnotation(name, desc);
return av.visitAnnotation(name, descriptor);
}
return null;
}
......@@ -128,7 +129,7 @@ public abstract class AnnotationVisitor {
* this visitor are ignored. <i>All the array values must be visited before calling other
* methods on this annotation visitor</i>.
*/
public AnnotationVisitor visitArray(String name) {
public AnnotationVisitor visitArray(final String name) {
if (av != null) {
return av.visitArray(name);
}
......
......@@ -63,7 +63,7 @@ final class AnnotationWriter extends AnnotationVisitor {
*
* <p>Note: as an exception to the above rules, for AnnotationDefault attributes (which contain a
* single element_value by definition), this ByteVector is initially empty when passed to the
* constructor, and numElementValuePairsOffset is set to -1.
* constructor, and {@link #numElementValuePairsOffset} is set to -1.
*/
private final ByteVector annotation;
......@@ -222,7 +222,7 @@ final class AnnotationWriter extends AnnotationVisitor {
}
@Override
public void visitEnum(final String name, final String desc, final String value) {
public void visitEnum(final String name, final String descriptor, final String value) {
// Case of an element_value with an enum_const_value field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
......@@ -230,12 +230,12 @@ final class AnnotationWriter extends AnnotationVisitor {
annotation.putShort(symbolTable.addConstantUtf8(name));
}
annotation
.put12('e', symbolTable.addConstantUtf8(desc))
.put12('e', symbolTable.addConstantUtf8(descriptor))
.putShort(symbolTable.addConstantUtf8(value));
}
@Override
public AnnotationVisitor visitAnnotation(final String name, final String desc) {
public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
// Case of an element_value with an annotation_value field.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
++numElementValuePairs;
......@@ -243,7 +243,7 @@ final class AnnotationWriter extends AnnotationVisitor {
annotation.putShort(symbolTable.addConstantUtf8(name));
}
// Write tag and type_index, and reserve 2 bytes for num_element_value_pairs.
annotation.put12('@', symbolTable.addConstantUtf8(desc)).putShort(0);
annotation.put12('@', symbolTable.addConstantUtf8(descriptor)).putShort(0);
return new AnnotationWriter(symbolTable, annotation, null);
}
......
......@@ -44,7 +44,7 @@ public class Attribute {
public final String type;
/**
* The raw content of this attribute, used only for unknown attributes (see {@link #isUnknown()}).
* The raw content of this attribute, only used for unknown attributes (see {@link #isUnknown()}).
* The 6 header bytes of the attribute (attribute_name_index and attribute_length) are <i>not</i>
* included.
*/
......@@ -183,12 +183,12 @@ public class Attribute {
* @return the size of all the attributes in this attribute list. This size includes the size of
* the attribute headers.
*/
final int getAttributesSize(final SymbolTable symbolTable) {
final int computeAttributesSize(final SymbolTable symbolTable) {
final byte[] code = null;
final int codeLength = 0;
final int maxStack = -1;
final int maxLocals = -1;
return getAttributesSize(symbolTable, code, codeLength, maxStack, maxLocals);
return computeAttributesSize(symbolTable, code, codeLength, maxStack, maxLocals);
}
/**
......@@ -209,7 +209,7 @@ public class Attribute {
* @return the size of all the attributes in this attribute list. This size includes the size of
* the attribute headers.
*/
final int getAttributesSize(
final int computeAttributesSize(
final SymbolTable symbolTable,
final byte[] code,
final int codeLength,
......
......@@ -38,7 +38,7 @@ public class ByteVector {
/** The content of this vector. Only the first {@link #length} bytes contain real data. */
byte[] data;
/** Actual number of bytes in this vector. */
/** The actual number of bytes in this vector. */
int length;
/** Constructs a new {@link ByteVector} with a default initial capacity. */
......@@ -47,7 +47,7 @@ public class ByteVector {
}
/**
* Constructs a new {@link ByteVector ByteVector} with the given initial capacity.
* Constructs a new {@link ByteVector} with the given initial capacity.
*
* @param initialCapacity the initial capacity of the byte vector to be constructed.
*/
......@@ -249,12 +249,10 @@ public class ByteVector {
enlarge(2 + charLength);
}
byte[] currentData = data;
// optimistic algorithm: instead of computing the byte length and then
// serializing the string (which requires two loops), we assume the byte
// length is equal to char length (which is the most frequent case), and
// we start serializing the string right away. During the serialization,
// if we find that this assumption is wrong, we continue with the
// general method.
// Optimistic algorithm: instead of computing the byte length and then serializing the string
// (which requires two loops), we assume the byte length is equal to char length (which is the
// most frequent case), and we start serializing the string right away. During the
// serialization, if we find that this assumption is wrong, we continue with the general method.
currentData[currentLength++] = (byte) (charLength >>> 8);
currentData[currentLength++] = (byte) charLength;
for (int i = 0; i < charLength; ++i) {
......@@ -348,7 +346,7 @@ public class ByteVector {
}
/**
* Enlarge this byte vector so that it can receive 'size' more bytes.
* Enlarges this byte vector so that it can receive 'size' more bytes.
*
* @param size number of additional bytes that this byte vector should be able to receive.
*/
......
......@@ -44,21 +44,21 @@ import java.io.InputStream;
public class ClassReader {
/**
* Flag to skip the Code attributes. If this flag is set the Code attributes are neither parsed
* A flag to skip the Code attributes. If this flag is set the Code attributes are neither parsed
* nor visited.
*/
public static final int SKIP_CODE = 1;
/**
* Flag to skip the SourceFile, SourceDebugExtension, LocalVariableTable, LocalVariableTypeTable
* A flag to skip the SourceFile, SourceDebugExtension, LocalVariableTable, LocalVariableTypeTable
* and LineNumberTable attributes. If this flag is set these attributes are neither parsed nor
* visited (i.e. {@link ClassVisitor#visitSource}, {@link MethodVisitor#visitLocalVariable} and
* {@link MethodVisitor#visitLineNumber} are not be called).
* {@link MethodVisitor#visitLineNumber} are not called).
*/
public static final int SKIP_DEBUG = 2;
/**
* Flag to skip the StackMap and StackMapTable attributes. If this flag is set these attributes
* A flag to skip the StackMap and StackMapTable attributes. If this flag is set these attributes
* are neither parsed nor visited (i.e. {@link MethodVisitor#visitFrame} is not called). This flag
* is useful when the {@link ClassWriter#COMPUTE_FRAMES} option is used: it avoids visiting frames
* that will be ignored and recomputed from scratch.
......@@ -66,16 +66,16 @@ public class ClassReader {
public static final int SKIP_FRAMES = 4;
/**
* Flag to expand the stack map frames. By default stack map frames are visited in their original
* format (i.e. "expanded" for classes whose version is less than V1_6, and "compressed" for the
* other classes). If this flag is set, stack map frames are always visited in expanded format
* (this option adds a decompression/recompression step in ClassReader and ClassWriter which
* degrades performances quite a lot).
* A flag to expand the stack map frames. By default stack map frames are visited in their
* original format (i.e. "expanded" for classes whose version is less than V1_6, and "compressed"
* for the other classes). If this flag is set, stack map frames are always visited in expanded
* format (this option adds a decompression/compression step in ClassReader and ClassWriter which
* degrades performance quite a lot).
*/
public static final int EXPAND_FRAMES = 8;
/**
* Flag to expand the ASM specific instructions into an equivalent sequence of standard bytecode
* A flag to expand the ASM specific instructions into an equivalent sequence of standard bytecode
* instructions. When resolving a forward jump it may happen that the signed 2 bytes offset
* reserved for it is not sufficient to store the bytecode offset. In this case the jump
* instruction is replaced with a temporary ASM specific instruction using an unsigned 2 bytes
......@@ -1504,7 +1504,6 @@ public class ClassReader {
case Constants.SIPUSH:
case Constants.LDC_W:
case Constants.LDC2_W:
case Constants.GETSTATIC:
case Constants.PUTSTATIC:
case Constants.GETFIELD:
......@@ -1780,7 +1779,7 @@ public class ClassReader {
}
}
// Inserts a stack map frame for this bytecode offset, if requested by setting insertFrame to
// Insert a stack map frame for this bytecode offset, if requested by setting insertFrame to
// true during the previous iteration. The actual frame content is computed in MethodWriter.
if (insertFrame) {
if ((context.parsingOptions & EXPAND_FRAMES) != 0) {
......@@ -2448,7 +2447,7 @@ public class ClassReader {
case TypeReference.LOCAL_VARIABLE:
case TypeReference.RESOURCE_VARIABLE:
// A localvar_target has a variable size, which depends on the value of their table_length
// field. It also reference bytecode offsets, for which we need labels.
// field. It also references bytecode offsets, for which we need labels.
int tableLength = readUnsignedShort(currentOffset + 1);
currentOffset += 3;
while (tableLength-- > 0) {
......
......@@ -61,14 +61,15 @@ public abstract class ClassVisitor {
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param cv the class visitor to which this visitor must delegate method calls. May be null.
* @param classVisitor the class visitor to which this visitor must delegate method calls. May be
* null.
*/
public ClassVisitor(final int api, final ClassVisitor cv) {
public ClassVisitor(final int api, final ClassVisitor classVisitor) {
if (api < Opcodes.ASM4 || api > Opcodes.ASM6) {
throw new IllegalArgumentException();
}
this.api = api;
this.cv = cv;
this.cv = classVisitor;
}
/**
......@@ -88,12 +89,12 @@ public abstract class ClassVisitor {
* Type#getInternalName() getInternalName}). May be <tt>null</tt>.
*/
public void visit(
int version,
int access,
String name,
String signature,
String superName,
String[] interfaces) {
final int version,
final int access,
final String name,
final String signature,
final String superName,
final String[] interfaces) {
if (cv != null) {
cv.visit(version, access, name, signature, superName, interfaces);
}
......@@ -104,10 +105,10 @@ public abstract class ClassVisitor {
*
* @param source the name of the source file from which the class was compiled. May be
* <tt>null</tt>.
* @param debug additional debug information to compute the correspondance between source and
* @param debug additional debug information to compute the correspondence between source and
* compiled elements of the class. May be <tt>null</tt>.
*/
public void visitSource(String source, String debug) {
public void visitSource(final String source, final String debug) {
if (cv != null) {
cv.visitSource(source, debug);
}
......@@ -123,7 +124,7 @@ public abstract class ClassVisitor {
* @return a visitor to visit the module values, or <tt>null</tt> if this visitor is not
* interested in visiting this module.
*/
public ModuleVisitor visitModule(String name, int access, String version) {
public ModuleVisitor visitModule(final String name, final int access, final String version) {
if (api < Opcodes.ASM6) {
throw new RuntimeException();
}
......@@ -140,26 +141,26 @@ public abstract class ClassVisitor {
* @param owner internal name of the enclosing class of the class.
* @param name the name of the method that contains the class, or <tt>null</tt> if the class is
* not enclosed in a method of its enclosing class.
* @param desc the descriptor of the method that contains the class, or <tt>null</tt> if the class
* is not enclosed in a method of its enclosing class.
* @param descriptor the descriptor of the method that contains the class, or <tt>null</tt> if the
* class is not enclosed in a method of its enclosing class.
*/
public void visitOuterClass(String owner, String name, String desc) {
public void visitOuterClass(final String owner, final String name, final String descriptor) {
if (cv != null) {
cv.visitOuterClass(owner, name, desc);
cv.visitOuterClass(owner, name, descriptor);
}
}
/**
* Visits an annotation of the class.
*
* @param desc the class descriptor of the annotation class.
* @param descriptor the class descriptor of the annotation class.
* @param visible <tt>true</tt> if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or <tt>null</tt> if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
if (cv != null) {
return cv.visitAnnotation(desc, visible);
return cv.visitAnnotation(descriptor, visible);
}
return null;
}
......@@ -168,24 +169,24 @@ public abstract class ClassVisitor {
* Visits an annotation on a type in the class signature.
*
* @param typeRef a reference to the annotated type. The sort of this type reference must be
* {@link TypeReference#CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER}, {@link
* TypeReference#CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND} or {@link
* TypeReference#CLASS_EXTENDS CLASS_EXTENDS}. See {@link TypeReference}.
* {@link TypeReference#CLASS_TYPE_PARAMETER}, {@link
* TypeReference#CLASS_TYPE_PARAMETER_BOUND} or {@link TypeReference#CLASS_EXTENDS}. See
* {@link TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or
* static inner type within 'typeRef'. May be <tt>null</tt> if the annotation targets
* 'typeRef' as a whole.
* @param desc the class descriptor of the annotation class.
* @param descriptor the class descriptor of the annotation class.
* @param visible <tt>true</tt> if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or <tt>null</tt> if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitTypeAnnotation(
int typeRef, TypePath typePath, String desc, boolean visible) {
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
if (api < Opcodes.ASM5) {
throw new RuntimeException();
}
if (cv != null) {
return cv.visitTypeAnnotation(typeRef, typePath, desc, visible);
return cv.visitTypeAnnotation(typeRef, typePath, descriptor, visible);
}
return null;
}
......@@ -193,11 +194,11 @@ public abstract class ClassVisitor {
/**
* Visits a non standard attribute of the class.
*
* @param attr an attribute.
* @param attribute an attribute.
*/
public void visitAttribute(Attribute attr) {
public void visitAttribute(final Attribute attribute) {
if (cv != null) {
cv.visitAttribute(attr);
cv.visitAttribute(attribute);
}
}
......@@ -214,7 +215,8 @@ public abstract class ClassVisitor {
* @param access the access flags of the inner class as originally declared in the enclosing
* class.
*/
public void visitInnerClass(String name, String outerName, String innerName, int access) {
public void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
if (cv != null) {
cv.visitInnerClass(name, outerName, innerName, access);
}
......@@ -226,7 +228,7 @@ public abstract class ClassVisitor {
* @param access the field's access flags (see {@link Opcodes}). This parameter also indicates if
* the field is synthetic and/or deprecated.
* @param name the field's name.
* @param desc the field's descriptor (see {@link Type Type}).
* @param descriptor the field's descriptor (see {@link Type Type}).
* @param signature the field's signature. May be <tt>null</tt> if the field's type does not use
* generic types.
* @param value the field's initial value. This parameter, which may be <tt>null</tt> if the field
......@@ -239,9 +241,13 @@ public abstract class ClassVisitor {
* visitor is not interested in visiting these annotations and attributes.
*/
public FieldVisitor visitField(
int access, String name, String desc, String signature, Object value) {
final int access,
final String name,
final String descriptor,
final String signature,
final Object value) {
if (cv != null) {
return cv.visitField(access, name, desc, signature, value);
return cv.visitField(access, name, descriptor, signature, value);
}
return null;
}
......@@ -254,7 +260,7 @@ public abstract class ClassVisitor {
* @param access the method's access flags (see {@link Opcodes}). This parameter also indicates if
* the method is synthetic and/or deprecated.
* @param name the method's name.
* @param desc the method's descriptor (see {@link Type Type}).
* @param descriptor the method's descriptor (see {@link Type Type}).
* @param signature the method's signature. May be <tt>null</tt> if the method parameters, return
* type and exceptions do not use generic types.
* @param exceptions the internal names of the method's exception classes (see {@link
......@@ -263,9 +269,13 @@ public abstract class ClassVisitor {
* is not interested in visiting the code of this method.
*/
public MethodVisitor visitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
final int access,
final String name,
final String descriptor,
final String signature,
final String[] exceptions) {
if (cv != null) {
return cv.visitMethod(access, name, desc, signature, exceptions);
return cv.visitMethod(access, name, descriptor, signature, exceptions);
}
return null;
}
......
......@@ -35,7 +35,7 @@ package org.objectweb.asm;
*/
final class Context {
/** Prototypes of the attributes that must be parsed in this class. */
/** The prototypes of the attributes that must be parsed in this class. */
Attribute[] attributePrototypes;
/**
......
......@@ -31,7 +31,8 @@ package org.objectweb.asm;
* An edge in the control flow graph of a method. Each node of this graph is a basic block,
* represented with the Label corresponding to its first instruction. Each edge goes from one node
* to another, i.e. from one basic block to another (called the predecessor and successor blocks,
* respectively). An edge corresponds either to a jump instruction or to an exception handler.
* respectively). An edge corresponds either to a jump or ret instruction or to an exception
* handler.
*
* @see Label
* @author Eric Bruneton
......@@ -39,13 +40,13 @@ package org.objectweb.asm;
final class Edge {
/**
* Denotes a control flow graph edge corresponding to a jump instruction. Only used with {@link
* A control flow graph edge corresponding to a jump or ret instruction. Only used with {@link
* ClassWriter#COMPUTE_FRAMES}.
*/
static final int JUMP = 0;
/**
* Denotes a control flow graph edge corresponding to an exception handler. Only used with {@link
* A control flow graph edge corresponding to an exception handler. Only used with {@link
* ClassWriter#COMPUTE_MAXS}.
*/
static final int EXCEPTION = 0x7FFFFFFF;
......
......@@ -60,27 +60,28 @@ public abstract class FieldVisitor {
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param fv the field visitor to which this visitor must delegate method calls. May be null.
* @param fieldVisitor the field visitor to which this visitor must delegate method calls. May be
* null.
*/
public FieldVisitor(final int api, final FieldVisitor fv) {
public FieldVisitor(final int api, final FieldVisitor fieldVisitor) {
if (api < Opcodes.ASM4 || api > Opcodes.ASM6) {
throw new IllegalArgumentException();
}
this.api = api;
this.fv = fv;
this.fv = fieldVisitor;
}
/**
* Visits an annotation of the field.
*
* @param desc the class descriptor of the annotation class.
* @param descriptor the class descriptor of the annotation class.
* @param visible <tt>true</tt> if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or <tt>null</tt> if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
if (fv != null) {
return fv.visitAnnotation(desc, visible);
return fv.visitAnnotation(descriptor, visible);
}
return null;
}
......@@ -93,18 +94,18 @@ public abstract class FieldVisitor {
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or
* static inner type within 'typeRef'. May be <tt>null</tt> if the annotation targets
* 'typeRef' as a whole.
* @param desc the class descriptor of the annotation class.
* @param descriptor the class descriptor of the annotation class.
* @param visible <tt>true</tt> if the annotation is visible at runtime.
* @return a visitor to visit the annotation values, or <tt>null</tt> if this visitor is not
* interested in visiting this annotation.
*/
public AnnotationVisitor visitTypeAnnotation(
int typeRef, TypePath typePath, String desc, boolean visible) {
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
if (api < Opcodes.ASM5) {
throw new RuntimeException();
}
if (fv != null) {
return fv.visitTypeAnnotation(typeRef, typePath, desc, visible);
return fv.visitTypeAnnotation(typeRef, typePath, descriptor, visible);
}
return null;
}
......@@ -112,11 +113,11 @@ public abstract class FieldVisitor {
/**
* Visits a non standard attribute of the field.
*
* @param attr an attribute.
* @param attribute an attribute.
*/
public void visitAttribute(Attribute attr) {
public void visitAttribute(final Attribute attribute) {
if (fv != null) {
fv.visitAttribute(attr);
fv.visitAttribute(attribute);
}
}
......
......@@ -142,12 +142,12 @@ final class FieldWriter extends FieldVisitor {
// -----------------------------------------------------------------------------------------------
@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
// Create a ByteVector to hold an 'annotation' JVMS structure.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.
ByteVector annotation = new ByteVector();
// Write type_index and reserve space for num_element_value_pairs.
annotation.putShort(symbolTable.addConstantUtf8(desc)).putShort(0);
annotation.putShort(symbolTable.addConstantUtf8(descriptor)).putShort(0);
if (visible) {
return lastRuntimeVisibleAnnotation =
new AnnotationWriter(symbolTable, annotation, lastRuntimeVisibleAnnotation);
......@@ -159,7 +159,7 @@ final class FieldWriter extends FieldVisitor {
@Override
public AnnotationVisitor visitTypeAnnotation(
final int typeRef, final TypePath typePath, final String desc, final boolean visible) {
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
// Create a ByteVector to hold a 'type_annotation' JVMS structure.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.20.
ByteVector typeAnnotation = new ByteVector();
......@@ -167,7 +167,7 @@ final class FieldWriter extends FieldVisitor {
TypeReference.putTarget(typeRef, typeAnnotation);
TypePath.put(typePath, typeAnnotation);
// Write type_index and reserve space for num_element_value_pairs.
typeAnnotation.putShort(symbolTable.addConstantUtf8(desc)).putShort(0);
typeAnnotation.putShort(symbolTable.addConstantUtf8(descriptor)).putShort(0);
if (visible) {
return lastRuntimeVisibleTypeAnnotation =
new AnnotationWriter(symbolTable, typeAnnotation, lastRuntimeVisibleTypeAnnotation);
......@@ -192,7 +192,7 @@ final class FieldWriter extends FieldVisitor {
// -----------------------------------------------------------------------------------------------
/**
* Returns the size of the field_info JVMS structure generated by this FieldWriter. Also add the
* Returns the size of the field_info JVMS structure generated by this FieldWriter. Also adds the
* names of the attributes of this field in the constant pool.
*
* @return the size in bytes of the field_info JVMS structure.
......@@ -240,7 +240,7 @@ final class FieldWriter extends FieldVisitor {
"RuntimeInvisibleTypeAnnotations");
}
if (firstAttribute != null) {
size += firstAttribute.getAttributesSize(symbolTable);
size += firstAttribute.computeAttributesSize(symbolTable);
}
return size;
}
......
......@@ -141,10 +141,10 @@ class Frame {
/** The number of right shift bits to use to get the array dimensions of an abstract type. */
private static final int DIM_SHIFT = 28;
/** Constant to be added to an abstract type to get one with one more array dimension. */
/** The constant to be added to an abstract type to get one with one more array dimension. */
private static final int ARRAY_OF = +1 << DIM_SHIFT;
/** Constant to be added to an abstract type to get one with one less array dimension. */
/** The constant to be added to an abstract type to get one with one less array dimension. */
private static final int ELEMENT_OF = -1 << DIM_SHIFT;
// Possible values for the KIND field of an abstract type.
......@@ -158,9 +158,9 @@ class Frame {
// Possible flags for the FLAGS field of an abstract type.
/**
* For LOCAL_KIND and STACK_KIND abstract types, indicates that if the resolved, concrete type is
* LONG or DOUBLE, TOP should be used instead (because the value has been partially overridden
* with an xSTORE instruction).
* A flag used for LOCAL_KIND and STACK_KIND abstract types, indicating that if the resolved,
* concrete type is LONG or DOUBLE, TOP should be used instead (because the value has been
* partially overridden with an xSTORE instruction).
*/
private static final int TOP_IF_LONG_OR_DOUBLE_FLAG = 0x00100000 & FLAGS_MASK;
......
......@@ -152,14 +152,14 @@ public final class Handle {
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
public boolean equals(final Object object) {
if (object == this) {
return true;
}
if (!(obj instanceof Handle)) {
if (!(object instanceof Handle)) {
return false;
}
Handle handle = (Handle) obj;
Handle handle = (Handle) object;
return tag == handle.tag
&& isInterface == handle.isInterface
&& owner.equals(handle.owner)
......@@ -178,8 +178,8 @@ public final class Handle {
* Returns the textual representation of this handle. The textual representation is:
*
* <ul>
* <li>for a reference to a class: owner "." name desc " (" tag ")",
* <li>for a reference to an interface: owner "." name desc " (" tag " itf )".
* <li>for a reference to a class: owner "." name descriptor " (" tag ")",
* <li>for a reference to an interface: owner "." name descriptor " (" tag " itf )".
* </ul>
*/
@Override
......
......@@ -28,38 +28,38 @@
package org.objectweb.asm;
/**
* A label represents a position in the bytecode of a method. Labels are used for jump, goto, and
* switch instructions, and for try catch blocks. A label designates the <i>instruction</i> that is
* just after. Note however that there can be other elements between a label and the instruction it
* designates (such as other labels, stack map frames, line numbers, etc.).
* A position in the bytecode of a method. Labels are used for jump, goto, and switch instructions,
* and for try catch blocks. A label designates the <i>instruction</i> that is just after. Note
* however that there can be other elements between a label and the instruction it designates (such