103 * Index of the next local variable to be created by {@link #newLocal}.
104 */
105 protected int nextLocal;
106
107 /**
108 * Creates a new {@link LocalVariablesSorter}. <i>Subclasses must not use
109 * this constructor</i>. Instead, they must use the
110 * {@link #LocalVariablesSorter(int, int, String, MethodVisitor)} version.
111 *
112 * @param access
113 * access flags of the adapted method.
114 * @param desc
115 * the method's descriptor (see {@link Type Type}).
116 * @param mv
117 * the method visitor to which this adapter delegates calls.
118 * @throws IllegalStateException
119 * If a subclass calls this constructor.
120 */
121 public LocalVariablesSorter(final int access, final String desc,
122 final MethodVisitor mv) {
123 this(Opcodes.ASM5, access, desc, mv);
124 if (getClass() != LocalVariablesSorter.class) {
125 throw new IllegalStateException();
126 }
127 }
128
129 /**
130 * Creates a new {@link LocalVariablesSorter}.
131 *
132 * @param api
133 * the ASM API version implemented by this visitor. Must be one
134 * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
135 * @param access
136 * access flags of the adapted method.
137 * @param desc
138 * the method's descriptor (see {@link Type Type}).
139 * @param mv
140 * the method visitor to which this adapter delegates calls.
141 */
142 protected LocalVariablesSorter(final int api, final int access,
143 final String desc, final MethodVisitor mv) {
144 super(api, mv);
145 Type[] args = Type.getArgumentTypes(desc);
146 nextLocal = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0;
147 for (int i = 0; i < args.length; i++) {
148 nextLocal += args[i].getSize();
149 }
150 firstLocal = nextLocal;
151 }
152
153 @Override
154 public void visitVarInsn(final int opcode, final int var) {
|
103 * Index of the next local variable to be created by {@link #newLocal}.
104 */
105 protected int nextLocal;
106
107 /**
108 * Creates a new {@link LocalVariablesSorter}. <i>Subclasses must not use
109 * this constructor</i>. Instead, they must use the
110 * {@link #LocalVariablesSorter(int, int, String, MethodVisitor)} version.
111 *
112 * @param access
113 * access flags of the adapted method.
114 * @param desc
115 * the method's descriptor (see {@link Type Type}).
116 * @param mv
117 * the method visitor to which this adapter delegates calls.
118 * @throws IllegalStateException
119 * If a subclass calls this constructor.
120 */
121 public LocalVariablesSorter(final int access, final String desc,
122 final MethodVisitor mv) {
123 this(Opcodes.ASM6, access, desc, mv);
124 if (getClass() != LocalVariablesSorter.class) {
125 throw new IllegalStateException();
126 }
127 }
128
129 /**
130 * Creates a new {@link LocalVariablesSorter}.
131 *
132 * @param api
133 * the ASM API version implemented by this visitor. Must be one
134 * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
135 * @param access
136 * access flags of the adapted method.
137 * @param desc
138 * the method's descriptor (see {@link Type Type}).
139 * @param mv
140 * the method visitor to which this adapter delegates calls.
141 */
142 protected LocalVariablesSorter(final int api, final int access,
143 final String desc, final MethodVisitor mv) {
144 super(api, mv);
145 Type[] args = Type.getArgumentTypes(desc);
146 nextLocal = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0;
147 for (int i = 0; i < args.length; i++) {
148 nextLocal += args[i].getSize();
149 }
150 firstLocal = nextLocal;
151 }
152
153 @Override
154 public void visitVarInsn(final int opcode, final int var) {
|