8282508: Updating ASM to 9.2 for JDK 19

Reviewed-by: lancea, egahlin, mchung
This commit is contained in:
Vicente Romero 2022-04-04 15:05:00 +00:00
parent 4e20a03786
commit 36b9baa70d
138 changed files with 1070 additions and 1094 deletions
src/java.base/share/classes/jdk/internal/org/objectweb/asm
AnnotationVisitor.javaAnnotationWriter.javaAttribute.javaByteVector.javaClassReader.javaClassTooLargeException.javaClassVisitor.javaClassWriter.javaConstantDynamic.javaConstants.javaContext.javaCurrentFrame.javaEdge.javaFieldVisitor.javaFieldWriter.javaFrame.javaHandle.javaHandler.javaLabel.javaMethodTooLargeException.javaMethodVisitor.javaMethodWriter.javaModuleVisitor.javaModuleWriter.javaOpcodes.javaRecordComponentVisitor.javaRecordComponentWriter.javaSymbol.javaSymbolTable.javaType.javaTypePath.javaTypeReference.java
commons
signature
tree

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -98,19 +99,15 @@ public abstract class AnnotationVisitor {
* @param annotationVisitor the annotation visitor to which this visitor must delegate method
* calls. May be {@literal null}.
*/
@SuppressWarnings("deprecation")
public AnnotationVisitor(final int api, final AnnotationVisitor annotationVisitor) {
if (api != Opcodes.ASM8
if (api != Opcodes.ASM9
&& api != Opcodes.ASM8
&& api != Opcodes.ASM7
&& api != Opcodes.ASM6
&& api != Opcodes.ASM5
&& api != Opcodes.ASM4
&& api != Opcodes.ASM9_EXPERIMENTAL) {
&& api != Opcodes.ASM4) {
throw new IllegalArgumentException("Unsupported api " + api);
}
if (api == Opcodes.ASM9_EXPERIMENTAL) {
Constants.checkAsmExperimental(this);
}
this.api = api;
this.av = annotationVisitor;
}
@ -162,9 +159,9 @@ public abstract class AnnotationVisitor {
}
/**
* Visits an array value of the annotation. Note that arrays of primitive types (such as byte,
* Visits an array value of the annotation. Note that arrays of primitive values (such as byte,
* boolean, short, char, int, long, float or double) can be passed as value to {@link #visit
* visit}. This is what {@link ClassReader} does.
* visit}. This is what {@link ClassReader} does for non empty arrays of primitive values.
*
* @param name the value name.
* @return a visitor to visit the actual array value elements, or {@literal null} if this visitor

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -143,7 +144,7 @@ final class AnnotationWriter extends AnnotationVisitor {
final boolean useNamedValues,
final ByteVector annotation,
final AnnotationWriter previousAnnotation) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
this.symbolTable = symbolTable;
this.useNamedValues = useNamedValues;
this.annotation = annotation;

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -390,3 +391,4 @@ public class ByteVector {
data = newData;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
import java.io.ByteArrayOutputStream;
@ -119,6 +120,9 @@ public class ClassReader {
*/
static final int EXPAND_ASM_INSNS = 256;
/** The maximum size of array to allocate. */
private static final int MAX_BUFFER_SIZE = 1024 * 1024;
/** The size of the temporary byte array used to read class input streams chunk by chunk. */
private static final int INPUT_STREAM_DATA_CHUNK_SIZE = 4096;
@ -132,6 +136,9 @@ public class ClassReader {
// DontCheck(MemberName): can't be renamed (for backward binary compatibility).
public final byte[] b;
/** The offset in bytes of the ClassFile's access_flags field. */
public final int header;
/**
* A byte array containing the JVMS ClassFile structure to be parsed. <i>The content of this array
* must not be modified. This field is intended for {@link Attribute} sub classes, and is normally
@ -178,9 +185,6 @@ public class ClassReader {
*/
private final int maxStringLength;
/** The offset in bytes of the ClassFile's access_flags field. */
public final int header;
// -----------------------------------------------------------------------------------------------
// Constructors
// -----------------------------------------------------------------------------------------------
@ -341,13 +345,19 @@ public class ClassReader {
if (inputStream == null) {
throw new IOException("Class not found");
}
int bufferSize = calculateBufferSize(inputStream);
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
byte[] data = new byte[INPUT_STREAM_DATA_CHUNK_SIZE];
byte[] data = new byte[bufferSize];
int bytesRead;
while ((bytesRead = inputStream.read(data, 0, data.length)) != -1) {
int readCount = 0;
while ((bytesRead = inputStream.read(data, 0, bufferSize)) != -1) {
outputStream.write(data, 0, bytesRead);
readCount++;
}
outputStream.flush();
if (readCount == 1) {
return data;
}
return outputStream.toByteArray();
} finally {
if (close) {
@ -356,6 +366,20 @@ public class ClassReader {
}
}
private static int calculateBufferSize(final InputStream inputStream) throws IOException {
int expectedLength = inputStream.available();
/*
* Some implementations can return 0 while holding available data
* (e.g. new FileInputStream("/proc/a_file"))
* Also in some pathological cases a very small number might be returned,
* and in this case we use default size
*/
if (expectedLength < 256) {
return INPUT_STREAM_DATA_CHUNK_SIZE;
}
return Math.min(expectedLength, MAX_BUFFER_SIZE);
}
// -----------------------------------------------------------------------------------------------
// Accessors
// -----------------------------------------------------------------------------------------------
@ -446,7 +470,6 @@ public class ClassReader {
* @param parsingOptions the options to use to parse this class. One or more of {@link
* #SKIP_CODE}, {@link #SKIP_DEBUG}, {@link #SKIP_FRAMES} or {@link #EXPAND_FRAMES}.
*/
@SuppressWarnings("deprecation")
public void accept(
final ClassVisitor classVisitor,
final Attribute[] attributePrototypes,
@ -710,11 +733,11 @@ public class ClassReader {
// Visit the PermittedSubclasses attribute.
if (permittedSubclassesOffset != 0) {
int numberOfPermittedSubclasses = readUnsignedShort(permittedSubclassesOffset);
int currentPermittedSubclassOffset = permittedSubclassesOffset + 2;
int currentPermittedSubclassesOffset = permittedSubclassesOffset + 2;
while (numberOfPermittedSubclasses-- > 0) {
classVisitor.visitPermittedSubclassExperimental(
readClass(currentPermittedSubclassOffset, charBuffer));
currentPermittedSubclassOffset += 2;
classVisitor.visitPermittedSubclass(
readClass(currentPermittedSubclassesOffset, charBuffer));
currentPermittedSubclassesOffset += 2;
}
}
@ -3005,7 +3028,7 @@ public class ClassReader {
// Parse the array_value array.
while (numElementValuePairs-- > 0) {
currentOffset =
readElementValue(annotationVisitor, currentOffset, /* named = */ null, charBuffer);
readElementValue(annotationVisitor, currentOffset, /* elementName= */ null, charBuffer);
}
}
if (annotationVisitor != null) {
@ -3483,7 +3506,6 @@ public class ClassReader {
private int[] readBootstrapMethodsAttribute(final int maxStringLength) {
char[] charBuffer = new char[maxStringLength];
int currentAttributeOffset = getFirstAttributeOffset();
int[] currentBootstrapMethodOffsets = null;
for (int i = readUnsignedShort(currentAttributeOffset - 2); i > 0; --i) {
// Read the attribute_info's attribute_name and attribute_length fields.
String attributeName = readUTF8(currentAttributeOffset, charBuffer);
@ -3491,17 +3513,17 @@ public class ClassReader {
currentAttributeOffset += 6;
if (Constants.BOOTSTRAP_METHODS.equals(attributeName)) {
// Read the num_bootstrap_methods field and create an array of this size.
currentBootstrapMethodOffsets = new int[readUnsignedShort(currentAttributeOffset)];
int[] result = new int[readUnsignedShort(currentAttributeOffset)];
// Compute and store the offset of each 'bootstrap_methods' array field entry.
int currentBootstrapMethodOffset = currentAttributeOffset + 2;
for (int j = 0; j < currentBootstrapMethodOffsets.length; ++j) {
currentBootstrapMethodOffsets[j] = currentBootstrapMethodOffset;
for (int j = 0; j < result.length; ++j) {
result[j] = currentBootstrapMethodOffset;
// Skip the bootstrap_method_ref and num_bootstrap_arguments fields (2 bytes each),
// as well as the bootstrap_arguments array field (of size num_bootstrap_arguments * 2).
currentBootstrapMethodOffset +=
4 + readUnsignedShort(currentBootstrapMethodOffset + 2) * 2;
}
return currentBootstrapMethodOffsets;
return result;
}
currentAttributeOffset += attributeLength;
}
@ -3860,3 +3882,4 @@ public class ClassReader {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -100,3 +101,4 @@ public final class ClassTooLargeException extends IndexOutOfBoundsException {
return constantPoolCount;
}
}

@ -56,14 +56,16 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
* A visitor to visit a Java class. The methods of this class must be called in the following order:
* {@code visit} [ {@code visitSource} ] [ {@code visitModule} ][ {@code visitNestHost} ][ {@code
* visitPermittedSubclass} ][ {@code visitOuterClass} ] ( {@code visitAnnotation} | {@code
* visitTypeAnnotation} | {@code visitAttribute} )* ( {@code visitNestMember} | {@code
* visitInnerClass} | {@code visitField} | {@code visitMethod} )* {@code visitEnd}.
* visitOuterClass} ] ( {@code visitAnnotation} | {@code visitTypeAnnotation} | {@code
* visitAttribute} )* ( {@code visitNestMember} | [ {@code * visitPermittedSubclass} ] | {@code
* visitInnerClass} | {@code visitRecordComponent} | {@code visitField} | {@code visitMethod} )*
* {@code visitEnd}.
*
* @author Eric Bruneton
*/
@ -92,24 +94,20 @@ public abstract class ClassVisitor {
* Constructs a new {@link ClassVisitor}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param classVisitor the class visitor to which this visitor must delegate method calls. May be
* null.
*/
@SuppressWarnings("deprecation")
public ClassVisitor(final int api, final ClassVisitor classVisitor) {
if (api != Opcodes.ASM8
if (api != Opcodes.ASM9
&& api != Opcodes.ASM8
&& api != Opcodes.ASM7
&& api != Opcodes.ASM6
&& api != Opcodes.ASM5
&& api != Opcodes.ASM4
&& api != Opcodes.ASM9_EXPERIMENTAL) {
&& api != Opcodes.ASM4) {
throw new IllegalArgumentException("Unsupported api " + api);
}
if (api == Opcodes.ASM9_EXPERIMENTAL) {
Constants.checkAsmExperimental(this);
}
this.api = api;
this.cv = classVisitor;
}
@ -172,7 +170,7 @@ public abstract class ClassVisitor {
*/
public ModuleVisitor visitModule(final String name, final int access, final String version) {
if (api < Opcodes.ASM6) {
throw new UnsupportedOperationException("This feature requires ASM6");
throw new UnsupportedOperationException("Module requires ASM6");
}
if (cv != null) {
return cv.visitModule(name, access, version);
@ -192,7 +190,7 @@ public abstract class ClassVisitor {
*/
public void visitNestHost(final String nestHost) {
if (api < Opcodes.ASM7) {
throw new UnsupportedOperationException("This feature requires ASM7");
throw new UnsupportedOperationException("NestHost requires ASM7");
}
if (cv != null) {
cv.visitNestHost(nestHost);
@ -248,7 +246,7 @@ public abstract class ClassVisitor {
public AnnotationVisitor visitTypeAnnotation(
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
if (api < Opcodes.ASM5) {
throw new UnsupportedOperationException("This feature requires ASM5");
throw new UnsupportedOperationException("TypeAnnotation requires ASM5");
}
if (cv != null) {
return cv.visitTypeAnnotation(typeRef, typePath, descriptor, visible);
@ -278,7 +276,7 @@ public abstract class ClassVisitor {
*/
public void visitNestMember(final String nestMember) {
if (api < Opcodes.ASM7) {
throw new UnsupportedOperationException("This feature requires ASM7");
throw new UnsupportedOperationException("NestMember requires ASM7");
}
if (cv != null) {
cv.visitNestMember(nestMember);
@ -286,20 +284,17 @@ public abstract class ClassVisitor {
}
/**
* <b>Experimental, use at your own risk. This method will be renamed when it becomes stable, this
* will break existing code using it</b>. Visits a permitted subclass. A permitted subclass is one
* of the allowed subclasses of the current class.
* Visits a permitted subclasses. A permitted subclass is one of the allowed subclasses of the
* current class.
*
* @param permittedSubclass the internal name of a permitted subclass.
* @deprecated this API is experimental.
*/
@Deprecated
public void visitPermittedSubclassExperimental(final String permittedSubclass) {
if (api != Opcodes.ASM9_EXPERIMENTAL) {
throw new UnsupportedOperationException("This feature requires ASM9_EXPERIMENTAL");
public void visitPermittedSubclass(final String permittedSubclass) {
if (api < Opcodes.ASM9) {
throw new UnsupportedOperationException("PermittedSubclasses requires ASM9");
}
if (cv != null) {
cv.visitPermittedSubclassExperimental(permittedSubclass);
cv.visitPermittedSubclass(permittedSubclass);
}
}
@ -335,7 +330,7 @@ public abstract class ClassVisitor {
public RecordComponentVisitor visitRecordComponent(
final String name, final String descriptor, final String signature) {
if (api < Opcodes.ASM8) {
throw new UnsupportedOperationException("This feature requires ASM8");
throw new UnsupportedOperationException("Record requires ASM8");
}
if (cv != null) {
return cv.visitRecordComponent(name, descriptor, signature);
@ -411,3 +406,4 @@ public abstract class ClassVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -110,7 +111,7 @@ public class ClassWriter extends ClassVisitor {
/**
* The access_flags field of the JVMS ClassFile structure. This field can contain ASM specific
* access flags, such as {@link Opcodes#ACC_DEPRECATED} or {}@link Opcodes#ACC_RECORD}, which are
* access flags, such as {@link Opcodes#ACC_DEPRECATED} or {@link Opcodes#ACC_RECORD}, which are
* removed when generating the ClassFile structure.
*/
private int accessFlags;
@ -209,10 +210,10 @@ public class ClassWriter extends ClassVisitor {
private ByteVector nestMemberClasses;
/** The number_of_classes field of the PermittedSubclasses attribute, or 0. */
private int numberOfPermittedSubclassClasses;
private int numberOfPermittedSubclasses;
/** The 'classes' array of the PermittedSubclasses attribute, or {@literal null}. */
private ByteVector permittedSubclassClasses;
private ByteVector permittedSubclasses;
/**
* The record components of this class, stored in a linked list of {@link RecordComponentWriter}
@ -285,7 +286,7 @@ public class ClassWriter extends ClassVisitor {
* maximum stack size nor the stack frames will be computed for these methods</i>.
*/
public ClassWriter(final ClassReader classReader, final int flags) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
symbolTable = classReader == null ? new SymbolTable(this) : new SymbolTable(this, classReader);
if ((flags & COMPUTE_FRAMES) != 0) {
this.compute = MethodWriter.COMPUTE_ALL_FRAMES;
@ -403,20 +404,13 @@ public class ClassWriter extends ClassVisitor {
nestMemberClasses.putShort(symbolTable.addConstantClass(nestMember).index);
}
/**
* <b>Experimental, use at your own risk.</b>
*
* @param permittedSubclass the internal name of a permitted subclass.
* @deprecated this API is experimental.
*/
@Override
@Deprecated
public final void visitPermittedSubclassExperimental(final String permittedSubclass) {
if (permittedSubclassClasses == null) {
permittedSubclassClasses = new ByteVector();
public final void visitPermittedSubclass(final String permittedSubclass) {
if (permittedSubclasses == null) {
permittedSubclasses = new ByteVector();
}
++numberOfPermittedSubclassClasses;
permittedSubclassClasses.putShort(symbolTable.addConstantClass(permittedSubclass).index);
++numberOfPermittedSubclasses;
permittedSubclasses.putShort(symbolTable.addConstantClass(permittedSubclass).index);
}
@Override
@ -607,9 +601,9 @@ public class ClassWriter extends ClassVisitor {
size += 8 + nestMemberClasses.length;
symbolTable.addConstantUtf8(Constants.NEST_MEMBERS);
}
if (permittedSubclassClasses != null) {
if (permittedSubclasses != null) {
++attributesCount;
size += 8 + permittedSubclassClasses.length;
size += 8 + permittedSubclasses.length;
symbolTable.addConstantUtf8(Constants.PERMITTED_SUBCLASSES);
}
int recordComponentCount = 0;
@ -729,12 +723,12 @@ public class ClassWriter extends ClassVisitor {
.putShort(numberOfNestMemberClasses)
.putByteArray(nestMemberClasses.data, 0, nestMemberClasses.length);
}
if (permittedSubclassClasses != null) {
if (permittedSubclasses != null) {
result
.putShort(symbolTable.addConstantUtf8(Constants.PERMITTED_SUBCLASSES))
.putInt(permittedSubclassClasses.length + 2)
.putShort(numberOfPermittedSubclassClasses)
.putByteArray(permittedSubclassClasses.data, 0, permittedSubclassClasses.length);
.putInt(permittedSubclasses.length + 2)
.putShort(numberOfPermittedSubclasses)
.putByteArray(permittedSubclasses.data, 0, permittedSubclasses.length);
}
if ((accessFlags & Opcodes.ACC_RECORD) != 0 || firstRecordComponent != null) {
result
@ -783,8 +777,8 @@ public class ClassWriter extends ClassVisitor {
nestHostClassIndex = 0;
numberOfNestMemberClasses = 0;
nestMemberClasses = null;
numberOfPermittedSubclassClasses = 0;
permittedSubclassClasses = null;
numberOfPermittedSubclasses = 0;
permittedSubclasses = null;
firstRecordComponent = null;
lastRecordComponent = null;
firstAttribute = null;
@ -1089,3 +1083,4 @@ public class ClassWriter extends ClassVisitor {
return getClass().getClassLoader();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
import java.util.Arrays;
@ -207,3 +208,4 @@ public final class ConstantDynamic {
+ Arrays.toString(bootstrapMethodArguments);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
import java.io.DataInputStream;
@ -250,3 +251,4 @@ final class Constants {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -165,3 +166,4 @@ final class Context {
*/
Object[] currentFrameStackTypes;
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -84,3 +85,4 @@ final class CurrentFrame extends Frame {
copyFrom(successor);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -120,3 +121,4 @@ final class Edge {
this.nextEdge = nextEdge;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -69,8 +70,8 @@ public abstract class FieldVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
protected final int api;
@ -81,8 +82,8 @@ public abstract class FieldVisitor {
* Constructs a new {@link FieldVisitor}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
public FieldVisitor(final int api) {
this(api, null);
@ -97,19 +98,15 @@ public abstract class FieldVisitor {
* @param fieldVisitor the field visitor to which this visitor must delegate method calls. May be
* null.
*/
@SuppressWarnings("deprecation")
public FieldVisitor(final int api, final FieldVisitor fieldVisitor) {
if (api != Opcodes.ASM8
if (api != Opcodes.ASM9
&& api != Opcodes.ASM8
&& api != Opcodes.ASM7
&& api != Opcodes.ASM6
&& api != Opcodes.ASM5
&& api != Opcodes.ASM4
&& api != Opcodes.ASM9_EXPERIMENTAL) {
&& api != Opcodes.ASM4) {
throw new IllegalArgumentException("Unsupported api " + api);
}
if (api == Opcodes.ASM9_EXPERIMENTAL) {
Constants.checkAsmExperimental(this);
}
this.api = api;
this.fv = fieldVisitor;
}
@ -174,3 +171,4 @@ public abstract class FieldVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -155,7 +156,7 @@ final class FieldWriter extends FieldVisitor {
final String descriptor,
final String signature,
final Object constantValue) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
this.symbolTable = symbolTable;
this.accessFlags = access;
this.nameIndex = symbolTable.addConstantUtf8(name);
@ -313,3 +314,4 @@ final class FieldWriter extends FieldVisitor {
attributePrototypes.addAttributes(firstAttribute);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -1502,3 +1503,4 @@ class Frame {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -217,3 +218,4 @@ public final class Handle {
return owner + '.' + name + descriptor + " (" + tag + (isInterface ? " itf" : "") + ')';
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -227,3 +228,4 @@ final class Handler {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -651,3 +652,4 @@ public class Label {
return "L" + System.identityHashCode(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -128,3 +129,4 @@ public final class MethodTooLargeException extends IndexOutOfBoundsException {
return codeSize;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -110,19 +111,15 @@ public abstract class MethodVisitor {
* @param methodVisitor the method visitor to which this visitor must delegate method calls. May
* be null.
*/
@SuppressWarnings("deprecation")
public MethodVisitor(final int api, final MethodVisitor methodVisitor) {
if (api != Opcodes.ASM8
if (api != Opcodes.ASM9
&& api != Opcodes.ASM8
&& api != Opcodes.ASM7
&& api != Opcodes.ASM6
&& api != Opcodes.ASM5
&& api != Opcodes.ASM4
&& api != Opcodes.ASM9_EXPERIMENTAL) {
&& api != Opcodes.ASM4) {
throw new IllegalArgumentException("Unsupported api " + api);
}
if (api == Opcodes.ASM9_EXPERIMENTAL) {
Constants.checkAsmExperimental(this);
}
this.api = api;
this.mv = methodVisitor;
}
@ -815,3 +812,4 @@ public abstract class MethodVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -623,7 +624,7 @@ final class MethodWriter extends MethodVisitor {
final String signature,
final String[] exceptions,
final int compute) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
this.symbolTable = symbolTable;
this.accessFlags = "<init>".equals(name) ? access | Constants.ACC_CONSTRUCTOR : access;
this.nameIndex = symbolTable.addConstantUtf8(name);
@ -2422,3 +2423,4 @@ final class MethodWriter extends MethodVisitor {
attributePrototypes.addAttributes(firstCodeAttribute);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -96,19 +97,15 @@ public abstract class ModuleVisitor {
* @param moduleVisitor the module visitor to which this visitor must delegate method calls. May
* be null.
*/
@SuppressWarnings("deprecation")
public ModuleVisitor(final int api, final ModuleVisitor moduleVisitor) {
if (api != Opcodes.ASM8
if (api != Opcodes.ASM9
&& api != Opcodes.ASM8
&& api != Opcodes.ASM7
&& api != Opcodes.ASM6
&& api != Opcodes.ASM5
&& api != Opcodes.ASM4
&& api != Opcodes.ASM9_EXPERIMENTAL) {
&& api != Opcodes.ASM4) {
throw new IllegalArgumentException("Unsupported api " + api);
}
if (api == Opcodes.ASM9_EXPERIMENTAL) {
Constants.checkAsmExperimental(this);
}
this.api = api;
this.mv = moduleVisitor;
}
@ -214,3 +211,4 @@ public abstract class ModuleVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -125,7 +126,7 @@ final class ModuleWriter extends ModuleVisitor {
private int mainClassIndex;
ModuleWriter(final SymbolTable symbolTable, final int name, final int access, final int version) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
this.symbolTable = symbolTable;
this.moduleNameIndex = name;
this.moduleFlags = access;
@ -282,3 +283,4 @@ final class ModuleWriter extends ModuleVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -79,14 +80,7 @@ public interface Opcodes {
int ASM6 = 6 << 16 | 0 << 8;
int ASM7 = 7 << 16 | 0 << 8;
int ASM8 = 8 << 16 | 0 << 8;
/**
* <i>Experimental, use at your own risk. This field will be renamed when it becomes stable, this
* will break existing code using it. Only code compiled with --enable-preview can use this.</i>
*
* @deprecated This API is experimental.
*/
@Deprecated int ASM9_EXPERIMENTAL = 1 << 24 | 9 << 16 | 0 << 8;
int ASM9 = 9 << 16 | 0 << 8;
/*
* Internal flags used to redirect calls to deprecated methods. For instance, if a visitOldStuff
@ -163,7 +157,7 @@ public interface Opcodes {
* <pre>
* public class StuffVisitor {
* &#64;Deprecated public void visitOldStuff(int arg, ...) {
* visitNewStuf(arg | SOURCE_DEPRECATED, ...);
* visitNewStuff(arg | SOURCE_DEPRECATED, ...);
* }
* public void visitNewStuff(int argAndSource...) {
* if ((argAndSource & SOURCE_DEPRECATED) == 0) {
@ -185,7 +179,7 @@ public interface Opcodes {
* <p>and there are two cases:
*
* <ul>
* <li>call visitOldSuff: in the call to super.visitOldStuff, the source is set to
* <li>call visitOldStuff: in the call to super.visitOldStuff, the source is set to
* SOURCE_DEPRECATED and visitNewStuff is called. Here 'do stuff' is run because the source
* was previously set to SOURCE_DEPRECATED, and execution eventually returns to
* UserStuffVisitor.visitOldStuff, where 'do user stuff' is run.
@ -590,3 +584,4 @@ public interface Opcodes {
int IFNULL = 198; // visitJumpInsn
int IFNONNULL = 199; // -
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -68,8 +69,8 @@ package jdk.internal.org.objectweb.asm;
*/
public abstract class RecordComponentVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field must be {@link
* Opcodes#ASM8}.
* The ASM API version implemented by this visitor. The value of this field must be one of {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
protected final int api;
@ -81,7 +82,8 @@ public abstract class RecordComponentVisitor {
/**
* Constructs a new {@link RecordComponentVisitor}.
*
* @param api the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM8}.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM8}
* or {@link Opcodes#ASM9}.
*/
public RecordComponentVisitor(final int api) {
this(api, null);
@ -94,20 +96,16 @@ public abstract class RecordComponentVisitor {
* @param recordComponentVisitor the record component visitor to which this visitor must delegate
* method calls. May be null.
*/
@SuppressWarnings("deprecation")
public RecordComponentVisitor(
final int api, final RecordComponentVisitor recordComponentVisitor) {
if (api != Opcodes.ASM8
if (api != Opcodes.ASM9
&& api != Opcodes.ASM8
&& api != Opcodes.ASM7
&& api != Opcodes.ASM6
&& api != Opcodes.ASM5
&& api != Opcodes.ASM4
&& api != Opcodes.ASM9_EXPERIMENTAL) {
&& api != Opcodes.ASM4) {
throw new IllegalArgumentException("Unsupported api " + api);
}
if (api == Opcodes.ASM9_EXPERIMENTAL) {
Constants.checkAsmExperimental(this);
}
this.api = api;
this.delegate = recordComponentVisitor;
}
@ -180,3 +178,4 @@ public abstract class RecordComponentVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
final class RecordComponentWriter extends RecordComponentVisitor {
@ -125,7 +126,7 @@ final class RecordComponentWriter extends RecordComponentVisitor {
final String name,
final String descriptor,
final String signature) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
this.symbolTable = symbolTable;
this.nameIndex = symbolTable.addConstantUtf8(name);
this.descriptorIndex = symbolTable.addConstantUtf8(descriptor);
@ -254,3 +255,4 @@ final class RecordComponentWriter extends RecordComponentVisitor {
attributePrototypes.addAttributes(firstAttribute);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -272,3 +273,4 @@ abstract class Symbol {
return info;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -1351,3 +1352,4 @@ final class SymbolTable {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
import java.lang.reflect.Constructor;
@ -924,3 +925,4 @@ public final class Type {
return getDescriptor();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -229,3 +230,4 @@ public final class TypePath {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm;
/**
@ -464,3 +465,4 @@ public class TypeReference {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.ArrayList;
@ -185,10 +186,12 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
throw new IllegalArgumentException("Invalid return in constructor");
case RETURN: // empty stack
onMethodExit(opcode);
endConstructorBasicBlockWithoutSuccessor();
break;
case ATHROW: // 1 before n/a after
popValue();
onMethodExit(opcode);
endConstructorBasicBlockWithoutSuccessor();
break;
case NOP:
case LALOAD: // remove 2 add 2
@ -383,6 +386,7 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
popValue();
break;
case RET:
endConstructorBasicBlockWithoutSuccessor();
break;
default:
throw new IllegalArgumentException(INVALID_OPCODE + opcode);
@ -484,10 +488,10 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
super.visitMethodInsn(opcodeAndSource, owner, name, descriptor, isInterface);
int opcode = opcodeAndSource & ~Opcodes.SOURCE_MASK;
doVisitMethodInsn(opcode, descriptor);
doVisitMethodInsn(opcode, name, descriptor);
}
private void doVisitMethodInsn(final int opcode, final String descriptor) {
private void doVisitMethodInsn(final int opcode, final String name, final String descriptor) {
if (isConstructor && !superClassConstructorCalled) {
for (Type argumentType : Type.getArgumentTypes(descriptor)) {
popValue();
@ -502,7 +506,9 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
break;
case INVOKESPECIAL:
Object value = popValue();
if (value == UNINITIALIZED_THIS && !superClassConstructorCalled) {
if (value == UNINITIALIZED_THIS
&& !superClassConstructorCalled
&& name.equals("<init>")) {
superClassConstructorCalled = true;
onMethodEnter();
}
@ -528,7 +534,7 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
final Handle bootstrapMethodHandle,
final Object... bootstrapMethodArguments) {
super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments);
doVisitMethodInsn(Opcodes.INVOKEDYNAMIC, descriptor);
doVisitMethodInsn(Opcodes.INVOKEDYNAMIC, name, descriptor);
}
@Override
@ -560,6 +566,9 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
case JSR:
pushValue(OTHER);
break;
case GOTO:
endConstructorBasicBlockWithoutSuccessor();
break;
default:
break;
}
@ -573,6 +582,7 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
if (isConstructor && !superClassConstructorCalled) {
popValue();
addForwardJumps(dflt, labels);
endConstructorBasicBlockWithoutSuccessor();
}
}
@ -583,6 +593,7 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
if (isConstructor && !superClassConstructorCalled) {
popValue();
addForwardJumps(dflt, labels);
endConstructorBasicBlockWithoutSuccessor();
}
}
@ -619,6 +630,19 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
forwardJumpStackFrames.put(label, new ArrayList<>(stackFrame));
}
private void endConstructorBasicBlockWithoutSuccessor() {
// The next instruction is not reachable from this instruction. If it is dead code, we
// should not try to simulate stack operations, and there is no need to insert advices
// here. If it is reachable with a backward jump, the only possible case is that the super
// class constructor has already been called (backward jumps are forbidden before it is
// called). If it is reachable with a forward jump, there are two sub-cases. Either the
// super class constructor has already been called when reaching the next instruction, or
// it has not been called. But in this case there must be a forwardJumpStackFrames entry
// for a Label designating the next instruction, and superClassConstructorCalled will be
// reset to false there. We can therefore always reset this field to true here.
superClassConstructorCalled = true;
}
private Object popValue() {
return stackFrame.remove(stackFrame.size() - 1);
}
@ -676,3 +700,4 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
*/
protected void onMethodExit(final int opcode) {}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.ArrayList;
@ -147,7 +148,7 @@ public class AnalyzerAdapter extends MethodVisitor {
final String name,
final String descriptor,
final MethodVisitor methodVisitor) {
this(/* latest api = */ Opcodes.ASM8, owner, access, name, descriptor, methodVisitor);
this(/* latest api = */ Opcodes.ASM9, owner, access, name, descriptor, methodVisitor);
if (getClass() != AnalyzerAdapter.class) {
throw new IllegalStateException();
}
@ -157,8 +158,8 @@ public class AnalyzerAdapter extends MethodVisitor {
* Constructs a new {@link AnalyzerAdapter}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param owner the owner's class name.
* @param access the method's access flags (see {@link Opcodes}).
* @param name the method's name.
@ -938,3 +939,4 @@ public class AnalyzerAdapter extends MethodVisitor {
labels = null;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@ -68,6 +69,12 @@ import jdk.internal.org.objectweb.asm.Opcodes;
*/
public class AnnotationRemapper extends AnnotationVisitor {
/**
* The descriptor of the visited annotation. May be {@literal null}, for instance for
* AnnotationDefault.
*/
protected final String descriptor;
/** The remapper used to remap the types in the visited annotation. */
protected final Remapper remapper;
@ -75,11 +82,27 @@ public class AnnotationRemapper extends AnnotationVisitor {
* Constructs a new {@link AnnotationRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #AnnotationRemapper(int,AnnotationVisitor,Remapper)} version.
*
* @param annotationVisitor the annotation visitor this remapper must deleted to.
* @param annotationVisitor the annotation visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited annotation.
* @deprecated use {@link #AnnotationRemapper(String, AnnotationVisitor, Remapper)} instead.
*/
@Deprecated
public AnnotationRemapper(final AnnotationVisitor annotationVisitor, final Remapper remapper) {
this(/* descriptor = */ null, annotationVisitor, remapper);
}
/**
* Constructs a new {@link AnnotationRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #AnnotationRemapper(int,String,AnnotationVisitor,Remapper)}
* version.
*
* @param descriptor the descriptor of the visited annotation. May be {@literal null}.
* @param annotationVisitor the annotation visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited annotation.
*/
public AnnotationRemapper(final AnnotationVisitor annotationVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM8, annotationVisitor, remapper);
public AnnotationRemapper(
final String descriptor, final AnnotationVisitor annotationVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM9, descriptor, annotationVisitor, remapper);
}
/**
@ -87,44 +110,71 @@ public class AnnotationRemapper extends AnnotationVisitor {
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7} or {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8}
* @param annotationVisitor the annotation visitor this remapper must deleted to.
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8} or {@link jdk.internal.org.objectweb.asm.Opcodes#ASM9}.
* @param annotationVisitor the annotation visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited annotation.
* @deprecated use {@link #AnnotationRemapper(int, String, AnnotationVisitor, Remapper)} instead.
*/
@Deprecated
protected AnnotationRemapper(
final int api, final AnnotationVisitor annotationVisitor, final Remapper remapper) {
this(api, /* descriptor = */ null, annotationVisitor, remapper);
}
/**
* Constructs a new {@link AnnotationRemapper}.
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8} or {@link jdk.internal.org.objectweb.asm.Opcodes#ASM9}.
* @param descriptor the descriptor of the visited annotation. May be {@literal null}.
* @param annotationVisitor the annotation visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited annotation.
*/
protected AnnotationRemapper(
final int api, final AnnotationVisitor annotationVisitor, final Remapper remapper) {
final int api,
final String descriptor,
final AnnotationVisitor annotationVisitor,
final Remapper remapper) {
super(api, annotationVisitor);
this.descriptor = descriptor;
this.remapper = remapper;
}
@Override
public void visit(final String name, final Object value) {
super.visit(name, remapper.mapValue(value));
super.visit(mapAnnotationAttributeName(name), remapper.mapValue(value));
}
@Override
public void visitEnum(final String name, final String descriptor, final String value) {
super.visitEnum(name, remapper.mapDesc(descriptor), value);
super.visitEnum(mapAnnotationAttributeName(name), remapper.mapDesc(descriptor), value);
}
@Override
public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
AnnotationVisitor annotationVisitor = super.visitAnnotation(name, remapper.mapDesc(descriptor));
AnnotationVisitor annotationVisitor =
super.visitAnnotation(mapAnnotationAttributeName(name), remapper.mapDesc(descriptor));
if (annotationVisitor == null) {
return null;
} else {
return annotationVisitor == av ? this : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == av
? this
: createAnnotationRemapper(descriptor, annotationVisitor);
}
}
@Override
public AnnotationVisitor visitArray(final String name) {
AnnotationVisitor annotationVisitor = super.visitArray(name);
AnnotationVisitor annotationVisitor = super.visitArray(mapAnnotationAttributeName(name));
if (annotationVisitor == null) {
return null;
} else {
return annotationVisitor == av ? this : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == av
? this
: createAnnotationRemapper(/* descriptor = */ null, annotationVisitor);
}
}
@ -134,8 +184,63 @@ public class AnnotationRemapper extends AnnotationVisitor {
*
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
* @deprecated use {@link #createAnnotationRemapper(String, AnnotationVisitor)} instead.
*/
@Deprecated
protected AnnotationVisitor createAnnotationRemapper(final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, annotationVisitor, remapper);
return new AnnotationRemapper(api, /* descriptor = */ null, annotationVisitor, remapper);
}
/**
* Constructs a new remapper for annotations. The default implementation of this method returns a
* new {@link AnnotationRemapper}.
*
* @param descriptor the descriptor of the visited annotation.
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
*/
protected AnnotationVisitor createAnnotationRemapper(
final String descriptor, final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, descriptor, annotationVisitor, remapper)
.orDeprecatedValue(createAnnotationRemapper(annotationVisitor));
}
/**
* Returns either this object, or the given one. If the given object is equal to the object
* returned by the default implementation of the deprecated createAnnotationRemapper method,
* meaning that this method has not been overridden (or only in minor ways, for instance to add
* logging), then we can return this object instead, supposed to have been created by the new
* createAnnotationRemapper method. Otherwise we must return the given object.
*
* @param deprecatedAnnotationVisitor the result of a call to the deprecated
* createAnnotationRemapper method.
* @return either this object, or the given one.
*/
final AnnotationVisitor orDeprecatedValue(final AnnotationVisitor deprecatedAnnotationVisitor) {
if (deprecatedAnnotationVisitor.getClass() == getClass()) {
AnnotationRemapper deprecatedAnnotationRemapper =
(AnnotationRemapper) deprecatedAnnotationVisitor;
if (deprecatedAnnotationRemapper.api == api
&& deprecatedAnnotationRemapper.av == av
&& deprecatedAnnotationRemapper.remapper == remapper) {
return this;
}
}
return deprecatedAnnotationVisitor;
}
/**
* Maps an annotation attribute name with the remapper. Returns the original name unchanged if the
* internal name of the annotation is {@literal null}.
*
* @param name the name of the annotation attribute.
* @return the new name of the annotation attribute.
*/
private String mapAnnotationAttributeName(final String name) {
if (descriptor == null) {
return name;
}
return remapper.mapAnnotationAttributeName(descriptor, name);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.List;
@ -100,11 +101,11 @@ public class ClassRemapper extends ClassVisitor {
* Constructs a new {@link ClassRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #ClassRemapper(int,ClassVisitor,Remapper)} version.
*
* @param classVisitor the class visitor this remapper must deleted to.
* @param classVisitor the class visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited class.
*/
public ClassRemapper(final ClassVisitor classVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM8, classVisitor, remapper);
this(/* latest api = */ Opcodes.ASM9, classVisitor, remapper);
}
/**
@ -112,9 +113,9 @@ public class ClassRemapper extends ClassVisitor {
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7} or {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8}.
* @param classVisitor the class visitor this remapper must deleted to.
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8} or {@link jdk.internal.org.objectweb.asm.Opcodes#ASM9}.
* @param classVisitor the class visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited class.
*/
protected ClassRemapper(final int api, final ClassVisitor classVisitor, final Remapper remapper) {
@ -150,7 +151,9 @@ public class ClassRemapper extends ClassVisitor {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitAnnotation(remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == null
? null
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -158,7 +161,9 @@ public class ClassRemapper extends ClassVisitor {
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == null
? null
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -249,16 +254,9 @@ public class ClassRemapper extends ClassVisitor {
super.visitNestMember(remapper.mapType(nestMember));
}
/**
* <b>Experimental, use at your own risk.</b>.
*
* @param permittedSubclass the internal name of a permitted subclass.
* @deprecated this API is experimental.
*/
@Override
@Deprecated
public void visitPermittedSubclassExperimental(final String permittedSubclass) {
super.visitPermittedSubclassExperimental(remapper.mapType(permittedSubclass));
public void visitPermittedSubclass(final String permittedSubclass) {
super.visitPermittedSubclass(remapper.mapType(permittedSubclass));
}
/**
@ -289,9 +287,25 @@ public class ClassRemapper extends ClassVisitor {
*
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
* @deprecated use {@link #createAnnotationRemapper(String, AnnotationVisitor)} instead.
*/
@Deprecated
protected AnnotationVisitor createAnnotationRemapper(final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, annotationVisitor, remapper);
return new AnnotationRemapper(api, /* descriptor = */ null, annotationVisitor, remapper);
}
/**
* Constructs a new remapper for annotations. The default implementation of this method returns a
* new {@link AnnotationRemapper}.
*
* @param descriptor the descriptor of the visited annotation.
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
*/
protected AnnotationVisitor createAnnotationRemapper(
final String descriptor, final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, descriptor, annotationVisitor, remapper)
.orDeprecatedValue(createAnnotationRemapper(annotationVisitor));
}
/**
@ -317,3 +331,4 @@ public class ClassRemapper extends ClassVisitor {
return new RecordComponentRemapper(api, recordComponentVisitor, remapper);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.ConstantDynamic;
@ -78,7 +79,7 @@ public class CodeSizeEvaluator extends MethodVisitor implements Opcodes {
private int maxSize;
public CodeSizeEvaluator(final MethodVisitor methodVisitor) {
this(/* latest api = */ Opcodes.ASM8, methodVisitor);
this(/* latest api = */ Opcodes.ASM9, methodVisitor);
}
protected CodeSizeEvaluator(final int api, final MethodVisitor methodVisitor) {
@ -236,3 +237,4 @@ public class CodeSizeEvaluator extends MethodVisitor implements Opcodes {
super.visitMultiANewArrayInsn(descriptor, numDimensions);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@ -77,20 +78,20 @@ public class FieldRemapper extends FieldVisitor {
* Constructs a new {@link FieldRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #FieldRemapper(int,FieldVisitor,Remapper)} version.
*
* @param fieldVisitor the field visitor this remapper must deleted to.
* @param fieldVisitor the field visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited field.
*/
public FieldRemapper(final FieldVisitor fieldVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM8, fieldVisitor, remapper);
this(/* latest api = */ Opcodes.ASM9, fieldVisitor, remapper);
}
/**
* Constructs a new {@link FieldRemapper}.
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link Opcodes#ASM8}.
* @param fieldVisitor the field visitor this remapper must deleted to.
* @param api the ASM API version supported by this remapper. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link Opcodes#ASM8}, or
* {@link Opcodes#ASM9}.
* @param fieldVisitor the field visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited field.
*/
protected FieldRemapper(final int api, final FieldVisitor fieldVisitor, final Remapper remapper) {
@ -102,7 +103,9 @@ public class FieldRemapper extends FieldVisitor {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitAnnotation(remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == null
? null
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -110,7 +113,9 @@ public class FieldRemapper extends FieldVisitor {
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == null
? null
: createAnnotationRemapper(descriptor, annotationVisitor);
}
/**
@ -119,8 +124,25 @@ public class FieldRemapper extends FieldVisitor {
*
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
* @deprecated use {@link #createAnnotationRemapper(String, AnnotationVisitor)} instead.
*/
@Deprecated
protected AnnotationVisitor createAnnotationRemapper(final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, annotationVisitor, remapper);
return new AnnotationRemapper(api, /* descriptor = */ null, annotationVisitor, remapper);
}
/**
* Constructs a new remapper for annotations. The default implementation of this method returns a
* new {@link AnnotationRemapper}.
*
* @param descriptor the descriptor of the visited annotation.
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
*/
protected AnnotationVisitor createAnnotationRemapper(
final String descriptor, final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, descriptor, annotationVisitor, remapper)
.orDeprecatedValue(createAnnotationRemapper(annotationVisitor));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.ArrayList;
@ -232,7 +233,7 @@ public class GeneratorAdapter extends LocalVariablesSorter {
final int access,
final String name,
final String descriptor) {
this(/* latest api = */ Opcodes.ASM8, methodVisitor, access, name, descriptor);
this(/* latest api = */ Opcodes.ASM9, methodVisitor, access, name, descriptor);
if (getClass() != GeneratorAdapter.class) {
throw new IllegalStateException();
}
@ -242,8 +243,8 @@ public class GeneratorAdapter extends LocalVariablesSorter {
* Constructs a new {@link GeneratorAdapter}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param methodVisitor the method visitor to which this adapter delegates calls.
* @param access the method's access flags (see {@link Opcodes}).
* @param name the method's name.
@ -1398,3 +1399,4 @@ public class GeneratorAdapter extends LocalVariablesSorter {
mark(catchLabel);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.ConstantDynamic;
@ -83,7 +84,7 @@ public class InstructionAdapter extends MethodVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public InstructionAdapter(final MethodVisitor methodVisitor) {
this(/* latest api = */ Opcodes.ASM8, methodVisitor);
this(/* latest api = */ Opcodes.ASM9, methodVisitor);
if (getClass() != InstructionAdapter.class) {
throw new IllegalStateException();
}
@ -93,8 +94,8 @@ public class InstructionAdapter extends MethodVisitor {
* Constructs a new {@link InstructionAdapter}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param methodVisitor the method visitor to which this adapter delegates calls.
*/
protected InstructionAdapter(final int api, final MethodVisitor methodVisitor) {
@ -1121,7 +1122,7 @@ public class InstructionAdapter extends MethodVisitor {
final String owner, final String name, final String descriptor, final boolean isInterface) {
if (api < Opcodes.ASM5) {
if (isInterface) {
throw new IllegalArgumentException("INVOKEVIRTUAL on interfaces require ASM 5");
throw new UnsupportedOperationException("INVOKEVIRTUAL on interfaces require ASM 5");
}
invokevirtual(owner, name, descriptor);
return;
@ -1159,7 +1160,7 @@ public class InstructionAdapter extends MethodVisitor {
final String owner, final String name, final String descriptor, final boolean isInterface) {
if (api < Opcodes.ASM5) {
if (isInterface) {
throw new IllegalArgumentException("INVOKESPECIAL on interfaces require ASM 5");
throw new UnsupportedOperationException("INVOKESPECIAL on interfaces require ASM 5");
}
invokespecial(owner, name, descriptor);
return;
@ -1197,7 +1198,7 @@ public class InstructionAdapter extends MethodVisitor {
final String owner, final String name, final String descriptor, final boolean isInterface) {
if (api < Opcodes.ASM5) {
if (isInterface) {
throw new IllegalArgumentException("INVOKESTATIC on interfaces require ASM 5");
throw new UnsupportedOperationException("INVOKESTATIC on interfaces require ASM 5");
}
invokestatic(owner, name, descriptor);
return;
@ -1329,3 +1330,4 @@ public class InstructionAdapter extends MethodVisitor {
mv.visitLabel(label);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.AbstractMap;
@ -130,7 +131,7 @@ public class JSRInlinerAdapter extends MethodNode implements Opcodes {
final String signature,
final String[] exceptions) {
this(
/* latest api = */ Opcodes.ASM8,
/* latest api = */ Opcodes.ASM9,
methodVisitor,
access,
name,
@ -146,8 +147,8 @@ public class JSRInlinerAdapter extends MethodNode implements Opcodes {
* Constructs a new {@link JSRInlinerAdapter}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param methodVisitor the method visitor to send the resulting inlined method code to, or <code>
* null</code>.
* @param access the method's access flags (see {@link Opcodes}). This parameter also indicates if
@ -600,3 +601,4 @@ public class JSRInlinerAdapter extends MethodNode implements Opcodes {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@ -112,7 +113,7 @@ public class LocalVariablesSorter extends MethodVisitor {
*/
public LocalVariablesSorter(
final int access, final String descriptor, final MethodVisitor methodVisitor) {
this(/* latest api = */ Opcodes.ASM8, access, descriptor, methodVisitor);
this(/* latest api = */ Opcodes.ASM9, access, descriptor, methodVisitor);
if (getClass() != LocalVariablesSorter.class) {
throw new IllegalStateException();
}
@ -122,8 +123,8 @@ public class LocalVariablesSorter extends MethodVisitor {
* Constructs a new {@link LocalVariablesSorter}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param access access flags of the adapted method.
* @param descriptor the method's descriptor (see {@link Type}).
* @param methodVisitor the method visitor to which this adapter delegates calls.
@ -381,3 +382,4 @@ public class LocalVariablesSorter extends MethodVisitor {
return local;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.HashMap;
@ -291,3 +292,4 @@ public class Method {
return name.hashCode() ^ descriptor.hashCode();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@ -79,21 +80,21 @@ public class MethodRemapper extends MethodVisitor {
* Constructs a new {@link MethodRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #MethodRemapper(int,MethodVisitor,Remapper)} version.
*
* @param methodVisitor the method visitor this remapper must deleted to.
* @param methodVisitor the method visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited method.
*/
public MethodRemapper(final MethodVisitor methodVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM8, methodVisitor, remapper);
this(/* latest api = */ Opcodes.ASM9, methodVisitor, remapper);
}
/**
* Constructs a new {@link MethodRemapper}.
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5} or {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7} or {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8}.
* @param methodVisitor the method visitor this remapper must deleted to.
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8} or {@link jdk.internal.org.objectweb.asm.Opcodes#ASM9}.
* @param methodVisitor the method visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited method.
*/
protected MethodRemapper(
@ -107,7 +108,7 @@ public class MethodRemapper extends MethodVisitor {
AnnotationVisitor annotationVisitor = super.visitAnnotationDefault();
return annotationVisitor == null
? annotationVisitor
: createAnnotationRemapper(annotationVisitor);
: createAnnotationRemapper(/* descriptor = */ null, annotationVisitor);
}
@Override
@ -116,7 +117,7 @@ public class MethodRemapper extends MethodVisitor {
super.visitAnnotation(remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: createAnnotationRemapper(annotationVisitor);
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -126,7 +127,7 @@ public class MethodRemapper extends MethodVisitor {
super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: createAnnotationRemapper(annotationVisitor);
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -136,7 +137,7 @@ public class MethodRemapper extends MethodVisitor {
super.visitParameterAnnotation(parameter, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: createAnnotationRemapper(annotationVisitor);
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -240,7 +241,7 @@ public class MethodRemapper extends MethodVisitor {
super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: createAnnotationRemapper(annotationVisitor);
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -256,7 +257,7 @@ public class MethodRemapper extends MethodVisitor {
super.visitTryCatchAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: createAnnotationRemapper(annotationVisitor);
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -290,7 +291,7 @@ public class MethodRemapper extends MethodVisitor {
typeRef, typePath, start, end, index, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: createAnnotationRemapper(annotationVisitor);
: createAnnotationRemapper(descriptor, annotationVisitor);
}
/**
@ -299,8 +300,25 @@ public class MethodRemapper extends MethodVisitor {
*
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
* @deprecated use {@link #createAnnotationRemapper(String, AnnotationVisitor)} instead.
*/
@Deprecated
protected AnnotationVisitor createAnnotationRemapper(final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, annotationVisitor, remapper);
return new AnnotationRemapper(api, /* descriptor = */ null, annotationVisitor, remapper);
}
/**
* Constructs a new remapper for annotations. The default implementation of this method returns a
* new {@link AnnotationRemapper}.
*
* @param descriptor the descriptor of the visited annotation.
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
*/
protected AnnotationVisitor createAnnotationRemapper(
final String descriptor, final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, descriptor, annotationVisitor, remapper)
.orDeprecatedValue(createAnnotationRemapper(annotationVisitor));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.ArrayList;
@ -133,7 +134,7 @@ public final class ModuleHashesAttribute extends Attribute {
currentOffset += 2;
byte[] hash = new byte[hashLength];
for (int j = 0; j < hashLength; ++j) {
hash[j] = (byte) (classReader.readByte(currentOffset) & 0xFF);
hash[j] = (byte) classReader.readByte(currentOffset);
currentOffset += 1;
}
hashList.add(hash);
@ -167,3 +168,4 @@ public final class ModuleHashesAttribute extends Attribute {
return byteVector;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.ModuleVisitor;
@ -75,11 +76,11 @@ public class ModuleRemapper extends ModuleVisitor {
* Constructs a new {@link ModuleRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #ModuleRemapper(int,ModuleVisitor,Remapper)} version.
*
* @param moduleVisitor the module visitor this remapper must deleted to.
* @param moduleVisitor the module visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited module.
*/
public ModuleRemapper(final ModuleVisitor moduleVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM8, moduleVisitor, remapper);
this(/* latest api = */ Opcodes.ASM9, moduleVisitor, remapper);
}
/**
@ -87,9 +88,9 @@ public class ModuleRemapper extends ModuleVisitor {
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7} or {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8}.
* @param moduleVisitor the module visitor this remapper must deleted to.
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8} or {@link jdk.internal.org.objectweb.asm.Opcodes#ASM9}.
* @param moduleVisitor the module visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited module.
*/
protected ModuleRemapper(
@ -151,3 +152,4 @@ public class ModuleRemapper extends ModuleVisitor {
super.visitProvide(remapper.mapType(service), remappedProviders);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.Attribute;
@ -141,3 +142,4 @@ public final class ModuleResolutionAttribute extends Attribute {
return byteVector;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.Attribute;
@ -115,3 +116,4 @@ public final class ModuleTargetAttribute extends Attribute {
return byteVector;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@ -83,14 +84,14 @@ public class RecordComponentRemapper extends RecordComponentVisitor {
*/
public RecordComponentRemapper(
final RecordComponentVisitor recordComponentVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM8, recordComponentVisitor, remapper);
this(/* latest api = */ Opcodes.ASM9, recordComponentVisitor, remapper);
}
/**
* Constructs a new {@link RecordComponentRemapper}.
*
* @param api the ASM API version supported by this remapper. Must be {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8}.
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8} or {@link jdk.internal.org.objectweb.asm.Opcodes#ASM9}.
* @param recordComponentVisitor the record component visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited record component.
*/
@ -104,7 +105,9 @@ public class RecordComponentRemapper extends RecordComponentVisitor {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitAnnotation(remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == null
? null
: createAnnotationRemapper(descriptor, annotationVisitor);
}
@Override
@ -112,7 +115,9 @@ public class RecordComponentRemapper extends RecordComponentVisitor {
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createAnnotationRemapper(annotationVisitor);
return annotationVisitor == null
? null
: createAnnotationRemapper(descriptor, annotationVisitor);
}
/**
@ -121,8 +126,25 @@ public class RecordComponentRemapper extends RecordComponentVisitor {
*
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
* @deprecated use {@link #createAnnotationRemapper(String, AnnotationVisitor)} instead.
*/
@Deprecated
protected AnnotationVisitor createAnnotationRemapper(final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, annotationVisitor, remapper);
return new AnnotationRemapper(api, /* descriptor = */ null, annotationVisitor, remapper);
}
/**
* Constructs a new remapper for annotations. The default implementation of this method returns a
* new {@link AnnotationRemapper}.
*
* @param descriptor the descriptor sof the visited annotation.
* @param annotationVisitor the AnnotationVisitor the remapper must delegate to.
* @return the newly created remapper.
*/
protected AnnotationVisitor createAnnotationRemapper(
final String descriptor, final AnnotationVisitor annotationVisitor) {
return new AnnotationRemapper(api, descriptor, annotationVisitor, remapper)
.orDeprecatedValue(createAnnotationRemapper(annotationVisitor));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.ConstantDynamic;
@ -266,6 +267,18 @@ public abstract class Remapper {
return new SignatureRemapper(signatureVisitor, this);
}
/**
* Maps an annotation attribute name. The default implementation of this method returns the given
* name, unchanged. Subclasses can override.
*
* @param descriptor the descriptor of the annotation class.
* @param name the name of the annotation attribute.
* @return the new name of the annotation attribute.
*/
public String mapAnnotationAttributeName(final String descriptor, final String name) {
return name;
}
/**
* Maps an inner class name to its new name. The default implementation of this method provides a
* strategy that will work for inner classes produced by Java, but not necessarily other
@ -376,3 +389,4 @@ public abstract class Remapper {
return internalName;
}
}

@ -74,7 +74,7 @@ public class RemappingAnnotationAdapter extends AnnotationVisitor {
public RemappingAnnotationAdapter(
final AnnotationVisitor annotationVisitor, final Remapper remapper) {
this(Opcodes.ASM6, annotationVisitor, remapper);
this(Opcodes.ASM9, annotationVisitor, remapper);
}
protected RemappingAnnotationAdapter(
@ -113,3 +113,4 @@ public class RemappingAnnotationAdapter extends AnnotationVisitor {
: new RemappingAnnotationAdapter(annotationVisitor, remapper));
}
}

@ -1,197 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file:
*
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.FieldVisitor;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.ModuleVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.TypePath;
/**
* A {@link ClassVisitor} for type remapping.
*
* @deprecated use {@link ClassRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingClassAdapter extends ClassVisitor {
protected final Remapper remapper;
protected String className;
public RemappingClassAdapter(final ClassVisitor classVisitor, final Remapper remapper) {
this(Opcodes.ASM6, classVisitor, remapper);
}
protected RemappingClassAdapter(
final int api, final ClassVisitor classVisitor, final Remapper remapper) {
super(api, classVisitor);
this.remapper = remapper;
}
@Override
public void visit(
final int version,
final int access,
final String name,
final String signature,
final String superName,
final String[] interfaces) {
this.className = name;
super.visit(
version,
access,
remapper.mapType(name),
remapper.mapSignature(signature, false),
remapper.mapType(superName),
interfaces == null ? null : remapper.mapTypes(interfaces));
}
@Override
public ModuleVisitor visitModule(final String name, final int flags, final String version) {
throw new RuntimeException("RemappingClassAdapter is deprecated, use ClassRemapper instead");
}
@Override
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitAnnotation(remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createRemappingAnnotationAdapter(annotationVisitor);
}
@Override
public AnnotationVisitor visitTypeAnnotation(
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null ? null : createRemappingAnnotationAdapter(annotationVisitor);
}
@Override
public FieldVisitor visitField(
final int access,
final String name,
final String descriptor,
final String signature,
final Object value) {
FieldVisitor fieldVisitor =
super.visitField(
access,
remapper.mapFieldName(className, name, descriptor),
remapper.mapDesc(descriptor),
remapper.mapSignature(signature, true),
remapper.mapValue(value));
return fieldVisitor == null ? null : createRemappingFieldAdapter(fieldVisitor);
}
@Override
public MethodVisitor visitMethod(
final int access,
final String name,
final String descriptor,
final String signature,
final String[] exceptions) {
String newDescriptor = remapper.mapMethodDesc(descriptor);
MethodVisitor methodVisitor =
super.visitMethod(
access,
remapper.mapMethodName(className, name, descriptor),
newDescriptor,
remapper.mapSignature(signature, false),
exceptions == null ? null : remapper.mapTypes(exceptions));
return methodVisitor == null
? null
: createRemappingMethodAdapter(access, newDescriptor, methodVisitor);
}
@Override
public void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
super.visitInnerClass(
remapper.mapType(name),
outerName == null ? null : remapper.mapType(outerName),
innerName,
access);
}
@Override
public void visitOuterClass(final String owner, final String name, final String descriptor) {
super.visitOuterClass(
remapper.mapType(owner),
name == null ? null : remapper.mapMethodName(owner, name, descriptor),
descriptor == null ? null : remapper.mapMethodDesc(descriptor));
}
protected FieldVisitor createRemappingFieldAdapter(final FieldVisitor fieldVisitor) {
return new RemappingFieldAdapter(fieldVisitor, remapper);
}
protected MethodVisitor createRemappingMethodAdapter(
final int access, final String newDescriptor, final MethodVisitor methodVisitior) {
return new RemappingMethodAdapter(access, newDescriptor, methodVisitior, remapper);
}
protected AnnotationVisitor createRemappingAnnotationAdapter(final AnnotationVisitor av) {
return new RemappingAnnotationAdapter(av, remapper);
}
}

@ -1,104 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file:
*
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
import jdk.internal.org.objectweb.asm.FieldVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.TypePath;
/**
* A {@link FieldVisitor} adapter for type remapping.
*
* @deprecated use {@link FieldRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingFieldAdapter extends FieldVisitor {
private final Remapper remapper;
public RemappingFieldAdapter(final FieldVisitor fieldVisitor, final Remapper remapper) {
this(Opcodes.ASM6, fieldVisitor, remapper);
}
protected RemappingFieldAdapter(
final int api, final FieldVisitor fieldVisitor, final Remapper remapper) {
super(api, fieldVisitor);
this.remapper = remapper;
}
@Override
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor = fv.visitAnnotation(remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? null
: new RemappingAnnotationAdapter(annotationVisitor, remapper);
}
@Override
public AnnotationVisitor visitTypeAnnotation(
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? null
: new RemappingAnnotationAdapter(annotationVisitor, remapper);
}
}

@ -81,7 +81,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
final String descriptor,
final MethodVisitor methodVisitor,
final Remapper remapper) {
this(Opcodes.ASM6, access, descriptor, methodVisitor, remapper);
this(Opcodes.ASM9, access, descriptor, methodVisitor, remapper);
}
protected RemappingMethodAdapter(
@ -307,3 +307,4 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
: new RemappingAnnotationAdapter(annotationVisitor, remapper);
}
}

@ -1,187 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file:
*
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.signature.SignatureVisitor;
/**
* A {@link SignatureVisitor} adapter for type mapping.
*
* @deprecated use {@link SignatureRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingSignatureAdapter extends SignatureVisitor {
private final SignatureVisitor signatureVisitor;
private final Remapper remapper;
private String className;
public RemappingSignatureAdapter(
final SignatureVisitor signatureVisitor, final Remapper remapper) {
this(Opcodes.ASM6, signatureVisitor, remapper);
}
protected RemappingSignatureAdapter(
final int api, final SignatureVisitor signatureVisitor, final Remapper remapper) {
super(api);
this.signatureVisitor = signatureVisitor;
this.remapper = remapper;
}
@Override
public void visitClassType(final String name) {
className = name;
signatureVisitor.visitClassType(remapper.mapType(name));
}
@Override
public void visitInnerClassType(final String name) {
String remappedOuter = remapper.mapType(className) + '$';
className = className + '$' + name;
String remappedName = remapper.mapType(className);
int index =
remappedName.startsWith(remappedOuter)
? remappedOuter.length()
: remappedName.lastIndexOf('$') + 1;
signatureVisitor.visitInnerClassType(remappedName.substring(index));
}
@Override
public void visitFormalTypeParameter(final String name) {
signatureVisitor.visitFormalTypeParameter(name);
}
@Override
public void visitTypeVariable(final String name) {
signatureVisitor.visitTypeVariable(name);
}
@Override
public SignatureVisitor visitArrayType() {
signatureVisitor.visitArrayType();
return this;
}
@Override
public void visitBaseType(final char descriptor) {
signatureVisitor.visitBaseType(descriptor);
}
@Override
public SignatureVisitor visitClassBound() {
signatureVisitor.visitClassBound();
return this;
}
@Override
public SignatureVisitor visitExceptionType() {
signatureVisitor.visitExceptionType();
return this;
}
@Override
public SignatureVisitor visitInterface() {
signatureVisitor.visitInterface();
return this;
}
@Override
public SignatureVisitor visitInterfaceBound() {
signatureVisitor.visitInterfaceBound();
return this;
}
@Override
public SignatureVisitor visitParameterType() {
signatureVisitor.visitParameterType();
return this;
}
@Override
public SignatureVisitor visitReturnType() {
signatureVisitor.visitReturnType();
return this;
}
@Override
public SignatureVisitor visitSuperclass() {
signatureVisitor.visitSuperclass();
return this;
}
@Override
public void visitTypeArgument() {
signatureVisitor.visitTypeArgument();
}
@Override
public SignatureVisitor visitTypeArgument(final char wildcard) {
signatureVisitor.visitTypeArgument(wildcard);
return this;
}
@Override
public void visitEnd() {
signatureVisitor.visitEnd();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.io.ByteArrayOutputStream;
@ -181,7 +182,7 @@ public class SerialVersionUIDAdder extends ClassVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public SerialVersionUIDAdder(final ClassVisitor classVisitor) {
this(/* latest api = */ Opcodes.ASM8, classVisitor);
this(/* latest api = */ Opcodes.ASM9, classVisitor);
if (getClass() != SerialVersionUIDAdder.class) {
throw new IllegalStateException();
}
@ -191,8 +192,8 @@ public class SerialVersionUIDAdder extends ClassVisitor {
* Constructs a new {@link SerialVersionUIDAdder}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param classVisitor a {@link ClassVisitor} to which this visitor will delegate calls.
*/
protected SerialVersionUIDAdder(final int api, final ClassVisitor classVisitor) {
@ -349,7 +350,7 @@ public class SerialVersionUIDAdder extends ClassVisitor {
}
/**
* Adds a static final serialVersionUID field to the class, with the given value.
* Adds a final static serialVersionUID field to the class, with the given value.
*
* @param svuid the serialVersionUID field value.
*/
@ -522,3 +523,4 @@ public class SerialVersionUIDAdder extends ClassVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.ArrayList;
@ -79,11 +80,11 @@ public class SignatureRemapper extends SignatureVisitor {
* Constructs a new {@link SignatureRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #SignatureRemapper(int,SignatureVisitor,Remapper)} version.
*
* @param signatureVisitor the signature visitor this remapper must deleted to.
* @param signatureVisitor the signature visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited signature.
*/
public SignatureRemapper(final SignatureVisitor signatureVisitor, final Remapper remapper) {
this(/* latest api = */ Opcodes.ASM8, signatureVisitor, remapper);
this(/* latest api = */ Opcodes.ASM9, signatureVisitor, remapper);
}
/**
@ -91,9 +92,9 @@ public class SignatureRemapper extends SignatureVisitor {
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM4}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM5},{@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7} or {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8}.
* @param signatureVisitor the signature visitor this remapper must deleted to.
* jdk.internal.org.objectweb.asm.Opcodes#ASM6}, {@link jdk.internal.org.objectweb.asm.Opcodes#ASM7}, {@link
* jdk.internal.org.objectweb.asm.Opcodes#ASM8} or {@link jdk.internal.org.objectweb.asm.Opcodes#ASM9}.
* @param signatureVisitor the signature visitor this remapper must delegate to.
* @param remapper the remapper to use to remap the types in the visited signature.
*/
protected SignatureRemapper(
@ -203,3 +204,4 @@ public class SignatureRemapper extends SignatureVisitor {
classNames.remove(classNames.size() - 1);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.Collections;
@ -80,8 +81,9 @@ public class SimpleRemapper extends Remapper {
* name.
* <li>for invokedynamic method names, the key is the name and descriptor of the method (in
* the form .&lt;name&gt;&lt;descriptor&gt;), and the value is the new method name.
* <li>for field names, the key is the owner and name of the field (in the form
* &lt;owner&gt;.&lt;name&gt;), and the value is the new field name.
* <li>for field and attribute names, the key is the owner and name of the field or
* attribute (in the form &lt;owner&gt;.&lt;name&gt;), and the value is the new field
* name.
* <li>for internal names, the key is the old internal name, and the value is the new
* internal name.
* </ul>
@ -113,6 +115,12 @@ public class SimpleRemapper extends Remapper {
return remappedName == null ? name : remappedName;
}
@Override
public String mapAnnotationAttributeName(final String descriptor, final String name) {
String remappedName = map(descriptor + '.' + name);
return remappedName == null ? name : remappedName;
}
@Override
public String mapFieldName(final String owner, final String name, final String descriptor) {
String remappedName = map(owner + '.' + name);
@ -124,3 +132,4 @@ public class SimpleRemapper extends Remapper {
return mapping.get(key);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.ClassVisitor;
@ -92,15 +93,15 @@ public class StaticInitMerger extends ClassVisitor {
* null.
*/
public StaticInitMerger(final String prefix, final ClassVisitor classVisitor) {
this(/* latest api = */ Opcodes.ASM8, prefix, classVisitor);
this(/* latest api = */ Opcodes.ASM9, prefix, classVisitor);
}
/**
* Constructs a new {@link StaticInitMerger}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param prefix the prefix to use to rename the existing &lt;clinit&gt; methods.
* @param classVisitor the class visitor to which this visitor must delegate method calls. May be
* null.
@ -154,3 +155,4 @@ public class StaticInitMerger extends ClassVisitor {
super.visitEnd();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import jdk.internal.org.objectweb.asm.Label;
@ -80,3 +81,4 @@ public interface TableSwitchGenerator {
/** Generates the code for the default switch case. */
void generateDefault();
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.commons;
import java.util.Collections;
@ -101,7 +102,7 @@ public class TryCatchBlockSorter extends MethodNode {
final String signature,
final String[] exceptions) {
this(
/* latest api = */ Opcodes.ASM8,
/* latest api = */ Opcodes.ASM9,
methodVisitor,
access,
name,
@ -154,3 +155,4 @@ public class TryCatchBlockSorter extends MethodNode {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.signature;
/**
@ -281,3 +282,4 @@ public class SignatureReader {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.signature;
import jdk.internal.org.objectweb.asm.Opcodes;
@ -102,14 +103,13 @@ public abstract class SignatureVisitor {
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
*/
@SuppressWarnings("deprecation")
public SignatureVisitor(final int api) {
if (api != Opcodes.ASM8
if (api != Opcodes.ASM9
&& api != Opcodes.ASM8
&& api != Opcodes.ASM7
&& api != Opcodes.ASM6
&& api != Opcodes.ASM5
&& api != Opcodes.ASM4
&& api != Opcodes.ASM9_EXPERIMENTAL) {
&& api != Opcodes.ASM4) {
throw new IllegalArgumentException("Unsupported api " + api);
}
this.api = api;
@ -238,3 +238,4 @@ public abstract class SignatureVisitor {
/** Ends the visit of a signature corresponding to a class or interface type. */
public void visitEnd() {}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.signature;
import jdk.internal.org.objectweb.asm.Opcodes;
@ -101,7 +102,7 @@ public class SignatureWriter extends SignatureVisitor {
/** Constructs a new {@link SignatureWriter}. */
public SignatureWriter() {
super(/* latest api =*/ Opcodes.ASM8);
super(/* latest api =*/ Opcodes.ASM9);
}
// -----------------------------------------------------------------------------------------------
@ -269,3 +270,4 @@ public class SignatureWriter extends SignatureVisitor {
argumentStack /= 2;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ArrayList;
@ -294,3 +295,4 @@ public abstract class AbstractInsnNode {
return this;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ArrayList;
@ -91,7 +92,7 @@ public class AnnotationNode extends AnnotationVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public AnnotationNode(final String descriptor) {
this(/* latest api = */ Opcodes.ASM8, descriptor);
this(/* latest api = */ Opcodes.ASM9, descriptor);
if (getClass() != AnnotationNode.class) {
throw new IllegalStateException();
}
@ -101,8 +102,8 @@ public class AnnotationNode extends AnnotationVisitor {
* Constructs a new {@link AnnotationNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param descriptor the class descriptor of the annotation class.
*/
public AnnotationNode(final int api, final String descriptor) {
@ -116,7 +117,7 @@ public class AnnotationNode extends AnnotationVisitor {
* @param values where the visited values must be stored.
*/
AnnotationNode(final List<Object> values) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
this.values = values;
}
@ -205,7 +206,7 @@ public class AnnotationNode extends AnnotationVisitor {
* introduced in more recent versions of the ASM API than the given version.
*
* @param api an ASM API version. Must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5},
* {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link Opcodes#ASM8}.
* {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
public void check(final int api) {
// nothing to do
@ -260,3 +261,4 @@ public class AnnotationNode extends AnnotationVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ArrayList;
@ -158,14 +159,8 @@ public class ClassNode extends ClassVisitor {
/** The internal names of the nest members of this class. May be {@literal null}. */
public List<String> nestMembers;
/**
* <b>Experimental, use at your own risk. This method will be renamed when it becomes stable, this
* will break existing code using it</b>. The internal names of the permitted subclasses of this
* class. May be {@literal null}.
*
* @deprecated this API is experimental.
*/
@Deprecated public List<String> permittedSubclassesExperimental;
/** The internal names of the permitted subclasses of this class. May be {@literal null}. */
public List<String> permittedSubclasses;
/** The record components of this class. May be {@literal null}. */
public List<RecordComponentNode> recordComponents;
@ -183,7 +178,7 @@ public class ClassNode extends ClassVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public ClassNode() {
this(Opcodes.ASM8);
this(Opcodes.ASM9);
if (getClass() != ClassNode.class) {
throw new IllegalStateException();
}
@ -193,8 +188,8 @@ public class ClassNode extends ClassVisitor {
* Constructs a new {@link ClassNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8}, or {@link Opcodes#ASM9}.
*/
public ClassNode(final int api) {
super(api);
@ -281,16 +276,9 @@ public class ClassNode extends ClassVisitor {
nestMembers = Util.add(nestMembers, nestMember);
}
/**
* <b>Experimental, use at your own risk.</b>.
*
* @param permittedSubclass the internal name of a permitted subclass.
* @deprecated this API is experimental.
*/
@Override
@Deprecated
public void visitPermittedSubclassExperimental(final String permittedSubclass) {
permittedSubclassesExperimental = Util.add(permittedSubclassesExperimental, permittedSubclass);
public void visitPermittedSubclass(final String permittedSubclass) {
permittedSubclasses = Util.add(permittedSubclasses, permittedSubclass);
}
@Override
@ -347,11 +335,10 @@ public class ClassNode extends ClassVisitor {
* in more recent versions of the ASM API than the given version.
*
* @param api an ASM API version. Must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5},
* {@link Opcodes#ASM6}, {@link Opcodes#ASM7}. or {@link Opcodes#ASM8}.
* {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
@SuppressWarnings("deprecation")
public void check(final int api) {
if (api != Opcodes.ASM9_EXPERIMENTAL && permittedSubclassesExperimental != null) {
if (api < Opcodes.ASM9 && permittedSubclasses != null) {
throw new UnsupportedClassVersionException();
}
if (api < Opcodes.ASM8 && ((access & Opcodes.ACC_RECORD) != 0 || recordComponents != null)) {
@ -410,7 +397,6 @@ public class ClassNode extends ClassVisitor {
*
* @param classVisitor a class visitor.
*/
@SuppressWarnings("deprecation")
public void accept(final ClassVisitor classVisitor) {
// Visit the header.
String[] interfacesArray = new String[this.interfaces.size()];
@ -473,10 +459,10 @@ public class ClassNode extends ClassVisitor {
classVisitor.visitNestMember(nestMembers.get(i));
}
}
// Visit the permitted subclass.
if (permittedSubclassesExperimental != null) {
for (int i = 0, n = permittedSubclassesExperimental.size(); i < n; ++i) {
classVisitor.visitPermittedSubclassExperimental(permittedSubclassesExperimental.get(i));
// Visit the permitted subclasses.
if (permittedSubclasses != null) {
for (int i = 0, n = permittedSubclasses.size(); i < n; ++i) {
classVisitor.visitPermittedSubclass(permittedSubclasses.get(i));
}
}
// Visit the inner classes.
@ -500,3 +486,4 @@ public class ClassNode extends ClassVisitor {
classVisitor.visitEnd();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -125,3 +126,4 @@ public class FieldInsnNode extends AbstractInsnNode {
return new FieldInsnNode(opcode, owner, name, desc).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -130,7 +131,7 @@ public class FieldNode extends FieldVisitor {
final String descriptor,
final String signature,
final Object value) {
this(/* latest api = */ Opcodes.ASM8, access, name, descriptor, signature, value);
this(/* latest api = */ Opcodes.ASM9, access, name, descriptor, signature, value);
if (getClass() != FieldNode.class) {
throw new IllegalStateException();
}
@ -140,8 +141,8 @@ public class FieldNode extends FieldVisitor {
* Constructs a new {@link FieldNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param access the field's access flags (see {@link jdk.internal.org.objectweb.asm.Opcodes}). This parameter
* also indicates if the field is synthetic and/or deprecated.
* @param name the field's name.
@ -274,3 +275,4 @@ public class FieldNode extends FieldVisitor {
fieldVisitor.visitEnd();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ArrayList;
@ -217,3 +218,4 @@ public class FrameNode extends AbstractInsnNode {
return array;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -103,3 +104,4 @@ public class IincInsnNode extends AbstractInsnNode {
return new IincInsnNode(var, incr).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import jdk.internal.org.objectweb.asm.ClassVisitor;
@ -114,3 +115,4 @@ public class InnerClassNode {
classVisitor.visitInnerClass(name, outerName, innerName, access);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ListIterator;
@ -518,12 +519,19 @@ public class InsnList implements Iterable<AbstractInsnNode> {
AbstractInsnNode remove;
InsnListIterator(final int index) {
if (index == size()) {
if (index < 0 || index > size()) {
throw new IndexOutOfBoundsException();
} else if (index == size()) {
nextInsn = null;
previousInsn = getLast();
} else {
nextInsn = get(index);
previousInsn = nextInsn.previousInsn;
AbstractInsnNode currentInsn = getFirst();
for (int i = 0; i < index; i++) {
currentInsn = currentInsn.nextInsn;
}
nextInsn = currentInsn;
previousInsn = currentInsn.previousInsn;
}
}
@ -626,3 +634,4 @@ public class InsnList implements Iterable<AbstractInsnNode> {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -102,3 +103,4 @@ public class InsnNode extends AbstractInsnNode {
return new InsnNode(opcode).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -108,3 +109,4 @@ public class IntInsnNode extends AbstractInsnNode {
return new IntInsnNode(opcode, operand).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -121,3 +122,4 @@ public class InvokeDynamicInsnNode extends AbstractInsnNode {
return new InvokeDynamicInsnNode(name, desc, bsm, bsmArgs).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -116,3 +117,4 @@ public class JumpInsnNode extends AbstractInsnNode {
return new JumpInsnNode(opcode, clone(label, clonedLabels)).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -108,3 +109,4 @@ public class LabelNode extends AbstractInsnNode {
value = null;
}
}

@ -56,11 +56,15 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
import jdk.internal.org.objectweb.asm.ConstantDynamic;
import jdk.internal.org.objectweb.asm.Handle;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.Type;
/**
* A node that represents an LDC instruction.
@ -70,17 +74,23 @@ import jdk.internal.org.objectweb.asm.Opcodes;
public class LdcInsnNode extends AbstractInsnNode {
/**
* The constant to be loaded on the stack. This parameter must be a non null {@link Integer}, a
* {@link Float}, a {@link Long}, a {@link Double}, a {@link String} or a {@link
* jdk.internal.org.objectweb.asm.Type}.
* The constant to be loaded on the stack. This field must be a non null {@link Integer}, a {@link
* Float}, a {@link Long}, a {@link Double}, a {@link String}, a {@link Type} of OBJECT or ARRAY
* sort for {@code .class} constants, for classes whose version is 49, a {@link Type} of METHOD
* sort for MethodType, a {@link Handle} for MethodHandle constants, for classes whose version is
* 51 or a {@link ConstantDynamic} for a constant dynamic for classes whose version is 55.
*/
public Object cst;
/**
* Constructs a new {@link LdcInsnNode}.
*
* @param value the constant to be loaded on the stack. This parameter must be a non null {@link
* Integer}, a {@link Float}, a {@link Long}, a {@link Double} or a {@link String}.
* @param value the constant to be loaded on the stack. This parameter mist be a non null {@link
* Integer}, a {@link Float}, a {@link Long}, a {@link Double}, a {@link String}, a {@link
* Type} of OBJECT or ARRAY sort for {@code .class} constants, for classes whose version is
* 49, a {@link Type} of METHOD sort for MethodType, a {@link Handle} for MethodHandle
* constants, for classes whose version is 51 or a {@link ConstantDynamic} for a constant
* dynamic for classes whose version is 55.
*/
public LdcInsnNode(final Object value) {
super(Opcodes.LDC);
@ -103,3 +113,4 @@ public class LdcInsnNode extends AbstractInsnNode {
return new LdcInsnNode(cst).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -103,3 +104,4 @@ public class LineNumberNode extends AbstractInsnNode {
return new LineNumberNode(line, clone(start, clonedLabels));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -114,15 +115,15 @@ public class LocalVariableAnnotationNode extends TypeAnnotationNode {
final LabelNode[] end,
final int[] index,
final String descriptor) {
this(/* latest api = */ Opcodes.ASM8, typeRef, typePath, start, end, index, descriptor);
this(/* latest api = */ Opcodes.ASM9, typeRef, typePath, start, end, index, descriptor);
}
/**
* Constructs a new {@link LocalVariableAnnotationNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param typeRef a reference to the annotated type. See {@link jdk.internal.org.objectweb.asm.TypeReference}.
* @param start the fist instructions corresponding to the continuous ranges that make the scope
* of this local variable (inclusive).
@ -169,3 +170,4 @@ public class LocalVariableAnnotationNode extends TypeAnnotationNode {
typeRef, typePath, startLabels, endLabels, indices, desc, visible));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import jdk.internal.org.objectweb.asm.MethodVisitor;
@ -121,3 +122,4 @@ public class LocalVariableNode {
name, desc, signature, start.getLabel(), end.getLabel(), index);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -122,3 +123,4 @@ public class LookupSwitchInsnNode extends AbstractInsnNode {
return clone.cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -152,3 +153,4 @@ public class MethodInsnNode extends AbstractInsnNode {
return new MethodInsnNode(opcode, owner, name, desc, itf).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ArrayList;
@ -186,7 +187,7 @@ public class MethodNode extends MethodVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public MethodNode() {
this(/* latest api = */ Opcodes.ASM8);
this(/* latest api = */ Opcodes.ASM9);
if (getClass() != MethodNode.class) {
throw new IllegalStateException();
}
@ -196,8 +197,8 @@ public class MethodNode extends MethodVisitor {
* Constructs an uninitialized {@link MethodNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
public MethodNode(final int api) {
super(api);
@ -223,7 +224,7 @@ public class MethodNode extends MethodVisitor {
final String descriptor,
final String signature,
final String[] exceptions) {
this(/* latest api = */ Opcodes.ASM8, access, name, descriptor, signature, exceptions);
this(/* latest api = */ Opcodes.ASM9, access, name, descriptor, signature, exceptions);
if (getClass() != MethodNode.class) {
throw new IllegalStateException();
}
@ -233,8 +234,8 @@ public class MethodNode extends MethodVisitor {
* Constructs a new {@link MethodNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @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.
@ -599,7 +600,7 @@ public class MethodNode extends MethodVisitor {
* in more recent versions of the ASM API than the given version.
*
* @param api an ASM API version. Must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5},
* {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link Opcodes#ASM8}.
* {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
public void check(final int api) {
if (api == Opcodes.ASM4) {
@ -803,3 +804,4 @@ public class MethodNode extends MethodVisitor {
methodVisitor.visitEnd();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -108,3 +109,4 @@ public class ModuleExportNode {
packaze, access, modules == null ? null : modules.toArray(new String[0]));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ArrayList;
@ -115,7 +116,7 @@ public class ModuleNode extends ModuleVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public ModuleNode(final String name, final int access, final String version) {
super(/* latest api = */ Opcodes.ASM8);
super(/* latest api = */ Opcodes.ASM9);
if (getClass() != ModuleNode.class) {
throw new IllegalStateException();
}
@ -129,7 +130,7 @@ public class ModuleNode extends ModuleVisitor {
* Constructs a {@link ModuleNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link Opcodes#ASM8}.
* Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param name the fully qualified name (using dots) of the module.
* @param access the module access flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC} and {@code
* ACC_MANDATED}.
@ -264,3 +265,4 @@ public class ModuleNode extends ModuleVisitor {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -108,3 +109,4 @@ public class ModuleOpenNode {
packaze, access, modules == null ? null : modules.toArray(new String[0]));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -95,3 +96,4 @@ public class ModuleProvideNode {
moduleVisitor.visitProvide(service, providers.toArray(new String[0]));
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import jdk.internal.org.objectweb.asm.ModuleVisitor;
@ -102,3 +103,4 @@ public class ModuleRequireNode {
moduleVisitor.visitRequire(module, access, version);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -103,3 +104,4 @@ public class MultiANewArrayInsnNode extends AbstractInsnNode {
return new MultiANewArrayInsnNode(desc, dims).cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import jdk.internal.org.objectweb.asm.MethodVisitor;
@ -97,3 +98,4 @@ public class ParameterNode {
methodVisitor.visitParameter(name, access);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -107,7 +108,7 @@ public class RecordComponentNode extends RecordComponentVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public RecordComponentNode(final String name, final String descriptor, final String signature) {
this(/* latest api = */ Opcodes.ASM8, name, descriptor, signature);
this(/* latest api = */ Opcodes.ASM9, name, descriptor, signature);
if (getClass() != RecordComponentNode.class) {
throw new IllegalStateException();
}
@ -116,7 +117,8 @@ public class RecordComponentNode extends RecordComponentVisitor {
/**
* Constructs a new {@link RecordComponentNode}.
*
* @param api the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM8}.
* @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM8}
* or {@link Opcodes#ASM9}.
* @param name the record component name.
* @param descriptor the record component descriptor (see {@link jdk.internal.org.objectweb.asm.Type}).
* @param signature the record component signature.
@ -175,7 +177,7 @@ public class RecordComponentNode extends RecordComponentVisitor {
* method checks that this node, and all its children recursively, do not contain elements that
* were introduced in more recent versions of the ASM API than the given version.
*
* @param api an ASM API version. Must be {@link Opcodes#ASM8}.
* @param api an ASM API version. Must be one of {@link Opcodes#ASM8} or {@link Opcodes#ASM9}.
*/
public void check(final int api) {
if (api < Opcodes.ASM8) {
@ -232,3 +234,4 @@ public class RecordComponentNode extends RecordComponentVisitor {
recordComponentVisitor.visitEnd();
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -122,3 +123,4 @@ public class TableSwitchInsnNode extends AbstractInsnNode {
.cloneAnnotations(this);
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.List;
@ -155,3 +156,4 @@ public class TryCatchBlockNode {
}
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import jdk.internal.org.objectweb.asm.Opcodes;
@ -90,7 +91,7 @@ public class TypeAnnotationNode extends AnnotationNode {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public TypeAnnotationNode(final int typeRef, final TypePath typePath, final String descriptor) {
this(/* latest api = */ Opcodes.ASM8, typeRef, typePath, descriptor);
this(/* latest api = */ Opcodes.ASM9, typeRef, typePath, descriptor);
if (getClass() != TypeAnnotationNode.class) {
throw new IllegalStateException();
}
@ -100,8 +101,8 @@ public class TypeAnnotationNode extends AnnotationNode {
* Constructs a new {@link AnnotationNode}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link
* Opcodes#ASM8}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link
* Opcodes#ASM8} or {@link Opcodes#ASM9}.
* @param typeRef a reference to the annotated type. See {@link jdk.internal.org.objectweb.asm.TypeReference}.
* @param typePath the path to the annotated type argument, wildcard bound, array element type, or
* static inner type within 'typeRef'. May be {@literal null} if the annotation targets
@ -115,3 +116,4 @@ public class TypeAnnotationNode extends AnnotationNode {
this.typePath = typePath;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -114,3 +115,4 @@ public class TypeInsnNode extends AbstractInsnNode {
return new TypeInsnNode(opcode, desc).cloneAnnotations(this);
}
}

@ -55,7 +55,8 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/package jdk.internal.org.objectweb.asm.tree;
*/
package jdk.internal.org.objectweb.asm.tree;
/**
* Exception thrown in {@link AnnotationNode#check}, {@link ClassNode#check}, {@link
@ -69,3 +70,4 @@ public class UnsupportedClassVersionException extends RuntimeException {
private static final long serialVersionUID = -3502347765891805831L;
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.ArrayList;
@ -192,3 +193,4 @@ final class Util {
return list;
}
}

@ -56,6 +56,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package jdk.internal.org.objectweb.asm.tree;
import java.util.Map;
@ -111,3 +112,4 @@ public class VarInsnNode extends AbstractInsnNode {
return new VarInsnNode(opcode, var).cloneAnnotations(this);
}
}

Some files were not shown because too many files have changed in this diff Show More