/** * Returns the LabelNode corresponding to the given Label. Creates a new * LabelNode if necessary. The default implementation of this method uses * the {@link Label#info} field to store associations between labels and * label nodes. * * @param l * a Label. * @return the LabelNode corresponding to l. */ protected LabelNode getLabelNode(final Label l) { if (!(l.info instanceof LabelNode)) { l.info = new LabelNode(); } return (LabelNode) l.info; }
private static Object[] asArray(final List<Object> l) { Object[] objs = new Object[l.size()]; for (int i = 0; i < objs.length; ++i) { Object o = l.get(i); if (o instanceof LabelNode) { o = ((LabelNode) o).getLabel(); } objs[i] = o; } return objs; } }
/** * Reset all labels in the instruction list. This method should be called * before reusing same instructions list between several * <code>ClassWriter</code>s. */ public void resetLabels() { AbstractInsnNode insn = first; while (insn != null) { if (insn instanceof LabelNode) { ((LabelNode) insn).resetLabel(); } insn = insn.next; } }
if (fieldEntry.getterDescriptorToAvoidIllegalAccessing != null || fieldEntry.setterDescriptorToAvoidIllegalAccessing != null) { LabelNode tryLabelNode = new LabelNode(new Label()); LabelNode endTryLabelNode = new LabelNode(new Label()); LabelNode catchNoSuchFieldLabelNode = new LabelNode(new Label()); LabelNode catchClassNotFoundLabelNode = new LabelNode(new Label()); LabelNode endCatchLabelNode = new LabelNode(new Label()); tmpTryCatchBlocks.add( new TryCatchBlockNode( if (methodEntry.descriptorToAvoidIllegalAccessing != null) { Type[] parameterTypes = Type.getArgumentTypes(methodEntry.getDescriptor().desc); LabelNode tryLabelNode = new LabelNode(new Label()); LabelNode endTryLabelNode = new LabelNode(new Label()); LabelNode catchNoSuchMethodLabelNode = new LabelNode(new Label()); LabelNode catchClassNotFoundLabelNode = new LabelNode(new Label()); LabelNode endCatchLabelNode = new LabelNode(new Label()); tmpTryCatchBlocks.add( new TryCatchBlockNode(
@Override public void accept(final MethodVisitor mv) { mv.visitLineNumber(line, start.getLabel()); }
@Override public void accept(final MethodVisitor cv) { cv.visitLabel(getLabel()); }
@Override public void accept(final MethodVisitor mv) { int[] keys = new int[this.keys.size()]; for (int i = 0; i < keys.length; ++i) { keys[i] = this.keys.get(i).intValue(); } Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = this.labels.get(i).getLabel(); } mv.visitLookupSwitchInsn(dflt.getLabel(), keys, labels); acceptAnnotations(mv); }
Type returnType = Type.getReturnType(methodEntry.getDescriptor().desc); Type[] parameterTypes = Type.getArgumentTypes(methodEntry.getDescriptor().desc); LabelNode tryLabelNode = new LabelNode(new Label()); LabelNode catchIllegalAccessLabelNode = new LabelNode(new Label()); LabelNode catchInvocationTargetLabelNode = new LabelNode(new Label());
/** * Makes the given visitor visit this type annotation. * * @param mv * the visitor that must visit this annotation. * @param visible * <tt>true</tt> if the annotation is visible at runtime. */ public void accept(final MethodVisitor mv, boolean visible) { Label[] start = new Label[this.start.size()]; Label[] end = new Label[this.end.size()]; int[] index = new int[this.index.size()]; for (int i = 0; i < start.length; ++i) { start[i] = this.start.get(i).getLabel(); end[i] = this.end.get(i).getLabel(); index[i] = this.index.get(i); } accept(mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible)); } }
LabelNode useDistinctLabelNode = new LabelNode(); instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); instructions.add(
@Override public void accept(final MethodVisitor mv) { mv.visitJumpInsn(opcode, label.getLabel()); acceptAnnotations(mv); }
/** * Makes the given visitor visit this try catch block. * * @param mv * a method visitor. */ public void accept(final MethodVisitor mv) { mv.visitTryCatchBlock(start.getLabel(), end.getLabel(), handler == null ? null : handler.getLabel(), type); int n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations .size(); for (int i = 0; i < n; ++i) { TypeAnnotationNode an = visibleTypeAnnotations.get(i); an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath, an.desc, true)); } n = invisibleTypeAnnotations == null ? 0 : invisibleTypeAnnotations .size(); for (int i = 0; i < n; ++i) { TypeAnnotationNode an = invisibleTypeAnnotations.get(i); an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath, an.desc, false)); } } }