232 * list of {@link LocalVariableAnnotationNode} objects. May be <tt>null</tt>
233 *
234 * @associates jdk.internal.org.objectweb.asm.tree.LocalVariableAnnotationNode
235 */
236 public List<LocalVariableAnnotationNode> invisibleLocalVariableAnnotations;
237
238 /**
239 * If the accept method has been called on this object.
240 */
241 private boolean visited;
242
243 /**
244 * Constructs an uninitialized {@link MethodNode}. <i>Subclasses must not
245 * use this constructor</i>. Instead, they must use the
246 * {@link #MethodNode(int)} version.
247 *
248 * @throws IllegalStateException
249 * If a subclass calls this constructor.
250 */
251 public MethodNode() {
252 this(Opcodes.ASM5);
253 if (getClass() != MethodNode.class) {
254 throw new IllegalStateException();
255 }
256 }
257
258 /**
259 * Constructs an uninitialized {@link MethodNode}.
260 *
261 * @param api
262 * the ASM API version implemented by this visitor. Must be one
263 * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
264 */
265 public MethodNode(final int api) {
266 super(api);
267 this.instructions = new InsnList();
268 }
269
270 /**
271 * Constructs a new {@link MethodNode}. <i>Subclasses must not use this
272 * constructor</i>. Instead, they must use the
273 * {@link #MethodNode(int, int, String, String, String, String[])} version.
274 *
275 * @param access
276 * the method's access flags (see {@link Opcodes}). This
277 * parameter also indicates if the method is synthetic and/or
278 * deprecated.
279 * @param name
280 * the method's name.
281 * @param desc
282 * the method's descriptor (see {@link Type}).
283 * @param signature
284 * the method's signature. May be <tt>null</tt>.
285 * @param exceptions
286 * the internal names of the method's exception classes (see
287 * {@link Type#getInternalName() getInternalName}). May be
288 * <tt>null</tt>.
289 * @throws IllegalStateException
290 * If a subclass calls this constructor.
291 */
292 public MethodNode(final int access, final String name, final String desc,
293 final String signature, final String[] exceptions) {
294 this(Opcodes.ASM5, access, name, desc, signature, exceptions);
295 if (getClass() != MethodNode.class) {
296 throw new IllegalStateException();
297 }
298 }
299
300 /**
301 * Constructs a new {@link MethodNode}.
302 *
303 * @param api
304 * the ASM API version implemented by this visitor. Must be one
305 * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
306 * @param access
307 * the method's access flags (see {@link Opcodes}). This
308 * parameter also indicates if the method is synthetic and/or
309 * deprecated.
310 * @param name
311 * the method's name.
312 * @param desc
313 * the method's descriptor (see {@link Type}).
314 * @param signature
315 * the method's signature. May be <tt>null</tt>.
316 * @param exceptions
317 * the internal names of the method's exception classes (see
318 * {@link Type#getInternalName() getInternalName}). May be
319 * <tt>null</tt>.
320 */
321 public MethodNode(final int api, final int access, final String name,
322 final String desc, final String signature, final String[] exceptions) {
323 super(api);
324 this.access = access;
325 this.name = name;
671 Object o = objs[i];
672 if (o instanceof Label) {
673 o = getLabelNode((Label) o);
674 }
675 nodes[i] = o;
676 }
677 return nodes;
678 }
679
680 // ------------------------------------------------------------------------
681 // Accept method
682 // ------------------------------------------------------------------------
683
684 /**
685 * Checks that this method node is compatible with the given ASM API
686 * version. This methods checks that this node, and all its nodes
687 * recursively, do not contain elements that were introduced in more recent
688 * versions of the ASM API than the given version.
689 *
690 * @param api
691 * an ASM API version. Must be one of {@link Opcodes#ASM4} or
692 * {@link Opcodes#ASM5}.
693 */
694 public void check(final int api) {
695 if (api == Opcodes.ASM4) {
696 if (visibleTypeAnnotations != null
697 && visibleTypeAnnotations.size() > 0) {
698 throw new RuntimeException();
699 }
700 if (invisibleTypeAnnotations != null
701 && invisibleTypeAnnotations.size() > 0) {
702 throw new RuntimeException();
703 }
704 int n = tryCatchBlocks == null ? 0 : tryCatchBlocks.size();
705 for (int i = 0; i < n; ++i) {
706 TryCatchBlockNode tcb = tryCatchBlocks.get(i);
707 if (tcb.visibleTypeAnnotations != null
708 && tcb.visibleTypeAnnotations.size() > 0) {
709 throw new RuntimeException();
710 }
711 if (tcb.invisibleTypeAnnotations != null
712 && tcb.invisibleTypeAnnotations.size() > 0) {
|
232 * list of {@link LocalVariableAnnotationNode} objects. May be <tt>null</tt>
233 *
234 * @associates jdk.internal.org.objectweb.asm.tree.LocalVariableAnnotationNode
235 */
236 public List<LocalVariableAnnotationNode> invisibleLocalVariableAnnotations;
237
238 /**
239 * If the accept method has been called on this object.
240 */
241 private boolean visited;
242
243 /**
244 * Constructs an uninitialized {@link MethodNode}. <i>Subclasses must not
245 * use this constructor</i>. Instead, they must use the
246 * {@link #MethodNode(int)} version.
247 *
248 * @throws IllegalStateException
249 * If a subclass calls this constructor.
250 */
251 public MethodNode() {
252 this(Opcodes.ASM6);
253 if (getClass() != MethodNode.class) {
254 throw new IllegalStateException();
255 }
256 }
257
258 /**
259 * Constructs an uninitialized {@link MethodNode}.
260 *
261 * @param api
262 * the ASM API version implemented by this visitor. Must be one
263 * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
264 */
265 public MethodNode(final int api) {
266 super(api);
267 this.instructions = new InsnList();
268 }
269
270 /**
271 * Constructs a new {@link MethodNode}. <i>Subclasses must not use this
272 * constructor</i>. Instead, they must use the
273 * {@link #MethodNode(int, int, String, String, String, String[])} version.
274 *
275 * @param access
276 * the method's access flags (see {@link Opcodes}). This
277 * parameter also indicates if the method is synthetic and/or
278 * deprecated.
279 * @param name
280 * the method's name.
281 * @param desc
282 * the method's descriptor (see {@link Type}).
283 * @param signature
284 * the method's signature. May be <tt>null</tt>.
285 * @param exceptions
286 * the internal names of the method's exception classes (see
287 * {@link Type#getInternalName() getInternalName}). May be
288 * <tt>null</tt>.
289 * @throws IllegalStateException
290 * If a subclass calls this constructor.
291 */
292 public MethodNode(final int access, final String name, final String desc,
293 final String signature, final String[] exceptions) {
294 this(Opcodes.ASM6, access, name, desc, signature, exceptions);
295 if (getClass() != MethodNode.class) {
296 throw new IllegalStateException();
297 }
298 }
299
300 /**
301 * Constructs a new {@link MethodNode}.
302 *
303 * @param api
304 * the ASM API version implemented by this visitor. Must be one
305 * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
306 * @param access
307 * the method's access flags (see {@link Opcodes}). This
308 * parameter also indicates if the method is synthetic and/or
309 * deprecated.
310 * @param name
311 * the method's name.
312 * @param desc
313 * the method's descriptor (see {@link Type}).
314 * @param signature
315 * the method's signature. May be <tt>null</tt>.
316 * @param exceptions
317 * the internal names of the method's exception classes (see
318 * {@link Type#getInternalName() getInternalName}). May be
319 * <tt>null</tt>.
320 */
321 public MethodNode(final int api, final int access, final String name,
322 final String desc, final String signature, final String[] exceptions) {
323 super(api);
324 this.access = access;
325 this.name = name;
671 Object o = objs[i];
672 if (o instanceof Label) {
673 o = getLabelNode((Label) o);
674 }
675 nodes[i] = o;
676 }
677 return nodes;
678 }
679
680 // ------------------------------------------------------------------------
681 // Accept method
682 // ------------------------------------------------------------------------
683
684 /**
685 * Checks that this method node is compatible with the given ASM API
686 * version. This methods checks that this node, and all its nodes
687 * recursively, do not contain elements that were introduced in more recent
688 * versions of the ASM API than the given version.
689 *
690 * @param api
691 * an ASM API version. Must be one of {@link Opcodes#ASM4},
692 * {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
693 */
694 public void check(final int api) {
695 if (api == Opcodes.ASM4) {
696 if (visibleTypeAnnotations != null
697 && visibleTypeAnnotations.size() > 0) {
698 throw new RuntimeException();
699 }
700 if (invisibleTypeAnnotations != null
701 && invisibleTypeAnnotations.size() > 0) {
702 throw new RuntimeException();
703 }
704 int n = tryCatchBlocks == null ? 0 : tryCatchBlocks.size();
705 for (int i = 0; i < n; ++i) {
706 TryCatchBlockNode tcb = tryCatchBlocks.get(i);
707 if (tcb.visibleTypeAnnotations != null
708 && tcb.visibleTypeAnnotations.size() > 0) {
709 throw new RuntimeException();
710 }
711 if (tcb.invisibleTypeAnnotations != null
712 && tcb.invisibleTypeAnnotations.size() > 0) {
|