List of usage examples for org.objectweb.asm.tree MethodNode MethodNode
public MethodNode(final int api, final int access, final String name, final String descriptor, final String signature, final String[] exceptions)
From source file:org.jacoco.core.internal.analysis.filter.SyntheticFilterTest.java
License:Open Source License
@Test public void testLambda() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC, "lambda$1", "()V", null, null);//from w ww. j ava2s.c o m m.visitInsn(Opcodes.NOP); filter.filter(m, context, output); assertIgnored(); }
From source file:org.jacoco.core.internal.analysis.filter.SyntheticFilterTest.java
License:Open Source License
@Test public void should_filter_synthetic_method_with_prefix_anonfun_in_non_Scala_classes() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC, "$anonfun$main$1", "()V", null, null); m.visitInsn(Opcodes.RETURN);/* w w w. j a v a 2 s. c om*/ filter.filter(m, context, output); assertMethodIgnored(m); }
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_classes() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC, "$anonfun$main$1", "()V", null, null); m.visitInsn(Opcodes.RETURN);//w w w.java 2 s .c om context.classAttributes.add("ScalaSig"); filter.filter(m, context, output); assertIgnored(); }
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);/*from ww w .j a va 2 s .c o m*/ context.classAttributes.add("Scala"); filter.filter(m, context, output); assertIgnored(); }
From source file:org.jacoco.core.internal.analysis.filter.SyntheticFilterTest.java
License:Open Source License
@Test public void should_not_filter_method_with_suffix_default_in_kotlin_classes() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC | Opcodes.ACC_BRIDGE, "example$default", "(LTarget;Ljava/lang/String;Ijava/lang/Object;)V", null, null); context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC); m.visitInsn(Opcodes.NOP);//from ww w . ja va 2s .c o m filter.filter(m, context, output); assertIgnored(); }
From source file:org.jacoco.core.internal.analysis.filter.SyntheticFilterTest.java
License:Open Source License
@Test public void should_filter_synthetic_method_with_suffix_default_in_non_kotlin_classes() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC | Opcodes.ACC_BRIDGE, "example$default", "(LTarget;Ljava/lang/String;Ijava/lang/Object;)V", null, null); m.visitInsn(Opcodes.NOP);/*from ww w. ja va2 s .com*/ filter.filter(m, context, output); assertMethodIgnored(m); }
From source file:org.jacoco.core.internal.analysis.filter.SyntheticFilterTest.java
License:Open Source License
@Test public void should_not_filter_synthetic_constructor_containing_default_arguments_in_kotlin_classes() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC, "<init>", "(IILkotlin/jvm/internal/DefaultConstructorMarker;)V", null, null); context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC); m.visitInsn(Opcodes.NOP);//from w w w . j a v a 2 s. com filter.filter(m, context, output); assertIgnored(); }
From source file:org.jacoco.core.internal.analysis.filter.SyntheticFilterTest.java
License:Open Source License
@Test public void should_not_filter_synthetic_methods_whose_last_argument_is_kotlin_coroutine_continuation() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC | Opcodes.ACC_STATIC, "example", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", null, null); context.classAnnotations.add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC); m.visitInsn(Opcodes.NOP);/*from ww w. j av a 2 s . c o m*/ filter.filter(m, context, output); assertIgnored(); }
From source file:org.spongepowered.asm.mixin.injection.struct.InjectionInfo.java
License:MIT License
/** * Inject a method into the target class * //from w w w.ja v a2 s . c om * @param access Method access flags, synthetic will be automatically added * @param name Method name * @param desc Method descriptor * * @return new method */ public MethodNode addMethod(int access, String name, String desc) { MethodNode method = new MethodNode(Opcodes.ASM5, access | Opcodes.ACC_SYNTHETIC, name, desc, null, null); this.injectedMethods.add(method); return method; }
From source file:org.spongepowered.mod.asm.transformers.EventTransformer.java
License:MIT License
protected static MethodNode createGetGameMethod() { MethodNode methodNode = new MethodNode(Opcodes.ASM4, Opcodes.ACC_PUBLIC, "getGame", "()Lorg/spongepowered/api/Game;", null, null); methodNode.instructions.add(new FieldInsnNode(Opcodes.GETSTATIC, "org/spongepowered/mod/SpongeMod", "instance", "Lorg/spongepowered/mod/SpongeMod;")); methodNode.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "org/spongepowered/mod/SpongeMod", "getGame", "()Lorg/spongepowered/mod/SpongeGame;", false)); methodNode.instructions.add(new InsnNode(Opcodes.ARETURN)); methodNode.maxLocals = 1;//from w w w . ja v a2s.c o m methodNode.maxStack = 1; return methodNode; }