Commit 2924283f authored by Eric Bruneton's avatar Eric Bruneton

Add an experimental suffix to the new features (also mark them deprecated and...

Add an experimental suffix to the new features (also mark them deprecated and show a big warning in the Javadoc). Revert to ASM6 for the default api of the visitors, and use ASM7_EXPERIMENTAL only in tests (only exception: Trace*Visitor classes, which are final). This pattern could allow us to develop any new feature directly in 'master'.
parent 6a10acad
Pipeline #1539 passed with stage
in 3 minutes and 55 seconds
......@@ -61,7 +61,7 @@ public class BasicInterpreter extends Interpreter<BasicValue> implements Opcodes
* use this constructor</i>. Instead, they must use the {@link #BasicInterpreter(int)} version.
*/
public BasicInterpreter() {
super(ASM7);
super(ASM6);
if (getClass() != BasicInterpreter.class) {
throw new IllegalStateException();
}
......@@ -71,7 +71,7 @@ public class BasicInterpreter extends Interpreter<BasicValue> implements Opcodes
* Constructs a new {@link BasicInterpreter}.
*
* @param api the ASM API version supported by this interpreter. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
protected BasicInterpreter(final int api) {
super(api);
......
......@@ -48,7 +48,7 @@ public class BasicVerifier extends BasicInterpreter {
* this constructor</i>. Instead, they must use the {@link #BasicVerifier(int)} version.
*/
public BasicVerifier() {
super(ASM7);
super(ASM6);
if (getClass() != BasicVerifier.class) {
throw new IllegalStateException();
}
......@@ -59,7 +59,7 @@ public class BasicVerifier extends BasicInterpreter {
*
* @param api the ASM API version supported by this interpreter. Must be one of {@link
* org.objectweb.asm.Opcodes#ASM4}, {@link org.objectweb.asm.Opcodes#ASM5}, {@link
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7}.
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7_EXPERIMENTAL}.
*/
protected BasicVerifier(final int api) {
super(api);
......
......@@ -47,7 +47,7 @@ public abstract class Interpreter<V extends Value> {
/**
* The ASM API version supported by this interpreter. The value of this field must be one of
* {@link org.objectweb.asm.Opcodes#ASM4}, {@link org.objectweb.asm.Opcodes#ASM5}, {@link
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7}.
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7_EXPERIMENTAL}.
*/
protected final int api;
......@@ -56,7 +56,7 @@ public abstract class Interpreter<V extends Value> {
*
* @param api the ASM API version supported by this interpreter. Must be one of {@link
* org.objectweb.asm.Opcodes#ASM4}, {@link org.objectweb.asm.Opcodes#ASM5}, {@link
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7}.
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7_EXPERIMENTAL}.
*/
protected Interpreter(final int api) {
this.api = api;
......
......@@ -94,7 +94,7 @@ public class SimpleVerifier extends BasicVerifier {
final Type currentSuperClass,
final List<Type> currentClassInterfaces,
final boolean isInterface) {
this(ASM7, currentClass, currentSuperClass, currentClassInterfaces, isInterface);
this(ASM6, currentClass, currentSuperClass, currentClassInterfaces, isInterface);
if (getClass() != SimpleVerifier.class) {
throw new IllegalStateException();
}
......@@ -106,7 +106,7 @@ public class SimpleVerifier extends BasicVerifier {
*
* @param api the ASM API version supported by this verifier. Must be one of {@link
* org.objectweb.asm.Opcodes#ASM4}, {@link org.objectweb.asm.Opcodes#ASM5}, {@link
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7}.
* org.objectweb.asm.Opcodes#ASM6} or {@link org.objectweb.asm.Opcodes#ASM7_EXPERIMENTAL}.
* @param currentClass the type of the class to be verified.
* @param currentSuperClass the type of the super class of the class to be verified.
* @param currentClassInterfaces the types of the interfaces directly implemented by the class to
......
......@@ -51,7 +51,7 @@ public class SourceInterpreter extends Interpreter<SourceValue> implements Opcod
* use this constructor</i>. Instead, they must use the {@link #SourceInterpreter(int)} version.
*/
public SourceInterpreter() {
super(ASM7);
super(ASM6);
if (getClass() != SourceInterpreter.class) {
throw new IllegalStateException();
}
......@@ -61,7 +61,7 @@ public class SourceInterpreter extends Interpreter<SourceValue> implements Opcod
* Constructs a new {@link SourceInterpreter}.
*
* @param api the ASM API version supported by this interpreter. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
protected SourceInterpreter(final int api) {
super(api);
......
......@@ -89,7 +89,7 @@ public class BasicInterpreterTest extends AsmTest {
for (MethodNode methodNode : classNode.methods) {
Analyzer<BasicValue> analyzer =
new Analyzer<BasicValue>(
new BasicInterpreter(Opcodes.ASM7) {
new BasicInterpreter(Opcodes.ASM7_EXPERIMENTAL) {
@Override
public BasicValue merge(final BasicValue value1, final BasicValue value2) {
return new BasicValue(super.merge(value1, value2).getType());
......
......@@ -478,7 +478,7 @@ public class SimpleVerifierTest extends AsmTest implements Opcodes {
Type baseType = Type.getObjectType("C");
Type superType = Type.getObjectType("D");
Type interfaceType = Type.getObjectType("I");
new SimpleVerifier(ASM7, baseType, superType, Arrays.asList(interfaceType), false) {
new SimpleVerifier(ASM7_EXPERIMENTAL, baseType, superType, Arrays.asList(interfaceType), false) {
void test() {
assertTrue(isAssignableFrom(baseType, baseType));
......@@ -496,7 +496,7 @@ public class SimpleVerifierTest extends AsmTest implements Opcodes {
}
}.test();
new SimpleVerifier(ASM7, interfaceType, null, null, true) {
new SimpleVerifier(ASM7_EXPERIMENTAL, interfaceType, null, null, true) {
void test() {
assertTrue(isAssignableFrom(interfaceType, baseType));
......
......@@ -77,7 +77,7 @@ public abstract class AdviceAdapter extends GeneratorAdapter implements Opcodes
* Constructs a new {@link AdviceAdapter}.
*
* @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}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param mv 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.
......
......@@ -116,7 +116,7 @@ public class AnalyzerAdapter extends MethodVisitor {
final String name,
final String desc,
final MethodVisitor mv) {
this(Opcodes.ASM7, owner, access, name, desc, mv);
this(Opcodes.ASM6, owner, access, name, desc, mv);
if (getClass() != AnalyzerAdapter.class) {
throw new IllegalStateException();
}
......@@ -126,7 +126,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param owner the owner's class name.
* @param access the method's access flags (see {@link Opcodes}).
* @param name the method's name.
......
......@@ -41,7 +41,7 @@ public class AnnotationRemapper extends AnnotationVisitor {
protected final Remapper remapper;
public AnnotationRemapper(final AnnotationVisitor av, final Remapper remapper) {
this(Opcodes.ASM7, av, remapper);
this(Opcodes.ASM6, av, remapper);
}
protected AnnotationRemapper(final int api, final AnnotationVisitor av, final Remapper remapper) {
......
......@@ -51,7 +51,7 @@ public class ClassRemapper extends ClassVisitor {
protected String className;
public ClassRemapper(final ClassVisitor cv, final Remapper remapper) {
this(Opcodes.ASM7, cv, remapper);
this(Opcodes.ASM6, cv, remapper);
}
protected ClassRemapper(final int api, final ClassVisitor cv, final Remapper remapper) {
......
......@@ -44,7 +44,7 @@ public class CodeSizeEvaluator extends MethodVisitor implements Opcodes {
private int maxSize;
public CodeSizeEvaluator(final MethodVisitor mv) {
this(Opcodes.ASM7, mv);
this(Opcodes.ASM6, mv);
}
protected CodeSizeEvaluator(final int api, final MethodVisitor mv) {
......
......@@ -43,7 +43,7 @@ public class FieldRemapper extends FieldVisitor {
private final Remapper remapper;
public FieldRemapper(final FieldVisitor fv, final Remapper remapper) {
this(Opcodes.ASM7, fv, remapper);
this(Opcodes.ASM6, fv, remapper);
}
protected FieldRemapper(final int api, final FieldVisitor fv, final Remapper remapper) {
......
......@@ -198,7 +198,7 @@ public class GeneratorAdapter extends LocalVariablesSorter {
*/
public GeneratorAdapter(
final MethodVisitor mv, final int access, final String name, final String desc) {
this(Opcodes.ASM7, mv, access, name, desc);
this(Opcodes.ASM6, mv, access, name, desc);
if (getClass() != GeneratorAdapter.class) {
throw new IllegalStateException();
}
......@@ -208,7 +208,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param mv 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.
......
......@@ -52,7 +52,7 @@ public class InstructionAdapter extends MethodVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public InstructionAdapter(final MethodVisitor mv) {
this(Opcodes.ASM7, mv);
this(Opcodes.ASM6, mv);
if (getClass() != InstructionAdapter.class) {
throw new IllegalStateException();
}
......@@ -62,7 +62,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param mv the method visitor to which this adapter delegates calls.
*/
protected InstructionAdapter(final int api, final MethodVisitor mv) {
......@@ -629,7 +629,7 @@ public class InstructionAdapter extends MethodVisitor {
|| (value instanceof Type && ((Type) value).getSort() == Type.METHOD))) {
throw new UnsupportedOperationException();
}
if (api < Opcodes.ASM7 && value instanceof ConstantDynamic) {
if (api != Opcodes.ASM7_EXPERIMENTAL && value instanceof ConstantDynamic) {
throw new UnsupportedOperationException();
}
if (value instanceof Integer) {
......
......@@ -102,7 +102,7 @@ public class JSRInlinerAdapter extends MethodNode implements Opcodes {
final String desc,
final String signature,
final String[] exceptions) {
this(Opcodes.ASM7, mv, access, name, desc, signature, exceptions);
this(Opcodes.ASM6, mv, access, name, desc, signature, exceptions);
if (getClass() != JSRInlinerAdapter.class) {
throw new IllegalStateException();
}
......@@ -112,7 +112,7 @@ public class JSRInlinerAdapter extends MethodNode implements Opcodes {
* Constructs a new JSRInliner.
*
* @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}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param mv the <code>MethodVisitor</code> to send the resulting inlined method code to (use
* <code>null</code> for none).
* @param access the method's access flags (see {@link Opcodes}). This parameter also indicates if
......
......@@ -76,7 +76,7 @@ public class LocalVariablesSorter extends MethodVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public LocalVariablesSorter(final int access, final String desc, final MethodVisitor mv) {
this(Opcodes.ASM7, access, desc, mv);
this(Opcodes.ASM6, access, desc, mv);
if (getClass() != LocalVariablesSorter.class) {
throw new IllegalStateException();
}
......@@ -86,7 +86,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param access access flags of the adapted method.
* @param desc the method's descriptor (see {@link Type Type}).
* @param mv the method visitor to which this adapter delegates calls.
......
......@@ -45,7 +45,7 @@ public class MethodRemapper extends MethodVisitor {
protected final Remapper remapper;
public MethodRemapper(final MethodVisitor mv, final Remapper remapper) {
this(Opcodes.ASM7, mv, remapper);
this(Opcodes.ASM6, mv, remapper);
}
protected MethodRemapper(final int api, final MethodVisitor mv, final Remapper remapper) {
......
......@@ -40,7 +40,7 @@ public class ModuleRemapper extends ModuleVisitor {
private final Remapper remapper;
public ModuleRemapper(final ModuleVisitor mv, final Remapper remapper) {
this(Opcodes.ASM7, mv, remapper);
this(Opcodes.ASM6, mv, remapper);
}
protected ModuleRemapper(final int api, final ModuleVisitor mv, final Remapper remapper) {
......
......@@ -145,7 +145,7 @@ public class SerialVersionUIDAdder extends ClassVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public SerialVersionUIDAdder(final ClassVisitor cv) {
this(Opcodes.ASM7, cv);
this(Opcodes.ASM6, cv);
if (getClass() != SerialVersionUIDAdder.class) {
throw new IllegalStateException();
}
......@@ -155,7 +155,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param cv a {@link ClassVisitor} to which this visitor will delegate calls.
*/
protected SerialVersionUIDAdder(final int api, final ClassVisitor cv) {
......
......@@ -47,7 +47,7 @@ public class SignatureRemapper extends SignatureVisitor {
private Stack<String> classNames = new Stack<String>();
public SignatureRemapper(final SignatureVisitor v, final Remapper remapper) {
this(Opcodes.ASM7, v, remapper);
this(Opcodes.ASM6, v, remapper);
}
protected SignatureRemapper(final int api, final SignatureVisitor v, final Remapper remapper) {
......
......@@ -47,7 +47,7 @@ public class StaticInitMerger extends ClassVisitor {
private int counter;
public StaticInitMerger(final String prefix, final ClassVisitor cv) {
this(Opcodes.ASM7, prefix, cv);
this(Opcodes.ASM6, prefix, cv);
}
protected StaticInitMerger(final int api, final String prefix, final ClassVisitor cv) {
......
......@@ -57,7 +57,7 @@ public class TryCatchBlockSorter extends MethodNode {
final String desc,
final String signature,
final String[] exceptions) {
this(Opcodes.ASM7, mv, access, name, desc, signature, exceptions);
this(Opcodes.ASM6, mv, access, name, desc, signature, exceptions);
}
protected TryCatchBlockSorter(
......
......@@ -132,7 +132,7 @@ public class AnalyzerAdapterTest extends AsmTest {
private boolean hasOriginalFrame;
public AnalyzedFramesInserter(MethodVisitor mv) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM7_EXPERIMENTAL, mv);
}
@Override
......
......@@ -807,7 +807,7 @@ public class GeneratorAdapterTest {
textifier = new Textifier();
generatorAdapter =
new GeneratorAdapter(
Opcodes.ASM7, new TraceMethodVisitor(textifier), access, name, descriptor);
Opcodes.ASM7_EXPERIMENTAL, new TraceMethodVisitor(textifier), access, name, descriptor);
}
public String push(final boolean value) {
......
......@@ -90,7 +90,7 @@ public class LocalVariablesSorterTest extends AsmTest {
new ClassReader(new FileInputStream("src/test/resources/Issue317586.class"));
ClassWriter classWriter = new ClassWriter(0);
ClassVisitor classVisitor =
new ClassVisitor(Opcodes.ASM7, classWriter) {
new ClassVisitor(Opcodes.ASM7_EXPERIMENTAL, classWriter) {
@Override
public MethodVisitor visitMethod(
final int access,
......
......@@ -230,7 +230,7 @@ public abstract class AsmTest {
ASM4("ASM4", 4 << 16),
ASM5("ASM5", 5 << 16),
ASM6("ASM6", 6 << 16),
ASM7("ASM7", 7 << 16);
ASM7("ASM7", 1 << 24 | 7 << 16);
private final String name;
private final int value;
......
......@@ -73,7 +73,7 @@ public class AsmTestTest extends AsmTest {
@MethodSource(ALL_CLASSES_AND_LATEST_API)
public void testGetBytes(final PrecompiledClass classParameter, final Api apiParameter) {
assertEquals(Api.ASM7, apiParameter);
assertEquals(0x00070000, apiParameter.value());
assertEquals(0x01070000, apiParameter.value());
assertEquals("ASM7", apiParameter.toString());
byte[] classContent = classParameter.getBytes();
assertThatClass(classContent).contains(classParameter.getInternalName());
......
......@@ -61,7 +61,7 @@ public class AnnotationNode extends AnnotationVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public AnnotationNode(final String descriptor) {
this(Opcodes.ASM7, descriptor);
this(Opcodes.ASM6, descriptor);
if (getClass() != AnnotationNode.class) {
throw new IllegalStateException();
}
......@@ -71,7 +71,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param descriptor the class descriptor of the annotation class.
*/
public AnnotationNode(final int api, final String descriptor) {
......@@ -85,7 +85,7 @@ public class AnnotationNode extends AnnotationVisitor {
* @param values where the visited values must be stored.
*/
AnnotationNode(final List<Object> values) {
super(Opcodes.ASM7);
super(Opcodes.ASM6);
this.values = values;
}
......@@ -174,7 +174,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} or {@link Opcodes#ASM7}.
* {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
public void check(final int api) {
// nothing to do
......
......@@ -134,7 +134,7 @@ public class ClassNode extends ClassVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public ClassNode() {
this(Opcodes.ASM7);
this(Opcodes.ASM6);
if (getClass() != ClassNode.class) {
throw new IllegalStateException();
}
......@@ -144,7 +144,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
public ClassNode(final int api) {
super(api);
......@@ -282,7 +282,7 @@ 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} or {@link Opcodes#ASM7}.
* {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
public void check(final int api) {
if (api < Opcodes.ASM6 && module != null) {
......
......@@ -101,7 +101,7 @@ public class FieldNode extends FieldVisitor {
final String descriptor,
final String signature,
final Object value) {
this(Opcodes.ASM7, access, name, descriptor, signature, value);
this(Opcodes.ASM6, access, name, descriptor, signature, value);
if (getClass() != FieldNode.class) {
throw new IllegalStateException();
}
......@@ -198,7 +198,7 @@ public class FieldNode extends FieldVisitor {
* 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} or {@link Opcodes#ASM7}.
* {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
public void check(final int api) {
if (api == Opcodes.ASM4) {
......
......@@ -85,14 +85,14 @@ public class LocalVariableAnnotationNode extends TypeAnnotationNode {
final LabelNode[] end,
final int[] index,
final String descriptor) {
this(Opcodes.ASM7, typeRef, typePath, start, end, index, descriptor);
this(Opcodes.ASM6, 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param typeRef a reference to the annotated type. See {@link org.objectweb.asm.TypeReference}.
* @param start the fist instructions corresponding to the continuous ranges that make the scope
* of this local variable (inclusive).
......
......@@ -156,7 +156,7 @@ public class MethodNode extends MethodVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public MethodNode() {
this(Opcodes.ASM7);
this(Opcodes.ASM6);
if (getClass() != MethodNode.class) {
throw new IllegalStateException();
}
......@@ -166,7 +166,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
public MethodNode(final int api) {
super(api);
......@@ -192,7 +192,7 @@ public class MethodNode extends MethodVisitor {
final String descriptor,
final String signature,
final String[] exceptions) {
this(Opcodes.ASM7, access, name, descriptor, signature, exceptions);
this(Opcodes.ASM6, access, name, descriptor, signature, exceptions);
if (getClass() != MethodNode.class) {
throw new IllegalStateException();
}
......@@ -202,7 +202,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @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.
......@@ -605,7 +605,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} or {@link Opcodes#ASM7}.
* {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
*/
public void check(final int api) {
if (api == Opcodes.ASM4) {
......@@ -660,7 +660,7 @@ public class MethodNode extends MethodVisitor {
throw new UnsupportedClassVersionException();
}
}
if (api < Opcodes.ASM7) {
if (api != Opcodes.ASM7_EXPERIMENTAL) {
for (int i = instructions.size() - 1; i >= 0; --i) {
AbstractInsnNode insn = instructions.get(i);
if (insn instanceof LdcInsnNode) {
......
......@@ -85,7 +85,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(Opcodes.ASM7);
super(Opcodes.ASM6);
if (getClass() != ModuleNode.class) {
throw new IllegalStateException();
}
......@@ -99,7 +99,7 @@ public class ModuleNode extends ModuleVisitor {
* Constructs a {@link ModuleNode}.
*
* @param api the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM6} or
* {@link Opcodes#ASM7}.
* {@link Opcodes#ASM7_EXPERIMENTAL}.
* @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}.
......
......@@ -59,7 +59,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(Opcodes.ASM7, typeRef, typePath, descriptor);
this(Opcodes.ASM6, typeRef, typePath, descriptor);
if (getClass() != TypeAnnotationNode.class) {
throw new IllegalStateException();
}
......@@ -69,7 +69,7 @@ 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} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param typeRef a reference to the annotated type. See {@link 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 <tt>null</tt> if the annotation targets
......
......@@ -81,9 +81,9 @@ public class ClassNodeTest extends AsmTest implements Opcodes {
assertEquals("1.0", moduleNode.version);
ModuleNode otherModuleNode =
new ModuleNode(Opcodes.ASM7, "otherModule", 456, "2.0", null, null, null, null, null);
new ModuleNode(Opcodes.ASM7_EXPERIMENTAL, "otherModule", 456, "2.0", null, null, null, null, null);
moduleNode.accept(
new ClassVisitor(Opcodes.ASM7) {
new ClassVisitor(Opcodes.ASM7_EXPERIMENTAL) {
@Override
public ModuleVisitor visitModule(
final String name, final int access, final String version) {
......@@ -150,7 +150,7 @@ public class ClassNodeTest extends AsmTest implements Opcodes {
assertEquals("value", annotationNode.values.get(17));
annotationNode.accept(
new AnnotationVisitor(Opcodes.ASM7) {
new AnnotationVisitor(Opcodes.ASM7_EXPERIMENTAL) {
@Override
public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
......
......@@ -721,7 +721,7 @@ public class InsnListTest {
final InsnList insnList = new InsnList();
list1.accept(
new MethodVisitor(Opcodes.ASM7) {
new MethodVisitor(Opcodes.ASM7_EXPERIMENTAL) {
@Override
public void visitInsn(final int opcode) {
insnList.add(new InsnNode(opcode));
......
......@@ -99,7 +99,7 @@ public class ASMifier extends Printer {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public ASMifier() {
this(Opcodes.ASM7, "classWriter", 0);
this(Opcodes.ASM6, "classWriter", 0);
if (getClass() != ASMifier.class) {
throw new IllegalStateException();
}
......@@ -109,7 +109,7 @@ public class ASMifier extends Printer {
* Constructs a new {@link ASMifier}.
*
* @param api the ASM API version implemented by this class. Must be one of {@link Opcodes#ASM4},
* {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
* {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7_EXPERIMENTAL}.
* @param visitorVariableName the name of the visitor variable in the produced code.
* @param annotationVisitorId identifier of the annotation visitor variable in the produced code.
*/
......@@ -1175,7 +1175,7 @@ public class ASMifier extends Printer {
*/
protected ASMifier createASMifier(
final String visitorVariableName, final int annotationVisitorId) {
return new ASMifier(Opcodes.ASM7, visitorVariableName, annotationVisitorId);
return new ASMifier(Opcodes.ASM6, visitorVariableName, annotationVisitorId);
}
/**
......
......@@ -52,7 +52,7 @@ public class CheckAnnotationAdapter extends AnnotationVisitor {
}
CheckAnnotationAdapter(final AnnotationVisitor annotationVisitor, final boolean useNamedValues) {
super(Opcodes.ASM7, annotationVisitor);
super(Opcodes.ASM6, annotationVisitor);
this.useNamedValue = useNamedValues;
}
......
......@@ -191,7 +191,7 @@ public class CheckClassAdapter extends ClassVisitor {
final boolean printResults,
final PrintWriter printWriter) {
ClassNode classNode = new ClassNode();
classReader.accept(new CheckClassAdapter(classNode, false), ClassReader.SKIP_DEBUG);
classReader.accept(new CheckClassAdapter(Opcodes.ASM7_EXPERIMENTAL, classNode, false) {}, ClassReader.SKIP_DEBUG);
Type syperType = classNode.superName == null ? null : Type.getObjectType(classNode.superName);
List<MethodNode> methods = classNode.methods;
......@@ -297,7 +297,7 @@ public class CheckClassAdapter extends ClassVisitor {
* @throws IllegalStateException If a subclass calls this constructor.
*/
public CheckClassAdapter(final ClassVisitor classVisitor, final boolean checkDataFlow) {
this(Opcodes.ASM7, classVisitor, checkDataFlow);