Example usage for org.objectweb.asm Opcodes IRETURN

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

Introduction

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

Prototype

int IRETURN

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

Click Source Link

Usage

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

License:Open Source License

@Test
public void testOtherAnnotation() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitAnnotation("Lother/Annotation;", true);

    m.visitInsn(Opcodes.ICONST_0);//from w  w w .  j  av  a 2 s .c  om
    m.visitInsn(Opcodes.IRETURN);

    filter.filter("Foo", "java/lang/Object", m, this);

    assertNull(fromInclusive);
    assertNull(toInclusive);
}

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

License:Open Source License

@Test
public void testGroovyGeneratedAnnotation() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitAnnotation("Lgroovy/transform/Generated;", true);

    m.visitInsn(Opcodes.ICONST_0);//from  w  w w  .j  a v  a2  s .  com
    m.visitInsn(Opcodes.IRETURN);

    filter.filter("Foo", "java/lang/Object", m, this);

    assertEquals(m.instructions.getFirst(), fromInclusive);
    assertEquals(m.instructions.getLast(), toInclusive);
}

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

License:Open Source License

@Test
public void testNoLinesForKotlinWithDebug() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitInsn(Opcodes.ICONST_0);//from  w w  w. j a  v a 2  s. com
    m.visitInsn(Opcodes.IRETURN);
    context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC);

    filter.filter(m, context, output);

    assertMethodIgnored(m);
}

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

License:Open Source License

@Test
public void testWithLinesForKotlinWithDebug() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitAnnotation("Lother/Annotation;", false);
    m.visitLineNumber(12, new Label());
    m.visitInsn(Opcodes.ICONST_0);//  ww  w .ja  v  a 2s  . c  o m
    m.visitInsn(Opcodes.IRETURN);
    context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC);

    filter.filter(m, context, output);

    assertIgnored();
}

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

License:Open Source License

@Test
public void testNoLinesNonKotlinWithDebug() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitInsn(Opcodes.ICONST_0);//from   w  w  w .  j  av a2  s .c  o  m
    m.visitInsn(Opcodes.IRETURN);

    filter.filter(m, context, output);

    assertIgnored();
}

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

License:Open Source License

@Test
public void testNoLinesForKotlinNoDebug() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitInsn(Opcodes.ICONST_0);//from   www .  j  a v  a 2 s.  co  m
    m.visitInsn(Opcodes.IRETURN);
    context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC);
    context.sourceFileName = null;

    filter.filter(m, context, output);

    assertIgnored();
}

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

License:Open Source License

@Test
public void testWithLinesForKotlinNoDebug() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitInsn(Opcodes.ICONST_0);//from  w  w  w  . j a  v  a2 s .  c  o  m
    m.visitInsn(Opcodes.IRETURN);
    m.visitLineNumber(12, new Label());
    context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC);
    context.sourceFileName = null;

    filter.filter(m, context, output);

    assertIgnored();
}

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

License:Open Source License

/**
 * <pre>/*from ww  w  .  ja v a 2  s.com*/
 *     return x!!.length
 * </pre>
 */
@Test
public void should_filter() {
    m.visitVarInsn(Opcodes.ALOAD, 1);
    m.visitInsn(Opcodes.DUP);

    final Range range = new Range();
    final Label label = new Label();
    m.visitJumpInsn(Opcodes.IFNONNULL, label);
    range.fromInclusive = m.instructions.getLast();
    // no line number here and hence no probe
    m.visitMethodInsn(Opcodes.INVOKESTATIC, "kotlin/jvm/internal/Intrinsics", "throwNpe", "()V", false);
    range.toInclusive = m.instructions.getLast();

    m.visitLabel(label);
    m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "length", "()I", false);
    m.visitInsn(Opcodes.IRETURN);

    filter.filter(m, context, output);

    assertIgnored(range);
}

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

License:Open Source License

@Test
public void testOtherAnnotation() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitAnnotation("Lother/Annotation;", false);

    m.visitInsn(Opcodes.ICONST_0);//  w  ww.j  ava2 s  . co  m
    m.visitInsn(Opcodes.IRETURN);

    filter.filter("Foo", "java/lang/Object", m, this);

    assertNull(fromInclusive);
    assertNull(toInclusive);
}

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

License:Open Source License

@Test
public void testLombokGeneratedAnnotation() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);
    m.visitAnnotation("Llombok/Generated;", false);

    m.visitInsn(Opcodes.ICONST_0);/*from  w  w w  .  j a v a  2  s.c o  m*/
    m.visitInsn(Opcodes.IRETURN);

    filter.filter("Foo", "java/lang/Object", m, this);

    assertEquals(m.instructions.getFirst(), fromInclusive);
    assertEquals(m.instructions.getLast(), toInclusive);
}