TryCatch(GeneratorAdapter generatorAdapter, Type type) { this.generatorAdapter = generatorAdapter; this.start = generatorAdapter.mark(); this.end = new Label(); this.handler = new Label(); generatorAdapter.visitTryCatchBlock(start, end, handler, type.getInternalName()); }
TryCatch(GeneratorAdapter generatorAdapter, Type type) { this.generatorAdapter = generatorAdapter; this.start = generatorAdapter.mark(); this.end = new Label(); this.handler = new Label(); generatorAdapter.visitTryCatchBlock(start, end, handler, type.getInternalName()); }
Label l1 = new Label(); Label l2 = new Label(); swapGenerator.visitTryCatchBlock( l0, l1,
l1 = new Label(); l2 = new Label(); interceptedTargetVisitor.visitTryCatchBlock( l0, l1,
@Override public void visitTryCatchBlock(final Label start, final Label end, final Label handler, final String type) { super.visitTryCatchBlock(start, end, handler, type); // By definition of 'forwardJumpStackFrames', 'handler' should be pushed only if there is an // instruction between 'start' and 'end' at which the super class constructor is not yet // called. Unfortunately, try catch blocks must be visited before their labels, so we have // no // way to know this at this point. Instead, we suppose that the super class constructor has // not // been called at the start of *any* exception handler. If this is wrong, normally there // should // not be a second super class constructor call in the exception handler (an object can't be // initialized twice), so this is not issue (in the sense that there is no risk to emit a // wrong // 'onMethodEnter'). if (stackFrameTracking && !forwardJumpStackFrames.containsKey(handler)) { List<Object> handlerStackFrame = new ArrayList<Object>(); handlerStackFrame.add(OTHER); forwardJumpStackFrames.put(handler, handlerStackFrame); } }
SynchronizedMethodTransformer(GeneratorAdapter mv, String className, String methodName, String fileName, int access, int classVersion) { super(mv, className, methodName, fileName); this.className = className; this.classVersion = classVersion; this.isSynchronized = (access & ACC_SYNCHRONIZED) != 0; this.isStatic = (access & ACC_STATIC) != 0; if (isSynchronized) { mv.visitTryCatchBlock(tryLabel, catchLabel, catchLabel, null); } }
@Override public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { exceptionHandlers.add(handler); super.visitTryCatchBlock(start, end, handler, type); }
@Override public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { super.visitTryCatchBlock(start, end, handler, type); if (constructor && !branches.containsKey(handler)) { List<Object> stackFrame = new ArrayList<Object>(); stackFrame.add(OTHER); branches.put(handler, stackFrame); } }
@Override public void visitEnd() { // regenerate try-catch table for (TryCatchBlock tryCatchBlock : instrumentedTryCatchBlocks) { super.visitTryCatchBlock(tryCatchBlock.start, tryCatchBlock.end, tryCatchBlock.handler, tryCatchBlock.type); } for (TryCatchBlock tryCatchBlock : tryCatchBlocks) { super.visitTryCatchBlock(tryCatchBlock.start, tryCatchBlock.end, tryCatchBlock.handler, tryCatchBlock.type); } super.visitEnd(); }
@Override public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { super.visitTryCatchBlock(start, end, handler, type); // By definition of 'forwardJumpStackFrames', 'handler' should be pushed only if there is an // instruction between 'start' and 'end' at which the super class constructor is not yet // called. Unfortunately, try catch blocks must be visited before their labels, so we have no // way to know this at this point. Instead, we suppose that the super class constructor has not // been called at the start of *any* exception handler. If this is wrong, normally there should // not be a second super class constructor call in the exception handler (an object can't be // initialized twice), so this is not issue (in the sense that there is no risk to emit a wrong // 'onMethodEnter'). if (isConstructor && !forwardJumpStackFrames.containsKey(handler)) { List<Object> handlerStackFrame = new ArrayList<Object>(); handlerStackFrame.add(OTHER); forwardJumpStackFrames.put(handler, handlerStackFrame); } }
@Override public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { super.visitTryCatchBlock(start, end, handler, type); // By definition of 'forwardJumpStackFrames', 'handler' should be pushed only if there is an // instruction between 'start' and 'end' at which the super class constructor is not yet // called. Unfortunately, try catch blocks must be visited before their labels, so we have no // way to know this at this point. Instead, we suppose that the super class constructor has not // been called at the start of *any* exception handler. If this is wrong, normally there should // not be a second super class constructor call in the exception handler (an object can't be // initialized twice), so this is not issue (in the sense that there is no risk to emit a wrong // 'onMethodEnter'). if (isConstructor && !forwardJumpStackFrames.containsKey(handler)) { List<Object> handlerStackFrame = new ArrayList<Object>(); handlerStackFrame.add(OTHER); forwardJumpStackFrames.put(handler, handlerStackFrame); } }
TryCatch(GeneratorAdapter generatorAdapter, Type type) { this.generatorAdapter = generatorAdapter; this.start = generatorAdapter.mark(); this.end = new Label(); this.handler = new Label(); generatorAdapter.visitTryCatchBlock(start, end, handler, type.getInternalName()); }
TryCatch(GeneratorAdapter generatorAdapter, Type type) { this.generatorAdapter = generatorAdapter; this.start = generatorAdapter.mark(); this.end = new Label(); this.handler = new Label(); generatorAdapter.visitTryCatchBlock(start, end, handler, type.getInternalName()); }
@Override public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { super.visitTryCatchBlock(start, end, handler, type); // By definition of 'forwardJumpStackFrames', 'handler' should be pushed only if there is an // instruction between 'start' and 'end' at which the super class constructor is not yet // called. Unfortunately, try catch blocks must be visited before their labels, so we have no // way to know this at this point. Instead, we suppose that the super class constructor has not // been called at the start of *any* exception handler. If this is wrong, normally there should // not be a second super class constructor call in the exception handler (an object can't be // initialized twice), so this is not issue (in the sense that there is no risk to emit a wrong // 'onMethodEnter'). if (isConstructor && !forwardJumpStackFrames.containsKey(handler)) { List<Object> handlerStackFrame = new ArrayList<Object>(); handlerStackFrame.add(OTHER); forwardJumpStackFrames.put(handler, handlerStackFrame); } }
Label catchLabel = mv.newLabel(); Label endLabel = mv.newLabel(); mv.visitTryCatchBlock(tryLabel, catchLabel, catchLabel, null);
Label endTry = mg.newLabel(); Label catchHandle = mg.newLabel(); mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(IllegalAccessException.class)); mg.mark(beginTry); mg.loadThis();
Label endTry = mg.newLabel(); Label catchHandle = mg.newLabel(); mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(IllegalAccessException.class)); mg.mark(beginTry); mg.loadThis();
Label endTry = mg.newLabel(); Label catchHandle = mg.newLabel(); mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(IllegalAccessException.class)); mg.mark(beginTry); mg.loadThis();
Label endTry = mg.newLabel(); Label catchHandle = mg.newLabel(); mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(Exception.class)); mg.mark(beginTry);
Label l0 = new Label(); Label l1 = new Label(); mv.visitTryCatchBlock(l0, l1, l1, null);