Example usage for org.objectweb.asm Opcodes ICONST_0

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

Introduction

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

Prototype

int ICONST_0

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

Click Source Link

Usage

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

License:Open Source License

@Test
public void should_not_filter_when_no_annotations() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);

    m.visitInsn(Opcodes.ICONST_0);
    m.visitInsn(Opcodes.IRETURN);//from   w  ww .j  a  v  a 2s  .  co  m

    filter.filter(m, context, output);

    assertIgnored();
}

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

License:Open Source License

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

    m.visitInsn(Opcodes.ICONST_0);
    m.visitInsn(Opcodes.IRETURN);/*from ww w .  ja v a  2s.c  om*/

    context.classAnnotations.add("LOtherAnnotation;");

    filter.filter(m, context, output);

    assertIgnored();
}

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

License:Open Source License

@Test
public void testNoAnnotations() {
    final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null);

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

    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 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);
    m.visitInsn(Opcodes.IRETURN);// w  w  w. j a  va 2  s  .c o  m

    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);
    m.visitInsn(Opcodes.IRETURN);/*from   w  w  w  .j  a v a  2s . co  m*/

    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);
    m.visitInsn(Opcodes.IRETURN);/*from www.  j a va 2s  . co  m*/
    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);
    m.visitInsn(Opcodes.IRETURN);/*from w  ww  .j  av  a 2 s. c  o m*/
    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);
    m.visitInsn(Opcodes.IRETURN);/*from ww  w  .ja  va 2  s  .  c  o m*/

    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);
    m.visitInsn(Opcodes.IRETURN);//from   ww  w  .j  av  a2  s .  co m
    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);
    m.visitInsn(Opcodes.IRETURN);//from   ww w.  j a  v  a  2 s . com
    m.visitLineNumber(12, new Label());
    context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC);
    context.sourceFileName = null;

    filter.filter(m, context, output);

    assertIgnored();
}