List of usage examples for org.objectweb.asm Opcodes ATHROW
int ATHROW
To view the source code for org.objectweb.asm Opcodes ATHROW.
Click Source Link
From source file:org.jacoco.core.internal.analysis.filter.KotlinCoroutineFilterTest.java
License:Open Source License
/** * <pre>//ww w . j ava 2 s . c om * suspend fun example() { * suspendingFunction() * nop() * } * </pre> */ @Test public void should_filter_suspending_functions() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_STATIC, "example", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", null, null); context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC); final int continuationArgumentIndex = 0; final int continuationIndex = 2; m.visitVarInsn(Opcodes.ALOAD, continuationArgumentIndex); final Range range1 = new Range(); range1.fromInclusive = m.instructions.getLast(); m.visitTypeInsn(Opcodes.INSTANCEOF, "ExampleKt$example$1"); final Label createStateInstance = new Label(); m.visitJumpInsn(Opcodes.IFEQ, createStateInstance); m.visitVarInsn(Opcodes.ALOAD, continuationArgumentIndex); m.visitTypeInsn(Opcodes.CHECKCAST, "ExampleKt$example$1"); m.visitVarInsn(Opcodes.ASTORE, continuationIndex); m.visitVarInsn(Opcodes.ALOAD, continuationIndex); m.visitFieldInsn(Opcodes.GETFIELD, "ExampleKt$example$1", "label", "I"); m.visitLdcInsn(Integer.valueOf(Integer.MIN_VALUE)); m.visitInsn(Opcodes.IAND); m.visitJumpInsn(Opcodes.IFEQ, createStateInstance); m.visitVarInsn(Opcodes.ALOAD, continuationIndex); m.visitInsn(Opcodes.DUP); m.visitFieldInsn(Opcodes.GETFIELD, "ExampleKt$example$1", "label", "I"); m.visitLdcInsn(Integer.valueOf(Integer.MIN_VALUE)); m.visitInsn(Opcodes.ISUB); m.visitFieldInsn(Opcodes.PUTFIELD, "ExampleKt$example$1", "label", "I"); final Label afterCoroutineStateCreated = new Label(); m.visitJumpInsn(Opcodes.GOTO, afterCoroutineStateCreated); m.visitLabel(createStateInstance); m.visitTypeInsn(Opcodes.NEW, "ExampleKt$example$1"); m.visitInsn(Opcodes.DUP); m.visitVarInsn(Opcodes.ALOAD, continuationArgumentIndex); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "ExampleKt$example$1", "<init>", "(Lkotlin/coroutines/Continuation;)V", false); m.visitVarInsn(Opcodes.ASTORE, continuationIndex); m.visitLabel(afterCoroutineStateCreated); m.visitVarInsn(Opcodes.ALOAD, continuationIndex); m.visitFieldInsn(Opcodes.GETFIELD, "ExampleKt$example$1", "result", "Ljava/lang/Object;"); m.visitVarInsn(Opcodes.ASTORE, 1); m.visitMethodInsn(Opcodes.INVOKESTATIC, "kotlin/coroutines/intrinsics/IntrinsicsKt", "getCOROUTINE_SUSPENDED", "()Ljava/lang/Object;", false); // line of "fun" m.visitVarInsn(Opcodes.ASTORE, 3); m.visitVarInsn(Opcodes.ALOAD, continuationIndex); m.visitFieldInsn(Opcodes.GETFIELD, "ExampleKt$example$1", "label", "I"); final Label dflt = new Label(); final Label state0 = new Label(); final Label state1 = new Label(); m.visitTableSwitchInsn(0, 1, dflt, state0, state1); m.visitLabel(state0); { m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.DUP); m.visitTypeInsn(Opcodes.INSTANCEOF, "kotlin/Result$Failure"); Label label = new Label(); m.visitJumpInsn(Opcodes.IFEQ, label); m.visitTypeInsn(Opcodes.CHECKCAST, "kotlin/Result$Failure"); m.visitFieldInsn(Opcodes.GETFIELD, "kotlin/Result$Failure", "exception", "Ljava/lang/Throwable"); m.visitInsn(Opcodes.ATHROW); m.visitInsn(Opcodes.POP); range1.toInclusive = m.instructions.getLast(); m.visitLabel(label); } // line of "suspendingFunction" m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "", "suspendingFunction", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", false); m.visitInsn(Opcodes.DUP); final Range range2 = new Range(); range2.fromInclusive = m.instructions.getLast(); m.visitVarInsn(Opcodes.ALOAD, 3); final Label continuationLabelAfterLoadedResult = new Label(); m.visitJumpInsn(Opcodes.IF_ACMPNE, continuationLabelAfterLoadedResult); // line of "fun" m.visitVarInsn(Opcodes.ALOAD, 3); m.visitInsn(Opcodes.ARETURN); m.visitLabel(state1); { m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.DUP); m.visitTypeInsn(Opcodes.INSTANCEOF, "kotlin/Result$Failure"); final Label label = new Label(); m.visitJumpInsn(Opcodes.IFEQ, label); m.visitTypeInsn(Opcodes.CHECKCAST, "kotlin/Result$Failure"); m.visitFieldInsn(Opcodes.GETFIELD, "kotlin/Result$Failure", "exception", "Ljava/lang/Throwable"); m.visitInsn(Opcodes.ATHROW); m.visitInsn(Opcodes.POP); m.visitLabel(label); } m.visitVarInsn(Opcodes.ALOAD, 1); range2.toInclusive = m.instructions.getLast(); m.visitLabel(continuationLabelAfterLoadedResult); // line after "suspendingFunction" m.visitInsn(Opcodes.NOP); m.visitInsn(Opcodes.ARETURN); m.visitLabel(dflt); final Range range0 = new Range(); range0.fromInclusive = m.instructions.getLast(); m.visitTypeInsn(Opcodes.NEW, "java/lang/IllegalStateException"); m.visitInsn(Opcodes.DUP); m.visitLdcInsn("call to 'resume' before 'invoke' with coroutine"); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/IllegalStateException", "<init>", "(Ljava/lang/String;)V", false); m.visitInsn(Opcodes.ATHROW); range0.toInclusive = m.instructions.getLast(); filter.filter(m, context, output); assertIgnored(range0, range1, range2); }
From source file:org.jacoco.core.internal.analysis.filter.KotlinDefaultArgumentsFilterTest.java
License:Open Source License
/** * <pre>/*from w w w. j av a 2 s. com*/ * open class Open { * open fun foo(a: Int = 42) { * } * } * </pre> */ @Test public void should_filter_open_functions() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC, "foo$default", "(LOpen;IILjava/lang/Object;)V", null, null); context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC); { m.visitVarInsn(Opcodes.ALOAD, 3); final Label label = new Label(); m.visitJumpInsn(Opcodes.IFNULL, label); m.visitTypeInsn(Opcodes.NEW, "java/lang/UnsupportedOperationException"); m.visitInsn(Opcodes.DUP); m.visitLdcInsn("Super calls with default arguments not supported in this target, function: foo"); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/UnsupportedOperationException", "<init>", "(Ljava/lang/String;)V", false); m.visitInsn(Opcodes.ATHROW); m.visitLabel(label); } { m.visitVarInsn(Opcodes.ILOAD, 2); m.visitInsn(Opcodes.ICONST_1); m.visitInsn(Opcodes.IAND); final Label label = new Label(); m.visitJumpInsn(Opcodes.IFEQ, label); // default argument m.visitLdcInsn(Integer.valueOf(42)); m.visitVarInsn(Opcodes.ISTORE, 1); m.visitLabel(label); m.visitVarInsn(Opcodes.ALOAD, 0); m.visitVarInsn(Opcodes.ILOAD, 1); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "Open", "foo", "(I)V", false); m.visitInsn(Opcodes.RETURN); } filter.filter(m, context, output); assertIgnored(new Range(m.instructions.getFirst(), m.instructions.get(6)), new Range(m.instructions.get(11), m.instructions.get(11))); }
From source file:org.jacoco.core.internal.analysis.filter.KotlinUnsafeCastOperatorFilterTest.java
License:Open Source License
@Test public void should_filter() { final Label label = new Label(); m.visitInsn(Opcodes.DUP);//w w w . j a va2s . c o m m.visitJumpInsn(Opcodes.IFNONNULL, label); final AbstractInsnNode expectedFrom = m.instructions.getLast(); m.visitTypeInsn(Opcodes.NEW, "kotlin/TypeCastException"); m.visitInsn(Opcodes.DUP); m.visitLdcInsn("null cannot be cast to non-null type kotlin.String"); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "kotlin/TypeCastException", "<init>", "(Ljava/lang/String;)V", false); m.visitInsn(Opcodes.ATHROW); final AbstractInsnNode expectedTo = m.instructions.getLast(); m.visitLabel(label); filter.filter(m, context, output); assertIgnored(new Range(expectedFrom, expectedTo)); }
From source file:org.jacoco.core.internal.analysis.filter.KotlinWhenFilterTest.java
License:Open Source License
@Test public void should_filter_implicit_else() { final Label label = new Label(); final Range range1 = new Range(); m.visitInsn(Opcodes.NOP);/*ww w . ja v a2 s . com*/ m.visitJumpInsn(Opcodes.IFEQ, label); range1.fromInclusive = m.instructions.getLast(); range1.toInclusive = m.instructions.getLast(); m.visitInsn(Opcodes.NOP); final Range range2 = new Range(); m.visitLabel(label); range2.fromInclusive = m.instructions.getLast(); m.visitTypeInsn(Opcodes.NEW, "kotlin/NoWhenBranchMatchedException"); m.visitInsn(Opcodes.DUP); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "kotlin/NoWhenBranchMatchedException", "<init>", "()V", false); m.visitInsn(Opcodes.ATHROW); range2.toInclusive = m.instructions.getLast(); filter.filter(m, context, output); assertIgnored(range1, range2); assertNoReplacedBranches(); }
From source file:org.jacoco.core.internal.analysis.filter.KotlinWhenFilterTest.java
License:Open Source License
@Test public void should_not_filter_explicit_else() { final Label label = new Label(); m.visitInsn(Opcodes.NOP);//from w ww . java2s .c om m.visitJumpInsn(Opcodes.IFEQ, label); m.visitInsn(Opcodes.NOP); m.visitLabel(label); m.visitTypeInsn(Opcodes.NEW, "kotlin/NoWhenBranchMatchedException"); m.visitInsn(Opcodes.DUP); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "kotlin/NoWhenBranchMatchedException", "<init>", "()V", false); m.visitTypeInsn(Opcodes.CHECKCAST, "java/lang/Throwable"); m.visitInsn(Opcodes.ATHROW); filter.filter(m, context, output); assertIgnored(); assertNoReplacedBranches(); }
From source file:org.jacoco.core.internal.analysis.filter.KotlinWhenFilterTest.java
License:Open Source License
@Test public void should_filter_implicit_default() { final Label case1 = new Label(); final Label caseDefault = new Label(); final Label after = new Label(); m.visitInsn(Opcodes.NOP);/*from w w w . j a v a2 s . co m*/ m.visitTableSwitchInsn(0, 0, caseDefault, case1); final AbstractInsnNode switchNode = m.instructions.getLast(); final Set<AbstractInsnNode> newTargets = new HashSet<AbstractInsnNode>(); m.visitLabel(case1); m.visitInsn(Opcodes.ICONST_1); newTargets.add(m.instructions.getLast()); m.visitJumpInsn(Opcodes.GOTO, after); final Range range1 = new Range(); m.visitLabel(caseDefault); range1.fromInclusive = m.instructions.getLast(); m.visitTypeInsn(Opcodes.NEW, "kotlin/NoWhenBranchMatchedException"); m.visitInsn(Opcodes.DUP); m.visitMethodInsn(Opcodes.INVOKESPECIAL, "kotlin/NoWhenBranchMatchedException", "<init>", "()V", false); m.visitInsn(Opcodes.ATHROW); range1.toInclusive = m.instructions.getLast(); m.visitLabel(after); filter.filter(m, context, output); assertIgnored(range1); assertReplacedBranches(switchNode, newTargets); }
From source file:org.jacoco.core.internal.analysis.filter.SynchronizedFilterTest.java
License:Open Source License
@Test public void javac() { final Label start = new Label(); final Label end = new Label(); final Label handler = new Label(); final Label handlerEnd = new Label(); m.visitTryCatchBlock(start, end, handler, null); m.visitTryCatchBlock(handler, handlerEnd, handler, null); m.visitVarInsn(Opcodes.ALOAD, 0);//from www . java 2s .co m m.visitFieldInsn(Opcodes.GETFIELD, "Fun", "lock", "Ljava/lang/Object;"); m.visitInsn(Opcodes.DUP); m.visitVarInsn(Opcodes.ASTORE, 1); m.visitInsn(Opcodes.MONITORENTER); m.visitLabel(start); m.visitInsn(Opcodes.NOP); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.MONITOREXIT); m.visitLabel(end); final Label exit = new Label(); m.visitJumpInsn(Opcodes.GOTO, exit); m.visitLabel(handler); m.visitVarInsn(Opcodes.ASTORE, 2); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.MONITOREXIT); m.visitLabel(handlerEnd); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitInsn(Opcodes.ATHROW); m.visitLabel(exit); m.visitInsn(Opcodes.RETURN); filter.filter(m, context, output); assertIgnored(new Range((LabelNode) handler.info, ((LabelNode) exit.info).getPrevious())); }
From source file:org.jacoco.core.internal.analysis.filter.SynchronizedFilterTest.java
License:Open Source License
/** * <pre>//from w w w . j a v a 2 s . c o m * try { * ... * } catch (Exception e) { * ... * } finally { * ... * } * </pre> */ @Test public void javacTryCatchFinally() { final Label start = new Label(); final Label end = new Label(); final Label catchHandler = new Label(); final Label finallyHandler = new Label(); final Label catchHandlerEnd = new Label(); m.visitTryCatchBlock(start, end, catchHandler, "java/lang/Exception"); m.visitTryCatchBlock(start, end, finallyHandler, null); m.visitTryCatchBlock(catchHandler, catchHandlerEnd, finallyHandler, null); m.visitLabel(start); // body m.visitInsn(Opcodes.NOP); m.visitLabel(end); // finally m.visitInsn(Opcodes.NOP); final Label exit = new Label(); m.visitJumpInsn(Opcodes.GOTO, exit); m.visitLabel(catchHandler); m.visitVarInsn(Opcodes.ASTORE, 1); // catch m.visitInsn(Opcodes.NOP); m.visitLabel(catchHandlerEnd); // finally m.visitInsn(Opcodes.NOP); m.visitJumpInsn(Opcodes.GOTO, exit); m.visitLabel(finallyHandler); m.visitVarInsn(Opcodes.ASTORE, 2); // finally m.visitInsn(Opcodes.NOP); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitInsn(Opcodes.ATHROW); m.visitLabel(exit); m.visitInsn(Opcodes.RETURN); filter.filter(m, context, output); assertIgnored(); }
From source file:org.jacoco.core.internal.analysis.filter.SynchronizedFilterTest.java
License:Open Source License
@Test public void ecj() { final Label start = new Label(); final Label end = new Label(); final Label handler = new Label(); final Label handlerEnd = new Label(); m.visitTryCatchBlock(start, end, handler, null); m.visitTryCatchBlock(handler, handlerEnd, handler, null); m.visitVarInsn(Opcodes.ALOAD, 0);/*w ww.ja v a 2s . c o m*/ m.visitFieldInsn(Opcodes.GETFIELD, "Target", "lock", "Ljava/lang/Object;"); m.visitInsn(Opcodes.DUP); m.visitVarInsn(Opcodes.ASTORE, 1); m.visitInsn(Opcodes.MONITORENTER); m.visitLabel(start); m.visitVarInsn(Opcodes.ALOAD, 0); m.visitInsn(Opcodes.NOP); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.MONITOREXIT); m.visitLabel(end); final Label exit = new Label(); m.visitJumpInsn(Opcodes.GOTO, exit); m.visitLabel(handler); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.MONITOREXIT); m.visitLabel(handlerEnd); m.visitInsn(Opcodes.ATHROW); m.visitLabel(exit); m.visitInsn(Opcodes.RETURN); filter.filter(m, context, output); assertIgnored(new Range((LabelNode) handler.info, ((LabelNode) exit.info).getPrevious())); }
From source file:org.jacoco.core.internal.analysis.filter.TryWithResourcesEcjFilterTest.java
License:Open Source License
/** * ECJ for/*from w ww . j a va 2 s .co m*/ * * <pre> * try (r0 = ...; r1 = ...; r2= ...) { * ... * } finally (...) { * ... * } * ... * </pre> * * generates * * <pre> * ACONST_NULL * ASTORE primaryExc * ACONST_NULL * ASTORE suppressedExc * ... * ASTORE r1 * ... * ASTORE r2 * ... * ASTORE r3 * * ... // body * * ALOAD r3 * IFNULL r2_close * ALOAD r3 * INVOKEVIRTUAL close:()V * GOTO r2_close * * ASTORE primaryExc * ALOAD r3 * IFNULL n * ALOAD r3 * INVOKEVIRTUAL close:()V * n: * ALOAD primaryExc * ATHROW * * r2_close: * ALOAD r2 * IFNULL r1_close * ALOAD r2 * INVOKEVIRTUAL close:()V * GOTO r1_close * * ASTORE suppressedExc * ALOAD primaryExc * IFNONNULL s * ALOAD suppressedExc * ASTORE primaryExc * GOTO e * s: * ALOAD primaryExc * ALOAD suppressedExc * IF_ACMPEQ e * ALOAD primaryExc * ALOAD suppressedExc * INVOKEVIRTUAL java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V * e: * * ALOAD r2 * IFNULL n * ALOAD r2 * INVOKEVIRTUAL close:()V * n: * ALOAD primaryExc * ATHROW * * r1_close: * ALOAD r1 * IFNULL after * ALOAD r1 * INVOKEVIRTUAL close:()V * GOTO after * * ASTORE suppressedExc * ALOAD primaryExc * IFNONNULL s * ALOAD suppressedExc * ASTORE primaryExc * GOTO e * s: * ALOAD primaryExc * ALOAD suppressedExc * IF_ACMPEQ e * ALOAD primaryExc * ALOAD suppressedExc * INVOKEVIRTUAL java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V * e: * * ALOAD r1 * IFNULL n * ALOAD r1 * INVOKEVIRTUAL close:()V * n: * ALOAD primaryExc * ATHROW * * ASTORE suppressedExc * ALOAD primaryExc * IFNONNULL s * ALOAD suppressedExc * ASTORE primaryExc * GOTO e * s: * ALOAD primaryExc * ALOAD suppressedExc * IF_ACMPEQ e * ALOAD primaryExc * ALOAD suppressedExc * INVOKEVIRTUAL java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V * e: * * ALOAD primaryExc * ATHROW * * ... // additional handlers for catch blocks and finally on exceptional path * * after: * ... // finally on normal path * ... * </pre> */ @Test public void ecj() { final Range range0 = new Range(); final Range range1 = new Range(); final Label handler = new Label(); m.visitTryCatchBlock(handler, handler, handler, null); // primaryExc = null m.visitInsn(Opcodes.ACONST_NULL); m.visitVarInsn(Opcodes.ASTORE, 1); // suppressedExc = null m.visitInsn(Opcodes.ACONST_NULL); m.visitVarInsn(Opcodes.ASTORE, 2); // body m.visitInsn(Opcodes.NOP); final Label l4 = new Label(); final Label l7 = new Label(); final Label end = new Label(); { // nextIsEcjClose("r0") m.visitVarInsn(Opcodes.ALOAD, 5); range0.fromInclusive = m.instructions.getLast(); m.visitJumpInsn(Opcodes.IFNULL, l4); m.visitVarInsn(Opcodes.ALOAD, 5); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false); } m.visitJumpInsn(Opcodes.GOTO, l4); range0.toInclusive = m.instructions.getLast(); // catch (any primaryExc) m.visitLabel(handler); range1.fromInclusive = m.instructions.getLast(); m.visitVarInsn(Opcodes.ASTORE, 1); { // nextIsEcjCloseAndThrow("r0") m.visitVarInsn(Opcodes.ALOAD, 5); Label l11 = new Label(); m.visitJumpInsn(Opcodes.IFNULL, l11); m.visitVarInsn(Opcodes.ALOAD, 5); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false); m.visitLabel(l11); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.ATHROW); } m.visitLabel(l4); { // nextIsEcjClose("r1") m.visitVarInsn(Opcodes.ALOAD, 4); m.visitJumpInsn(Opcodes.IFNULL, l7); m.visitVarInsn(Opcodes.ALOAD, 4); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false); } m.visitJumpInsn(Opcodes.GOTO, l7); { // nextIsEcjSuppress m.visitVarInsn(Opcodes.ASTORE, 2); m.visitVarInsn(Opcodes.ALOAD, 1); final Label suppressStart = new Label(); m.visitJumpInsn(Opcodes.IFNONNULL, suppressStart); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitVarInsn(Opcodes.ASTORE, 1); final Label suppressEnd = new Label(); m.visitJumpInsn(Opcodes.GOTO, suppressEnd); m.visitLabel(suppressStart); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitJumpInsn(Opcodes.IF_ACMPEQ, suppressEnd); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "addSuppressed", "(Ljava/lang/Throwable;)V", false); m.visitLabel(suppressEnd); } { // nextIsEcjCloseAndThrow("r1") m.visitVarInsn(Opcodes.ALOAD, 4); final Label l14 = new Label(); m.visitJumpInsn(Opcodes.IFNULL, l14); m.visitVarInsn(Opcodes.ALOAD, 4); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false); m.visitLabel(l14); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.ATHROW); } m.visitLabel(l7); { // nextIsEcjClose("r2") m.visitVarInsn(Opcodes.ALOAD, 3); m.visitJumpInsn(Opcodes.IFNULL, end); m.visitVarInsn(Opcodes.ALOAD, 3); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false); m.visitJumpInsn(Opcodes.GOTO, end); } { // nextIsEcjSuppress m.visitVarInsn(Opcodes.ASTORE, 2); m.visitVarInsn(Opcodes.ALOAD, 1); final Label suppressStart = new Label(); m.visitJumpInsn(Opcodes.IFNONNULL, suppressStart); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitVarInsn(Opcodes.ASTORE, 1); final Label suppressEnd = new Label(); m.visitJumpInsn(Opcodes.GOTO, suppressEnd); m.visitLabel(suppressStart); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitJumpInsn(Opcodes.IF_ACMPEQ, suppressEnd); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "addSuppressed", "(Ljava/lang/Throwable;)V", false); m.visitLabel(suppressEnd); } { // nextIsEcjCloseAndThrow("r2") m.visitVarInsn(Opcodes.ALOAD, 3); final Label l18 = new Label(); m.visitJumpInsn(Opcodes.IFNULL, l18); m.visitVarInsn(Opcodes.ALOAD, 3); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false); m.visitLabel(l18); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.ATHROW); } { // nextIsEcjSuppress m.visitVarInsn(Opcodes.ASTORE, 2); m.visitVarInsn(Opcodes.ALOAD, 1); final Label suppressStart = new Label(); m.visitJumpInsn(Opcodes.IFNONNULL, suppressStart); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitVarInsn(Opcodes.ASTORE, 1); final Label suppressEnd = new Label(); m.visitJumpInsn(Opcodes.GOTO, suppressEnd); m.visitLabel(suppressStart); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitJumpInsn(Opcodes.IF_ACMPEQ, suppressEnd); m.visitVarInsn(Opcodes.ALOAD, 1); m.visitVarInsn(Opcodes.ALOAD, 2); m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "addSuppressed", "(Ljava/lang/Throwable;)V", false); m.visitLabel(suppressEnd); } // throw primaryExc m.visitVarInsn(Opcodes.ALOAD, 1); m.visitInsn(Opcodes.ATHROW); range1.toInclusive = m.instructions.getLast(); // additional handlers m.visitInsn(Opcodes.NOP); filter.filter(m, context, output); assertIgnored(range0, range1); }