Example usage for org.objectweb.asm Opcodes RETURN

List of usage examples for org.objectweb.asm Opcodes RETURN

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes RETURN.

Prototype

int RETURN

To view the source code for org.objectweb.asm Opcodes RETURN.

Click Source Link

Usage

From source file:org.jacoco.core.internal.analysis.filter.SyntheticFilterTest.java

License:Open Source License

@Test
public void should_not_filter_synthetic_method_with_prefix_anonfun_in_Scala_inner_classes() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC, "$anonfun$main$1",
            "()V", null, null);
    m.visitInsn(Opcodes.RETURN);

    context.classAttributes.add("Scala");
    filter.filter(m, context, output);//from w  w w  .  j  a  v  a  2 s.  c  o m
    assertIgnored();
}

From source file:org.jacoco.core.internal.analysis.MethodAnalyzerTest.java

License:Open Source License

private void createLinearSequence() {
    method.visitLineNumber(1001, new Label());
    method.visitInsn(Opcodes.NOP);/*from w  w  w  . j  a  v  a2  s.  c o  m*/
    method.visitLineNumber(1002, new Label());
    method.visitInsn(Opcodes.RETURN);
}

From source file:org.jacoco.core.internal.analysis.MethodAnalyzerTest.java

License:Open Source License

private void createIfBranchMerge() {
    method.visitLineNumber(1001, new Label());
    method.visitVarInsn(Opcodes.ILOAD, 1);
    Label l1 = new Label();
    method.visitJumpInsn(Opcodes.IFEQ, l1);
    method.visitLineNumber(1002, new Label());
    method.visitInsn(Opcodes.NOP);//from  www  .j  ava  2  s. com
    method.visitLabel(l1);
    method.visitLineNumber(1003, l1);
    method.visitInsn(Opcodes.RETURN);
}

From source file:org.jacoco.core.internal.analysis.MethodAnalyzerTest.java

License:Open Source License

private void createJumpBackwards() {
    method.visitLineNumber(1001, new Label());
    final Label l1 = new Label();
    method.visitJumpInsn(Opcodes.GOTO, l1);
    final Label l2 = new Label();
    method.visitLabel(l2);//from  ww  w . j  a  v a  2 s  . c  om
    method.visitLineNumber(1002, l2);
    method.visitInsn(Opcodes.RETURN);
    method.visitLabel(l1);
    method.visitLineNumber(1003, l1);
    method.visitJumpInsn(Opcodes.GOTO, l2);
}

From source file:org.jacoco.core.internal.analysis.MethodAnalyzerTest.java

License:Open Source License

private void createJumpToFirst() {
    final Label l1 = new Label();
    method.visitLabel(l1);/*w w  w .  j ava 2 s .  c  o m*/
    method.visitLineNumber(1001, l1);
    method.visitVarInsn(Opcodes.ALOAD, 0);
    method.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Foo", "test", "()Z");
    method.visitJumpInsn(Opcodes.IFEQ, l1);
    final Label l2 = new Label();
    method.visitLabel(l2);
    method.visitLineNumber(1002, l2);
    method.visitInsn(Opcodes.RETURN);
}

From source file:org.jacoco.core.internal.analysis.MethodAnalyzerTest.java

License:Open Source License

private void createTryCatchBlock() {
    Label l1 = new Label();
    Label l2 = new Label();
    Label l3 = new Label();
    Label l4 = new Label();
    method.visitTryCatchBlock(l1, l2, l3, "java/lang/Exception");
    method.visitLabel(l1);//from w  ww.  j av  a 2s.c  om
    method.visitLineNumber(1001, l1);
    method.visitVarInsn(Opcodes.ALOAD, 0);
    method.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "printStackTrace", "()V");
    method.visitLabel(l2);
    method.visitJumpInsn(Opcodes.GOTO, l4);
    method.visitLabel(l3);
    method.visitLineNumber(1002, l3);
    method.visitVarInsn(Opcodes.ASTORE, 1);
    method.visitLabel(l4);
    method.visitLineNumber(1004, l4);
    method.visitInsn(Opcodes.RETURN);
}

From source file:org.jacoco.core.internal.flow.ClassProbesAdapterTest.java

License:Open Source License

private void writeMethod(final ClassVisitor cv) {
    MethodVisitor mv = cv.visitMethod(0, "foo", "V()", null, null);
    mv.visitCode();/*from w w w .  java2  s  . c  o m*/
    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(0, 1);
    mv.visitEnd();
}

From source file:org.jacoco.core.internal.flow.LabelFlowAnalyzer.java

License:Open Source License

@Override
public void visitInsn(final int opcode) {
    switch (opcode) {
    case Opcodes.RET:
        throw new AssertionError("Subroutines not supported.");
    case Opcodes.IRETURN:
    case Opcodes.LRETURN:
    case Opcodes.FRETURN:
    case Opcodes.DRETURN:
    case Opcodes.ARETURN:
    case Opcodes.RETURN:
    case Opcodes.ATHROW:
        successor = false;//from w  w  w  .  ja va  2 s. c o m
        break;
    default:
        successor = true;
        break;
    }
    first = false;
}

From source file:org.jacoco.core.internal.flow.MethodProbesAdapter.java

License:Open Source License

@Override
public void visitInsn(final int opcode) {
    switch (opcode) {
    case Opcodes.IRETURN:
    case Opcodes.LRETURN:
    case Opcodes.FRETURN:
    case Opcodes.DRETURN:
    case Opcodes.ARETURN:
    case Opcodes.RETURN:
    case Opcodes.ATHROW:
        probesVisitor.visitInsnWithProbe(opcode, idGenerator.nextId());
        break;//from   www . j a va  2 s  .  co  m
    default:
        probesVisitor.visitInsn(opcode);
        break;
    }
}

From source file:org.jacoco.core.internal.flow.MethodProbesAdapterTest.java

License:Open Source License

@Test
public void testVisitInsn1() {
    adapter.visitInsn(Opcodes.RETURN);

    expectedVisitor.visitInsnWithProbe(Opcodes.RETURN, 1000);
}