List of usage examples for org.objectweb.asm Opcodes ACC_BRIDGE
int ACC_BRIDGE
To view the source code for org.objectweb.asm Opcodes ACC_BRIDGE.
Click Source Link
From source file:org.evosuite.graphs.cfg.CFGMethodAdapter.java
License:Open Source License
/** * See description of CFGMethodAdapter.EXCLUDE * /*w ww . j a v a 2 s .co m*/ * @return */ private boolean isUsable() { if ((this.access & Opcodes.ACC_SYNTHETIC) != 0) return false; if ((this.access & Opcodes.ACC_BRIDGE) != 0) return false; if ((this.access & Opcodes.ACC_NATIVE) != 0) return false; if (methodName.contains("<clinit>")) return false; // If we are not using reflection, covering private constructors is difficult? if (Properties.P_REFLECTION_ON_PRIVATE <= 0.0) { if (methodName.contains("<init>") && (access & Opcodes.ACC_PRIVATE) == Opcodes.ACC_PRIVATE) return false; } return true; }
From source file:org.evosuite.instrumentation.AccessibleClassAdapter.java
License:Open Source License
/** * {@inheritDoc}//from w w w . j a v a2 s .co m * * Change methods to public */ @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, final String[] exceptions) { int skipMask = Opcodes.ACC_NATIVE | Opcodes.ACC_BRIDGE; if (!exclude && ((access & Opcodes.ACC_PRIVATE) != Opcodes.ACC_PRIVATE) && ((access & skipMask) == 0)) { access = access | Opcodes.ACC_PUBLIC; access = access & ~Opcodes.ACC_PROTECTED; } MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); return mv; }
From source file:org.evosuite.instrumentation.ExecutionPathClassAdapter.java
License:Open Source License
/** {@inheritDoc} */ @Override//from www. j a v a2 s . com public MethodVisitor visitMethod(int methodAccess, String name, String descriptor, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(methodAccess, name, descriptor, signature, exceptions); // Don't touch bridge and synthetic methods if ((methodAccess & Opcodes.ACC_SYNTHETIC) > 0 || (methodAccess & Opcodes.ACC_BRIDGE) > 0) { return mv; } if (name.equals("<clinit>")) return mv; if (name.equals(ClassResetter.STATIC_RESET)) return mv; if (!DependencyAnalysis.shouldInstrument(className, name + descriptor)) return mv; if (isEnum && (name.equals("valueOf") || name.equals("values"))) { return mv; } // Default constructors of anonymous classes are synthetic // but the Java Compiler is inconsistent in whether it has // line numbers, so we skip it. // https://bugs.openjdk.java.net/browse/JDK-8061778 if (isAnonymous && name.equals("<init>")) { return mv; } if (isMutation()) { mv = new ReturnValueAdapter(mv, className, name, descriptor); } mv = new MethodEntryAdapter(mv, methodAccess, className, name, descriptor); mv = new LineNumberMethodAdapter(mv, className, name, descriptor); mv = new ArrayAllocationLimitMethodAdapter(mv, className, name, methodAccess, descriptor); mv = new ExplicitExceptionHandler(mv, className, name, descriptor); return mv; }
From source file:org.evosuite.runtime.instrumentation.KillSwitchClassAdapter.java
License:Open Source License
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); // Don't touch bridge and synthetic methods if ((access & Opcodes.ACC_SYNTHETIC) > 0 || (access & Opcodes.ACC_BRIDGE) > 0) { return mv; }//from ww w. jav a 2 s . c om if (name.equals("<clinit>")) { //should not stop a static initializer return mv; } return new KillSwitchMethodAdapter(mv, name, desc); }
From source file:org.evosuite.runtime.instrumentation.LoopCounterClassAdapter.java
License:Open Source License
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); // Don't touch bridge and synthetic methods if ((access & Opcodes.ACC_SYNTHETIC) > 0 || (access & Opcodes.ACC_BRIDGE) > 0) { return mv; }//w ww.j a v a 2 s. co m if (name.equals("<clinit>")) { //should not stop a static initializer return mv; } return new LoopCounterMethodAdapter(mv, name, desc); }
From source file:org.evosuite.symbolic.instrument.AccessFlags.java
License:Open Source License
static boolean isBridge(int access) { return is(access, Opcodes.ACC_BRIDGE); }
From source file:org.freud.analysed.classbytecode.parser.asm.AsmMethod.java
License:Apache License
@Override public boolean isBridge() { return isAccessModifier(Opcodes.ACC_BRIDGE); }
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);/* w w w . j av 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_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 w w w . jav a 2 s . c o m*/ filter.filter(m, context, output); assertMethodIgnored(m); }
From source file:org.jruby.compiler.util.BasicObjectStubGenerator.java
License:LGPL
public static void addBasicObjectStubsToClass(ClassVisitor cv) { for (Method stub : BASIC_OBJECT_STUB_METHODS) { if (stub.getName().equals("getRuntime") || stub.getName().equals("getMetaClass")) { // skip these and implement appropriately for the specific case continue; }//from w w w. j av a2 s . co m // trim off IRubyObject self argument Class[] signature = new Class[stub.getParameterTypes().length - 1]; for (int i = 0; i < signature.length; i++) { signature[i] = stub.getParameterTypes()[i + 1]; } SkinnyMethodAdapter method = new SkinnyMethodAdapter(cv, Opcodes.ACC_PUBLIC | Opcodes.ACC_BRIDGE, stub.getName(), sig(stub.getReturnType(), signature), null, null); method.start(); // load self method.aload(0); // load arguments int nextIndex = 1; for (Class argType : signature) { if (argType.isPrimitive()) { if (argType == boolean.class || argType == byte.class || argType == char.class || argType == short.class || argType == int.class) { method.iload(nextIndex); nextIndex++; } else if (argType == long.class) { method.lload(nextIndex); nextIndex += 2; } else if (argType == float.class) { method.fload(nextIndex); nextIndex++; } else if (argType == double.class) { method.dload(nextIndex); nextIndex += 2; } else { throw new RuntimeException("unknown primitive type: " + argType); } } else { method.aload(nextIndex); nextIndex++; } } // invoke stub method.invokestatic(p(BasicObjectStub.class), stub.getName(), sig(stub.getReturnType(), stub.getParameterTypes())); Class retType = stub.getReturnType(); if (retType == void.class) { method.voidreturn(); } else { if (retType.isPrimitive()) { if (retType == boolean.class || retType == byte.class || retType == char.class || retType == short.class || retType == int.class) { method.ireturn(); } else if (retType == long.class) { method.lreturn(); } else if (retType == float.class) { method.freturn(); } else if (retType == double.class) { method.dreturn(); } else { throw new RuntimeException("unknown primitive type: " + retType); } } else { method.areturn(); } } method.end(); } }