Java Code Examples for org.objectweb.asm.Opcodes#ACC_ABSTRACT
The following examples show how to use
org.objectweb.asm.Opcodes#ACC_ABSTRACT .
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: ClickableViewAccessibilityDetector.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public void checkClass(@NonNull ClassContext context, @NonNull ClassNode classNode) { scanForAndCheckSetOnTouchListenerCalls(context, classNode); // Ignore abstract classes. if ((classNode.access & Opcodes.ACC_ABSTRACT) != 0) { return; } if (context.getDriver().isSubclassOf(classNode, ANDROID_VIEW_VIEW)) { checkView(context, classNode); } if (implementsOnTouchListener(classNode)) { checkOnTouchListener(context, classNode); } }
Example 2
Source File: ContinuableClassVisitor.java From tascalate-javaflow with Apache License 2.0 | 5 votes |
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); boolean skip = skipEnchancing || null == classInfo || mv == null || (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE)) > 0 || "<init>".equals(name) || !classInfo.isContinuableMethod(access, name, desc, signature); if (skip) { return mv; } else { return new ContinuableMethodNode( access, name, desc, signature, exceptions, className, classHierarchy, cciResolver, mv ); } }
Example 3
Source File: AccessorGenerator.java From Mixin with MIT License | 5 votes |
/** * Create an empty accessor method based on the source method * * @param maxLocals max locals size for method * @param maxStack max stack size for method * @return new method */ protected final MethodNode createMethod(int maxLocals, int maxStack) { MethodNode method = this.info.getMethod(); MethodNode accessor = new MethodNode(ASM.API_VERSION, (method.access & ~Opcodes.ACC_ABSTRACT) | Opcodes.ACC_SYNTHETIC, method.name, method.desc, null, null); accessor.visibleAnnotations = new ArrayList<AnnotationNode>(); accessor.visibleAnnotations.add(this.info.getAnnotation()); accessor.maxLocals = maxLocals; accessor.maxStack = maxStack; return accessor; }
Example 4
Source File: BytecodeDecompiler.java From java-disassembler with GNU General Public License v3.0 | 5 votes |
public static String getAccessString(int access) { 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_FINAL) != 0) tokens.add("final"); if ((access & Opcodes.ACC_SYNTHETIC) != 0) tokens.add("synthetic"); // if ((access & Opcodes.ACC_SUPER) != 0) // tokens.add("super"); implied by invokespecial insn if ((access & Opcodes.ACC_ABSTRACT) != 0) tokens.add("abstract"); if ((access & Opcodes.ACC_INTERFACE) != 0) tokens.add("interface"); if ((access & Opcodes.ACC_ENUM) != 0) tokens.add("enum"); if ((access & Opcodes.ACC_ANNOTATION) != 0) tokens.add("annotation"); if (!tokens.contains("interface") && !tokens.contains("enum") && !tokens.contains("annotation")) tokens.add("class"); if (tokens.size() == 0) return "[Error parsing]"; // 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 5
Source File: RefVerifier.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { classInterfaces = interfaces; superClassName = superName; isInterface = (access & Opcodes.ACC_INTERFACE) != 0; isAbstract = (access & Opcodes.ACC_ABSTRACT) != 0; }
Example 6
Source File: SerialVersionUIDAdder.java From JReFrameworker with MIT License | 5 votes |
@Override public MethodVisitor visitMethod( final int access, final String name, final String descriptor, final String signature, final String[] exceptions) { // Get constructor and method information (step 5 and 7). Also determine if there is a class // initializer (step 6). if (computeSvuid) { if (CLINIT.equals(name)) { hasStaticInitializer = true; } // Collect the non private constructors and methods. Only the ACC_PUBLIC, ACC_PRIVATE, // ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT and // ACC_STRICT flags are used. int mods = access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNCHRONIZED | Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STRICT); if ((access & Opcodes.ACC_PRIVATE) == 0) { if ("<init>".equals(name)) { svuidConstructors.add(new Item(name, mods, descriptor)); } else if (!CLINIT.equals(name)) { svuidMethods.add(new Item(name, mods, descriptor)); } } } return super.visitMethod(access, name, descriptor, signature, exceptions); }
Example 7
Source File: ContinuableClassVisitor.java From tascalate-javaflow with Apache License 2.0 | 5 votes |
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); boolean skip = skipEnchancing || null == classInfo || mv == null || (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE)) > 0 || "<init>".equals(name) || !classInfo.isContinuableMethod(access, name, desc, signature); if (skip) { return mv; } else { return new ContinuableMethodNode( access, name, desc, signature, exceptions, className, classHierarchy, cciResolver, mv ); } }
Example 8
Source File: SerialVersionUIDAdder.java From Concurnas with MIT License | 4 votes |
/** * Computes and returns the value of SVUID. * * @return the serial version UID. * @throws IOException if an I/O error occurs. */ // DontCheck(AbbreviationAsWordInName): can't be renamed (for backward binary compatibility). protected long computeSVUID() throws IOException { long svuid = 0; try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream)) { // 1. The class name written using UTF encoding. dataOutputStream.writeUTF(name.replace('/', '.')); // 2. The class modifiers written as a 32-bit integer. int mods = access; if ((mods & Opcodes.ACC_INTERFACE) != 0) { mods = svuidMethods.isEmpty() ? (mods & ~Opcodes.ACC_ABSTRACT) : (mods | Opcodes.ACC_ABSTRACT); } dataOutputStream.writeInt( mods & (Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT)); // 3. The name of each interface sorted by name written using UTF encoding. Arrays.sort(interfaces); for (String interfaceName : interfaces) { dataOutputStream.writeUTF(interfaceName.replace('/', '.')); } // 4. For each field of the class sorted by field name (except private static and private // transient fields): // 1. The name of the field in UTF encoding. // 2. The modifiers of the field written as a 32-bit integer. // 3. The descriptor of the field in UTF encoding. // Note that field signatures are not dot separated. Method and constructor signatures are dot // separated. Go figure... writeItems(svuidFields, dataOutputStream, false); // 5. If a class initializer exists, write out the following: // 1. The name of the method, <clinit>, in UTF encoding. // 2. The modifier of the method, ACC_STATIC, written as a 32-bit integer. // 3. The descriptor of the method, ()V, in UTF encoding. if (hasStaticInitializer) { dataOutputStream.writeUTF(CLINIT); dataOutputStream.writeInt(Opcodes.ACC_STATIC); dataOutputStream.writeUTF("()V"); } // 6. For each non-private constructor sorted by method name and signature: // 1. The name of the method, <init>, in UTF encoding. // 2. The modifiers of the method written as a 32-bit integer. // 3. The descriptor of the method in UTF encoding. writeItems(svuidConstructors, dataOutputStream, true); // 7. For each non-private method sorted by method name and signature: // 1. The name of the method in UTF encoding. // 2. The modifiers of the method written as a 32-bit integer. // 3. The descriptor of the method in UTF encoding. writeItems(svuidMethods, dataOutputStream, true); dataOutputStream.flush(); // 8. The SHA-1 algorithm is executed on the stream of bytes produced by DataOutputStream and // produces five 32-bit values sha[0..4]. byte[] hashBytes = computeSHAdigest(byteArrayOutputStream.toByteArray()); // 9. The hash value is assembled from the first and second 32-bit values of the SHA-1 message // digest. If the result of the message digest, the five 32-bit words H0 H1 H2 H3 H4, is in an // array of five int values named sha, the hash value would be computed as follows: for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) { svuid = (svuid << 8) | (hashBytes[i] & 0xFF); } } return svuid; }
Example 9
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 10
Source File: Textifier.java From JReFrameworker with MIT License | 4 votes |
/** * Appends a string representation of the given access flags to {@link #stringBuilder}. * * @param accessFlags some access flags. */ private void appendAccess(final int accessFlags) { if ((accessFlags & Opcodes.ACC_PUBLIC) != 0) { stringBuilder.append("public "); } if ((accessFlags & Opcodes.ACC_PRIVATE) != 0) { stringBuilder.append("private "); } if ((accessFlags & Opcodes.ACC_PROTECTED) != 0) { stringBuilder.append("protected "); } if ((accessFlags & Opcodes.ACC_FINAL) != 0) { stringBuilder.append("final "); } if ((accessFlags & Opcodes.ACC_STATIC) != 0) { stringBuilder.append("static "); } if ((accessFlags & Opcodes.ACC_SYNCHRONIZED) != 0) { stringBuilder.append("synchronized "); } if ((accessFlags & Opcodes.ACC_VOLATILE) != 0) { stringBuilder.append("volatile "); } if ((accessFlags & Opcodes.ACC_TRANSIENT) != 0) { stringBuilder.append("transient "); } if ((accessFlags & Opcodes.ACC_ABSTRACT) != 0) { stringBuilder.append("abstract "); } if ((accessFlags & Opcodes.ACC_STRICT) != 0) { stringBuilder.append("strictfp "); } if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0) { stringBuilder.append("synthetic "); } if ((accessFlags & Opcodes.ACC_MANDATED) != 0) { stringBuilder.append("mandated "); } if ((accessFlags & Opcodes.ACC_ENUM) != 0) { stringBuilder.append("enum "); } }
Example 11
Source File: ASMClassParser.java From TickDynamic with MIT License | 4 votes |
protected int parseAccessFlags() throws Exception { String current; int access = 0; //They share value(Mutually exclusive, one is for method, one is for field) boolean gotTransient = false; boolean gotVarargs = false; while(true) { current = nextToken(); if(current == null) return access; //A lot of these actually are not a keyword, but something the compiler adds, just keep it here for now if(current.equals("public")) access += Opcodes.ACC_PUBLIC; else if(current.equals("private")) access += Opcodes.ACC_PRIVATE; else if(current.equals("protected")) access += Opcodes.ACC_PROTECTED; else if(current.equals("static")) access += Opcodes.ACC_STATIC; else if(current.equals("final")) access += Opcodes.ACC_FINAL; /*else if(current.equals("super")) access += Opcodes.ACC_SUPER;*/ //This one is added on newer compilers whenever a class has a super class else if(current.equals("synchronized")) access += Opcodes.ACC_SYNCHRONIZED; else if(current.equals("volatile")) access += Opcodes.ACC_VOLATILE; else if(current.equals("bridge")) access += Opcodes.ACC_BRIDGE; else if(current.equals("varargs")) { if(!gotTransient) { access += Opcodes.ACC_VARARGS; gotVarargs = true; } } else if(current.equals("transient")) { if(!gotVarargs) { access += Opcodes.ACC_TRANSIENT; gotTransient = true; } } else if(current.equals("native")) access += Opcodes.ACC_NATIVE; else if(current.equals("interface")) access += Opcodes.ACC_INTERFACE; else if(current.equals("abstract")) access += Opcodes.ACC_ABSTRACT; else if(current.equals("strict")) access += Opcodes.ACC_STRICT; else if(current.equals("synthetic")) access += Opcodes.ACC_SYNTHETIC; else if(current.equals("annotation")) access += Opcodes.ACC_ANNOTATION; else if(current.equals("enum")) access += Opcodes.ACC_ENUM; else if(current.equals("mandated")) access += Opcodes.ACC_MANDATED; else { //Move back from our peek currentToken--; //System.out.println("Access: " + Integer.toHexString(access).toUpperCase()); return access; } } }
Example 12
Source File: RenameMethods.java From bytecode-viewer with GNU General Public License v3.0 | 4 votes |
@Override public void obfuscate() { int stringLength = getStringLength(); System.out.println("Obfuscating method names..."); for (ClassNode c : BytecodeViewer.getLoadedClasses()) { methodLoop: for (Object o : c.methods.toArray()) { MethodNode m = (MethodNode) o; /* As we dont want to rename native dll methods */ if ((m.access & Opcodes.ACC_NATIVE) != 0) continue methodLoop; if (m.access != Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PROTECTED && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PROTECTED) { if (!m.name.equals("main") && !m.name.equals("<init>") && !m.name.equals("<clinit>")) { String newName = generateUniqueName(stringLength); BytecodeViewer.refactorer.getHooks().addMethod(new MethodMappingData(c.name, new MappingData(m.name, newName), m.desc)); /*ASMUtil_OLD.renameMethodNode(c.name, m.name, m.desc, null, newName, null);*/ } } } } System.out.println("Obfuscated method names."); }
Example 13
Source File: SAXClassAdapter.java From JByteMod-Beta with GNU General Public License v2.0 | 4 votes |
static void appendAccess(final int access, final StringBuilder sb) { if ((access & Opcodes.ACC_PUBLIC) != 0) { sb.append("public "); } if ((access & Opcodes.ACC_PRIVATE) != 0) { sb.append("private "); } if ((access & Opcodes.ACC_PROTECTED) != 0) { sb.append("protected "); } if ((access & Opcodes.ACC_FINAL) != 0) { if ((access & ACCESS_MODULE) == 0) { sb.append("final "); } else { sb.append("transitive "); } } if ((access & Opcodes.ACC_STATIC) != 0) { sb.append("static "); } if ((access & Opcodes.ACC_SUPER) != 0) { if ((access & ACCESS_CLASS) == 0) { if ((access & ACCESS_MODULE_REQUIRES) != 0) { sb.append("transitive "); } else { if ((access & ACCESS_MODULE) == 0) { sb.append("synchronized "); } else { sb.append("open "); } } } else { sb.append("super "); } } if ((access & Opcodes.ACC_VOLATILE) != 0) { if ((access & ACCESS_FIELD) == 0) { sb.append("bridge "); } else { if ((access & ACCESS_MODULE_REQUIRES) == 0) { sb.append("volatile "); } else { sb.append("static "); } } } if ((access & Opcodes.ACC_TRANSIENT) != 0) { if ((access & ACCESS_FIELD) == 0) { sb.append("varargs "); } else { sb.append("transient "); } } if ((access & Opcodes.ACC_NATIVE) != 0) { sb.append("native "); } if ((access & Opcodes.ACC_STRICT) != 0) { sb.append("strict "); } if ((access & Opcodes.ACC_INTERFACE) != 0) { sb.append("interface "); } if ((access & Opcodes.ACC_ABSTRACT) != 0) { sb.append("abstract "); } if ((access & Opcodes.ACC_SYNTHETIC) != 0) { sb.append("synthetic "); } if ((access & Opcodes.ACC_ANNOTATION) != 0) { sb.append("annotation "); } if ((access & Opcodes.ACC_ENUM) != 0) { sb.append("enum "); } if ((access & Opcodes.ACC_DEPRECATED) != 0) { sb.append("deprecated "); } if ((access & Opcodes.ACC_MANDATED) != 0) { if ((access & ACCESS_CLASS) == 0) { sb.append("module "); } else { sb.append("mandated "); } } }
Example 14
Source File: Textifier.java From JByteMod-Beta with GNU General Public License v2.0 | 4 votes |
/** * Appends a string representation of the given access modifiers to * {@link #buf buf}. * * @param access * some access modifiers. */ private void appendAccess(final int access) { if ((access & Opcodes.ACC_PUBLIC) != 0) { buf.append("public "); } if ((access & Opcodes.ACC_PRIVATE) != 0) { buf.append("private "); } if ((access & Opcodes.ACC_PROTECTED) != 0) { buf.append("protected "); } if ((access & Opcodes.ACC_FINAL) != 0) { buf.append("final "); } if ((access & Opcodes.ACC_STATIC) != 0) { buf.append("static "); } if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) { buf.append("synchronized "); } if ((access & Opcodes.ACC_VOLATILE) != 0) { buf.append("volatile "); } if ((access & Opcodes.ACC_TRANSIENT) != 0) { buf.append("transient "); } if ((access & Opcodes.ACC_ABSTRACT) != 0) { buf.append("abstract "); } if ((access & Opcodes.ACC_STRICT) != 0) { buf.append("strictfp "); } if ((access & Opcodes.ACC_SYNTHETIC) != 0) { buf.append("synthetic "); } if ((access & Opcodes.ACC_MANDATED) != 0) { buf.append("mandated "); } if ((access & Opcodes.ACC_ENUM) != 0) { buf.append("enum "); } }
Example 15
Source File: ClassFile.java From OSRS-Deobfuscator with BSD 2-Clause "Simplified" License | 4 votes |
public void clearAbstract() { this.access &= ~Opcodes.ACC_ABSTRACT; }
Example 16
Source File: ASMReflector.java From meghanada-server with GNU General Public License v3.0 | 4 votes |
static String toModifier(int access, boolean hasDefault) { StringBuilder sb = new StringBuilder(7); if ((Opcodes.ACC_PRIVATE & access) > 0) { sb.append("private "); } if ((Opcodes.ACC_PUBLIC & access) > 0) { sb.append("public "); } if ((Opcodes.ACC_PROTECTED & access) > 0) { sb.append("protected "); } if ((Opcodes.ACC_STATIC & access) > 0) { sb.append("static "); } if ((Opcodes.ACC_ABSTRACT & access) > 0) { sb.append("abstract "); } if ((Opcodes.ACC_FINAL & access) > 0) { sb.append("final "); } if ((Opcodes.ACC_INTERFACE & access) > 0) { sb.append("interface "); } if ((Opcodes.ACC_NATIVE & access) > 0) { sb.append("native "); } if ((Opcodes.ACC_STRICT & access) > 0) { sb.append("strict "); } if ((Opcodes.ACC_SYNCHRONIZED & access) > 0) { sb.append("synchronized "); } if (hasDefault) { sb.append("default "); } if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
Example 17
Source File: AbstractASMBackend.java From JAADAS with GNU General Public License v3.0 | 4 votes |
/** * Utility method to get the access modifiers of a Host * @param modVal The bitset representation of the Host's modifiers * @param host The Host (SootClass, SootField or SootMethod) the modifiers are to be retrieved from * @return A bitset representation of the Host's modifiers in ASM's internal representation */ protected static int getModifiers(int modVal, Host host) { int modifier = 0; // Retrieve visibility-modifier if (Modifier.isPublic(modVal)) { modifier |= Opcodes.ACC_PUBLIC; } else if (Modifier.isPrivate(modVal)) { modifier |= Opcodes.ACC_PRIVATE; } else if (Modifier.isProtected(modVal)) { modifier |= Opcodes.ACC_PROTECTED; } // Retrieve static-modifier if (Modifier.isStatic(modVal) && ((host instanceof SootField) || (host instanceof SootMethod))) { modifier |= Opcodes.ACC_STATIC; } // Retrieve final-modifier if (Modifier.isFinal(modVal)) { modifier |= Opcodes.ACC_FINAL; } // Retrieve synchronized-modifier if (Modifier.isSynchronized(modVal) && host instanceof SootMethod) { modifier |= Opcodes.ACC_SYNCHRONIZED; } // Retrieve volatile/bridge-modifier if (Modifier.isVolatile(modVal) && !(host instanceof SootClass)) { modifier |= Opcodes.ACC_VOLATILE; } // Retrieve transient/varargs-modifier if (Modifier.isTransient(modVal) && !(host instanceof SootClass)) { modifier |= Opcodes.ACC_TRANSIENT; } // Retrieve native-modifier if (Modifier.isNative(modVal) && host instanceof SootMethod) { modifier |= Opcodes.ACC_NATIVE; } // Retrieve interface-modifier if (Modifier.isInterface(modVal) && host instanceof SootClass) { modifier |= Opcodes.ACC_INTERFACE; } else if (host instanceof SootClass) { /* * For all classes except for interfaces the super-flag should be * set. See JVM 8-Specification section 4.1, page 72. */ modifier |= Opcodes.ACC_SUPER; } // Retrieve abstract-modifier if (Modifier.isAbstract(modVal) && !(host instanceof SootField)) { modifier |= Opcodes.ACC_ABSTRACT; } // Retrieve strictFP-modifier if (Modifier.isStrictFP(modVal) && host instanceof SootMethod) { modifier |= Opcodes.ACC_STRICT; } /* * Retrieve synthetic-modifier. Class not present in source-code but * generated by e.g. compiler TODO Do we need both checks? */ if (Modifier.isSynthetic(modVal) || host.hasTag("SyntheticTag")) { modifier |= Opcodes.ACC_SYNTHETIC; } // Retrieve annotation-modifier if (Modifier.isAnnotation(modVal) && host instanceof SootClass) { modifier |= Opcodes.ACC_ANNOTATION; } // Retrieve enum-modifier if (Modifier.isEnum(modVal) && !(host instanceof SootMethod)) { modifier |= Opcodes.ACC_ENUM; } return modifier; }
Example 18
Source File: Helper.java From instrumentation with Apache License 2.0 | 4 votes |
public static boolean isAbstract(MethodNode m) { return (m.access & Opcodes.ACC_ABSTRACT) != 0; }
Example 19
Source File: GizmoClassVisitor.java From gizmo with Apache License 2.0 | 4 votes |
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { super.visit(version, access, name, signature, superName, interfaces); this.name = name; append("// Class: ").append(name).newLine(); append("// Access = "); for (int mods = access; mods != 0;) { int mod = Integer.lowestOneBit(mods); switch (mod) { case Opcodes.ACC_PUBLIC: { append(" public"); break; } case Opcodes.ACC_PRIVATE: { append(" private"); break; } case Opcodes.ACC_PROTECTED: { append(" protected"); break; } case Opcodes.ACC_STATIC: { append(" static"); break; } case Opcodes.ACC_FINAL: { append(" final"); break; } case Opcodes.ACC_INTERFACE: { append(" interface"); break; } case Opcodes.ACC_ABSTRACT: { append(" abstract"); break; } case Opcodes.ACC_SYNTHETIC: { append(" synthetic"); break; } case Opcodes.ACC_ANNOTATION: { append(" annotation"); break; } case Opcodes.ACC_ENUM: { append(" enum"); break; } } mods ^= mod; } newLine(); if (superName != null) append("// Extends: ").append(superName).newLine(); if (interfaces != null && interfaces.length > 0) { append("// Implements:").newLine(); for (String iName : interfaces) { append("// ").append(iName).newLine(); } } newLine(); append("// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code."); newLine(); append("// Use only for debugging purposes."); newLine().newLine(); }
Example 20
Source File: IncrementalVisitor.java From AnoleFix with MIT License | 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, 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 isAccessCompatibleWithInstantRun(int access) { return ((access & Opcodes.ACC_ABSTRACT) == 0) && ((access & Opcodes.ACC_BRIDGE) == 0); }