public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { mv.visitTryCatchBlock(start, end, handler, type); }
/** * Visits a try catch block. * * @param start the beginning of the exception handler's scope (inclusive). * @param end the end of the exception handler's scope (exclusive). * @param handler the beginning of the exception handler's code. * @param type the internal name of the type of exceptions handled by the handler, or {@literal * null} to catch any exceptions (for "finally" blocks). * @throws IllegalArgumentException if one of the labels has already been visited by this visitor * (by the {@link #visitLabel} method). */ public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { if (mv != null) { mv.visitTryCatchBlock(start, end, handler, type); } }
/** * Visits a try catch block. * * @param start * beginning of the exception handler's scope (inclusive). * @param end * end of the exception handler's scope (exclusive). * @param handler * beginning of the exception handler's code. * @param type * internal name of the type of exceptions handled by the * handler, or <tt>null</tt> to catch any exceptions (for * "finally" blocks). * @throws IllegalArgumentException * if one of the labels has already been visited by this visitor * (by the {@link #visitLabel visitLabel} method). */ public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { if (mv != null) { mv.visitTryCatchBlock(start, end, handler, type); } }
@Override public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { super.visitTryCatchBlock(start, end, handler, type == null ? null : remapper.mapType(type)); }
@Override public void visitTryCatchBlock(final Label start, final Label end, final Label handler, final String type) { p.visitTryCatchBlock(start, end, handler, type); super.visitTryCatchBlock(start, end, handler, type); }
@Override public final void begin(final String name, final Attributes attrs) { Label start = getLabel(attrs.getValue("start")); Label end = getLabel(attrs.getValue("end")); Label handler = getLabel(attrs.getValue("handler")); String type = attrs.getValue("type"); getCodeVisitor().visitTryCatchBlock(start, end, handler, type); } }
public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { buf.setLength(0); buf.append(tab2).append("TRYCATCHBLOCK "); appendLabel(start); buf.append(' '); appendLabel(end); buf.append(' '); appendLabel(handler); buf.append(' '); appendDescriptor(INTERNAL_NAME, type); buf.append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitTryCatchBlock(start, end, handler, type); } }
/** * Marks the start of an exception handler. * * @param start * beginning of the exception handler's scope (inclusive). * @param end * end of the exception handler's scope (exclusive). * @param exception * internal name of the type of exceptions handled by the * handler. */ public void catchException(final Label start, final Label end, final Type exception) { Label doCatch = new Label(); if (exception == null) { mv.visitTryCatchBlock(start, end, doCatch, null); } else { mv.visitTryCatchBlock(start, end, doCatch, exception.getInternalName()); } mark(doCatch); } }
@Override public void visitTryCatchBlock(final Label start, final Label end, final Label handler, final String type) { checkStartCode(); checkEndCode(); checkLabel(start, false, "start label"); checkLabel(end, false, "end label"); checkLabel(handler, false, "handler label"); checkNonDebugLabel(start); checkNonDebugLabel(end); checkNonDebugLabel(handler); if (labels.get(start) != null || labels.get(end) != null || labels.get(handler) != null) { throw new IllegalStateException( "Try catch blocks must be visited before their labels"); } if (type != null) { checkInternalName(type, "type"); } super.visitTryCatchBlock(start, end, handler, type); handlers.add(start); handlers.add(end); }
/** * 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)); } } }
tryOk = new Label(); inCatch = new Label(); mv.visitTryCatchBlock(beforeTry, tryOk, inCatch, "java/lang/NumberFormatException"); mv.visitLabel(beforeTry);
mv.visitTryCatchBlock(start, end, handler, null); mv.visitTryCatchBlock(start, end, handler,
Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(syncStart, l1, l2, null); Label l3 = new Label(); mv.visitTryCatchBlock(l2, l3, l2, null); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(DUP);
Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(syncStart, l1, l2, null); Label l3 = new Label(); mv.visitTryCatchBlock(l2, l3, l2, null); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(DUP);
String catchType = readUTF8(cpInfoOffsets[readUnsignedShort(currentOffset + 6)], charBuffer); currentOffset += 8; methodVisitor.visitTryCatchBlock(start, end, handler, catchType);
Label handler = createLabel(readUnsignedShort(u + 6), labels); String type = readUTF8(items[readUnsignedShort(u + 8)], c); mv.visitTryCatchBlock(start, end, handler, type); u += 8;