Java Code Examples for org.objectweb.asm.Opcodes#ACC_BRIDGE
The following examples show how to use
org.objectweb.asm.Opcodes#ACC_BRIDGE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModifierReviewable.java From byte-buddy with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public MethodManifestation getMethodManifestation() { int modifiers = getModifiers(); switch (modifiers & (Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_FINAL | Opcodes.ACC_BRIDGE)) { case Opcodes.ACC_NATIVE | Opcodes.ACC_FINAL: return MethodManifestation.FINAL_NATIVE; case Opcodes.ACC_NATIVE: return MethodManifestation.NATIVE; case Opcodes.ACC_FINAL: return MethodManifestation.FINAL; case Opcodes.ACC_BRIDGE: return MethodManifestation.BRIDGE; case Opcodes.ACC_BRIDGE | Opcodes.ACC_FINAL: return MethodManifestation.FINAL_BRIDGE; case Opcodes.ACC_ABSTRACT: return MethodManifestation.ABSTRACT; case EMPTY_MASK: return MethodManifestation.PLAIN; default: throw new IllegalStateException("Unexpected modifiers: " + modifiers); } }
Example 2
Source File: LambdaClassFixer.java From bazel with Apache License 2.0 | 5 votes |
@Override public MethodVisitor visitMethod( int access, String name, String desc, String signature, String[] exceptions) { if ((access & (Opcodes.ACC_BRIDGE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC)) == Opcodes.ACC_BRIDGE) { // Only copy bridge methods--hand-written default methods are not supported--and only if // we haven't seen the method already. if (implementedMethods.add(name + ":" + desc)) { MethodVisitor result = LambdaClassFixer.super.visitMethod(access, name, desc, signature, exceptions); return allowDefaultMethods ? result : new AvoidJacocoInit(result); } } return null; }
Example 3
Source File: MethodNodeDecompiler.java From java-disassembler with GNU General Public License v3.0 | 5 votes |
protected static String getAccessString(int access) { // public, protected, private, abstract, static, // final, synchronized, native & strictfp are permitted List<String> tokens = new ArrayList<>(); if ((access & Opcodes.ACC_PUBLIC) != 0) tokens.add("public"); if ((access & Opcodes.ACC_PRIVATE) != 0) tokens.add("private"); if ((access & Opcodes.ACC_PROTECTED) != 0) tokens.add("protected"); if ((access & Opcodes.ACC_STATIC) != 0) tokens.add("static"); if ((access & Opcodes.ACC_ABSTRACT) != 0) tokens.add("abstract"); if ((access & Opcodes.ACC_FINAL) != 0) tokens.add("final"); if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) tokens.add("synchronized"); if ((access & Opcodes.ACC_NATIVE) != 0) tokens.add("native"); if ((access & Opcodes.ACC_STRICT) != 0) tokens.add("strictfp"); if ((access & Opcodes.ACC_BRIDGE) != 0) tokens.add("bridge"); if ((access & Opcodes.ACC_VARARGS) != 0) tokens.add("varargs"); if (tokens.size() == 0) return ""; // hackery delimeters StringBuilder sb = new StringBuilder(tokens.get(0)); for (int i = 1; i < tokens.size(); i++) { sb.append(" "); sb.append(tokens.get(i)); } return sb.toString(); }
Example 4
Source File: ClassFileDebugInfoExtractor.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4) { MethodVisitor visitor = new MethodVisitor(this, arg1); if ((arg0 & Opcodes.ACC_BRIDGE) == 0) methods.add(visitor); return visitor; }
Example 5
Source File: LogInstrument.java From dacapobench with Apache License 2.0 | 5 votes |
private boolean instrument(String name, String signature, int access) { return (access & Opcodes.ACC_ABSTRACT) == 0 && (access & Opcodes.ACC_BRIDGE) == 0 && (access & Opcodes.ACC_NATIVE) == 0 && (isEntryPoint(name, signature) || isExitPoint(name, signature)); }
Example 6
Source File: SourceAbiCompatibleVisitor.java From buck with Apache License 2.0 | 5 votes |
@Override @Nullable public MethodVisitor visitMethod( int access, String name, String desc, String signature, String[] exceptions) { if (!compatibilityMode.usesDependencies() && (access & Opcodes.ACC_BRIDGE) != 0) { return null; } return super.visitMethod(access, name, desc, fixupSignature(signature), exceptions); }
Example 7
Source File: Java7Compatibility.java From bazel with Apache License 2.0 | 5 votes |
@Override public MethodVisitor visitMethod( int access, String name, String desc, String signature, String[] exceptions) { // Remove bridge default methods in interfaces; javac generates them again for implementing // classes anyways. if (isInterface && (access & (Opcodes.ACC_BRIDGE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC)) == Opcodes.ACC_BRIDGE) { return null; } if (isInterface && "$jacocoInit".equals(name) && BitFlags.isSet(access, Opcodes.ACC_SYNTHETIC | Opcodes.ACC_STATIC)) { // Drop static interface method that Jacoco generates--we'll inline it into the static // initializer instead return null; } checkArgument( !isInterface || BitFlags.isSet(access, Opcodes.ACC_ABSTRACT) || "<clinit>".equals(name), "Interface %s defines non-abstract method %s%s, which is not supported", internalName, name, desc); MethodVisitor result = new UpdateBytecodeVersionIfNecessary( super.visitMethod(access, name, desc, signature, exceptions)); return (isInterface && "<clinit>".equals(name)) ? new InlineJacocoInit(result) : result; }
Example 8
Source File: ClassParserUsingASM.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
/** * @param calledClassSet * @param mBuilder * @param methodName * @param access * @param methodDesc * @param cBuilder */ private ClassParserMethodVisitor(TreeSet<ClassDescriptor> calledClassSet, MethodInfo.Builder mBuilder, String methodName, int access, String methodDesc, ClassNameAndSuperclassInfo.Builder cBuilder) { this.calledClassSet = calledClassSet; this.mBuilder = mBuilder; this.methodName = methodName; this.access = access; this.methodDesc = methodDesc; this.cBuilder = cBuilder; sawReturn = (access & Opcodes.ACC_NATIVE) != 0; isBridge = (access & Opcodes.ACC_SYNTHETIC) != 0 && (access & Opcodes.ACC_BRIDGE) != 0; isAccessMethod = methodName.startsWith("access$"); }
Example 9
Source File: HideMembers.java From obfuscator with MIT License | 5 votes |
@Override public void process(ProcessorCallback callback, ClassNode node) { if (!enabled.getObject()) return; if ((node.access & Opcodes.ACC_INTERFACE) == 0) { for (MethodNode method : node.methods) { // if ((method.access & Opcodes.ACC_BRIDGE) == 0 && (method.access & Opcodes.ACC_STATIC) == 0 && !method.name.startsWith("<")) { // method.access |= Opcodes.ACC_BRIDGE; // } // if ((method.access & Opcodes.ACC_SYNTHETIC) == 0) { if (method.name.startsWith("<")) continue; if ((method.access & Opcodes.ACC_NATIVE) == 0) { continue; } method.access = method.access | Opcodes.ACC_BRIDGE; method.access = method.access | Opcodes.ACC_SYNTHETIC; // } } } for (FieldNode field : node.fields) { // if ((field.access & Opcodes.ACC_FINAL) == 0) field.access = field.access | Opcodes.ACC_SYNTHETIC; } // if ((node.access & Opcodes.ACC_FINAL) == 0) { // node.access = node.access | Opcodes.ACC_SYNTHETIC; // } inst.setWorkDone(); }
Example 10
Source File: CachedClassMirrors.java From Concurnas with MIT License | 5 votes |
public BytecodeMethodMirror(int access, String name, String desc, String signature, String[] exceptions) { this.name = name; this.desc = desc; this.access = access; this.signature = signature; this.exceptions = (exceptions == null) ? CachedClassMirrors.EMPTY_SET : exceptions; isBridge = (access & Opcodes.ACC_BRIDGE) > 0; isFinal = Modifier.isFinal(access); isPublicAndNonStatic = Modifier.isPublic(access) && !Modifier.isStatic(access); }
Example 11
Source File: LocalVariableTableParameterNameDiscoverer.java From sofa-rpc with Apache License 2.0 | 4 votes |
private static boolean isSyntheticOrBridged(int access) { return (((access & Opcodes.ACC_SYNTHETIC) | (access & Opcodes.ACC_BRIDGE)) > 0); }
Example 12
Source File: HierarchyMethods.java From maple-ir with GNU General Public License v3.0 | 4 votes |
public static boolean isBridge(int access) { return (access & Opcodes.ACC_BRIDGE) != 0; }
Example 13
Source File: MaybeContinuableClassVisitor.java From tascalate-javaflow with Apache License 2.0 | 4 votes |
@Override public MethodVisitor visitMethod(int access, final String name, final String desc, String signature, String[] exceptions) { if (isAnnotation) { return null; } boolean isSynthetic = (access & Opcodes.ACC_SYNTHETIC) != 0; boolean isPackagePrivate = (access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0; if (isSynthetic) { final boolean isAccessor = isPackagePrivate && name.startsWith("access$") && (access & Opcodes.ACC_STATIC) != 0; final boolean isBridge = (access & Opcodes.ACC_BRIDGE) != 0; if (isAccessor || isBridge) { return new MethodAdapter(NOP) { @Override public void visitMethodInsn(int opcode, String owner, String targetName, String targetDesc) { if (selfclass.equals(owner)) { if (isAccessor) { actual2accessor.put(targetName + targetDesc, name + desc); } if (isBridge) { bridge2specialization.put(name + desc, targetName + targetDesc); } } } }; } } // If this method is desugared lambda body if ( isSynthetic && isPackagePrivate && name.startsWith("lambda$") ) { // RetroLambda desugars method body to package private desugaredLambdaBodies.add(name + desc); return null; } return new MethodAdapter(NOP) { private boolean methodContinuableAnnotationFound = false; @Override public AnnotationVisitor visitAnnotation(String description, boolean visible) { if (!methodContinuableAnnotationFound) { methodContinuableAnnotationFound = cciResolver.isContinuableAnnotation(description); } return null; } @Override public void visitEnd() { if (methodContinuableAnnotationFound) { continuableMethods.add(name + desc); } } }; }
Example 14
Source File: AllocateInstrument.java From dacapobench with Apache License 2.0 | 4 votes |
private boolean instrument(int access) { return (access & Opcodes.ACC_ABSTRACT) == 0 && (access & Opcodes.ACC_BRIDGE) == 0 && (access & Opcodes.ACC_NATIVE) == 0; }
Example 15
Source File: Textifier.java From Concurnas with MIT License | 4 votes |
@Override public Textifier visitMethod( final int access, final String name, final String descriptor, final String signature, final String[] exceptions) { stringBuilder.setLength(0); stringBuilder.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(tab).append(DEPRECATED); } stringBuilder.append(tab); appendRawAccess(access); if (signature != null) { stringBuilder.append(tab); appendDescriptor(METHOD_SIGNATURE, signature); stringBuilder.append(tab); appendJavaDeclaration(name, signature); } stringBuilder.append(tab); appendAccess(access & ~(Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT)); if ((access & Opcodes.ACC_NATIVE) != 0) { stringBuilder.append("native "); } if ((access & Opcodes.ACC_VARARGS) != 0) { stringBuilder.append("varargs "); } if ((access & Opcodes.ACC_BRIDGE) != 0) { stringBuilder.append("bridge "); } if ((this.access & Opcodes.ACC_INTERFACE) != 0 && (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC)) == 0) { stringBuilder.append("default "); } stringBuilder.append(name); appendDescriptor(METHOD_DESCRIPTOR, descriptor); if (exceptions != null && exceptions.length > 0) { stringBuilder.append(" throws "); for (String exception : exceptions) { appendDescriptor(INTERNAL_NAME, exception); stringBuilder.append(' '); } } stringBuilder.append('\n'); text.add(stringBuilder.toString()); return addNewTextifier(null); }
Example 16
Source File: RuntimeInstrument.java From dacapobench with Apache License 2.0 | 4 votes |
private boolean instrument(int access) { return (access & Opcodes.ACC_ABSTRACT) == 0 && (access & Opcodes.ACC_BRIDGE) == 0 && (access & Opcodes.ACC_NATIVE) == 0; }
Example 17
Source File: MaybeContinuableClassVisitor.java From tascalate-javaflow with Apache License 2.0 | 4 votes |
@Override public MethodVisitor visitMethod(int access, final String name, final String desc, String signature, String[] exceptions) { if (isAnnotation) { return null; } boolean isSynthetic = (access & Opcodes.ACC_SYNTHETIC) != 0; boolean isPackagePrivate = (access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0; if (isSynthetic) { final boolean isAccessor = isPackagePrivate && name.startsWith("access$") && (access & Opcodes.ACC_STATIC) != 0; final boolean isBridge = (access & Opcodes.ACC_BRIDGE) != 0; if (isAccessor || isBridge) { return new MethodVisitor(this.api) { @Override public void visitMethodInsn(int opcode, String owner, String targetName, String targetDesc) { if (selfclass.equals(owner)) { if (isAccessor) { actual2accessor.put(targetName + targetDesc, name + desc); } if (isBridge) { bridge2specialization.put(name + desc, targetName + targetDesc); } } } }; } } // If this method is desugared lambda body if ( isSynthetic && isPackagePrivate && name.startsWith("lambda$") ) { // RetroLambda desugars method body to package private desugaredLambdaBodies.add(name + desc); return null; } return new MethodVisitor(this.api) { private boolean methodContinuableAnnotationFound = false; @Override public AnnotationVisitor visitAnnotation(String description, boolean visible) { if (!methodContinuableAnnotationFound) { methodContinuableAnnotationFound = cciResolver.isContinuableAnnotation(description); } return null; } @Override public void visitEnd() { if (methodContinuableAnnotationFound) { continuableMethods.add(name + desc); } } }; }
Example 18
Source File: Engine.java From JReFrameworker with MIT License | 4 votes |
@SuppressWarnings("unused") private static String getAccessModifiers(int access){ LinkedList<String> modifiers = new LinkedList<String>(); if((Opcodes.ACC_ABSTRACT & access) == Opcodes.ACC_ABSTRACT){ modifiers.add("abstract"); } if((Opcodes.ACC_ANNOTATION & access) == Opcodes.ACC_ANNOTATION){ modifiers.add("annotation"); } if((Opcodes.ACC_BRIDGE & access) == Opcodes.ACC_BRIDGE){ modifiers.add("bridge"); } if((Opcodes.ACC_DEPRECATED & access) == Opcodes.ACC_DEPRECATED){ modifiers.add("deprecated"); } if((Opcodes.ACC_ENUM & access) == Opcodes.ACC_ENUM){ modifiers.add("enum"); } if((Opcodes.ACC_FINAL & access) == Opcodes.ACC_FINAL){ modifiers.add("final"); } if((Opcodes.ACC_INTERFACE & access) == Opcodes.ACC_INTERFACE){ modifiers.add("interface"); } if((Opcodes.ACC_MANDATED & access) == Opcodes.ACC_MANDATED){ modifiers.add("mandated"); } if((Opcodes.ACC_NATIVE & access) == Opcodes.ACC_NATIVE){ modifiers.add("native"); } if((Opcodes.ACC_PRIVATE & access) == Opcodes.ACC_PRIVATE){ modifiers.add("private"); } if((Opcodes.ACC_PROTECTED & access) == Opcodes.ACC_PROTECTED){ modifiers.add("protected"); } if((Opcodes.ACC_PUBLIC & access) == Opcodes.ACC_PUBLIC){ modifiers.add("public"); } if((Opcodes.ACC_STATIC & access) == Opcodes.ACC_STATIC){ modifiers.add("static"); } if((Opcodes.ACC_STRICT & access) == Opcodes.ACC_STRICT){ modifiers.add("strict"); } if((Opcodes.ACC_SUPER & access) == Opcodes.ACC_SUPER){ modifiers.add("super"); } if((Opcodes.ACC_SYNCHRONIZED & access) == Opcodes.ACC_SYNCHRONIZED){ modifiers.add("synchronized"); } if((Opcodes.ACC_SYNTHETIC & access) == Opcodes.ACC_SYNTHETIC){ modifiers.add("synthetic"); } if((Opcodes.ACC_TRANSIENT & access) == Opcodes.ACC_TRANSIENT){ modifiers.add("transient"); } if((Opcodes.ACC_VARARGS & access) == Opcodes.ACC_VARARGS){ modifiers.add("varargs"); } if((Opcodes.ACC_VOLATILE & access) == Opcodes.ACC_VOLATILE){ modifiers.add("volatile"); } return modifiers.toString(); }
Example 19
Source File: Textifier.java From JReFrameworker with MIT License | 4 votes |
@Override public Textifier visitMethod( final int access, final String name, final String descriptor, final String signature, final String[] exceptions) { stringBuilder.setLength(0); stringBuilder.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(tab).append(DEPRECATED); } stringBuilder.append(tab); appendRawAccess(access); if (signature != null) { stringBuilder.append(tab); appendDescriptor(METHOD_SIGNATURE, signature); stringBuilder.append(tab); appendJavaDeclaration(name, signature); } stringBuilder.append(tab); appendAccess(access & ~(Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT)); if ((access & Opcodes.ACC_NATIVE) != 0) { stringBuilder.append("native "); } if ((access & Opcodes.ACC_VARARGS) != 0) { stringBuilder.append("varargs "); } if ((access & Opcodes.ACC_BRIDGE) != 0) { stringBuilder.append("bridge "); } if ((this.access & Opcodes.ACC_INTERFACE) != 0 && (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC)) == 0) { stringBuilder.append("default "); } stringBuilder.append(name); appendDescriptor(METHOD_DESCRIPTOR, descriptor); if (exceptions != null && exceptions.length > 0) { stringBuilder.append(" throws "); for (String exception : exceptions) { appendDescriptor(INTERNAL_NAME, exception); stringBuilder.append(' '); } } stringBuilder.append('\n'); text.add(stringBuilder.toString()); return addNewTextifier(null); }
Example 20
Source File: MonitorVisitor.java From Stark with Apache License 2.0 | 2 votes |
/** * Defines when a method access flags are compatible with InstantRun technology. * <p> * - If the method is a bridge method, we do not enable it for instantReload. * it is most likely only calling a twin method (same name, same parameters). * - if the method is abstract or native, we don't add a redirection. * * @param access the method access flags * @return true if the method should be InstantRun enabled, false otherwise. */ protected static boolean isAccessCompatibleWithStark(int access) { return (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_BRIDGE | Opcodes.ACC_NATIVE)) == 0; }