List of usage examples for org.objectweb.asm Opcodes ACC_INTERFACE
int ACC_INTERFACE
To view the source code for org.objectweb.asm Opcodes ACC_INTERFACE.
Click Source Link
From source file:com.googlecode.dex2jar.tools.JarAccessCmd.java
License:Apache License
static int str2acc(String s) { if (s == null) { return 0; }/*from w w w . j a v a 2 s .co m*/ int result = 0; s = s.toLowerCase(); if (s.contains("public")) { result |= Opcodes.ACC_PUBLIC; } if (s.contains("private")) { result |= Opcodes.ACC_PRIVATE; } if (s.contains("protected")) { result |= Opcodes.ACC_PROTECTED; } if (s.contains("final")) { result |= Opcodes.ACC_FINAL; } if (s.contains("static")) { result |= Opcodes.ACC_STATIC; } if (s.contains("super")) { result |= Opcodes.ACC_SUPER; } if (s.contains("synchronized")) { result |= Opcodes.ACC_SYNCHRONIZED; } if (s.contains("volatile")) { result |= Opcodes.ACC_VOLATILE; } if (s.contains("bridge")) { result |= Opcodes.ACC_BRIDGE; } if (s.contains("transient")) { result |= Opcodes.ACC_TRANSIENT; } if (s.contains("varargs")) { result |= Opcodes.ACC_VARARGS; } if (s.contains("native")) { result |= Opcodes.ACC_NATIVE; } if (s.contains("strict")) { result |= Opcodes.ACC_STRICT; } if (s.contains("interface")) { result |= Opcodes.ACC_INTERFACE; } if (s.contains("abstract")) { result |= Opcodes.ACC_ABSTRACT; } if (s.contains("synthetic")) { result |= Opcodes.ACC_SYNTHETIC; } if (s.contains("annotation")) { result |= Opcodes.ACC_ANNOTATION; } if (s.contains("enum")) { result |= Opcodes.ACC_ENUM; } if (s.contains("deprecated")) { result |= Opcodes.ACC_DEPRECATED; } return result; }
From source file:com.googlecode.dex2jar.v3.V3ClassAdapter.java
License:Apache License
private int clearClassAccess(boolean isInner, int access) { if ((access & Opcodes.ACC_INTERFACE) == 0) { // issue 55 access |= Opcodes.ACC_SUPER;// ?classdx???? }// w w w .j a va 2s . co m // access in class has no acc_static or acc_private access &= ~(Opcodes.ACC_STATIC | Opcodes.ACC_PRIVATE); if (isInner && (access & Opcodes.ACC_PROTECTED) != 0) {// protected inner class are public access &= ~Opcodes.ACC_PROTECTED; access |= Opcodes.ACC_PUBLIC; } return access; }
From source file:com.googlecode.gwt.test.internal.rewrite.RewriteSingleJsoImplDispatches.java
License:Apache License
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {/* ww w. ja v a 2 s .co m*/ assert currentTypeName == null; super.visit(version, access, name, signature, superName, interfaces); /* * This visitor would mangle JSO$ since it acts as a roll-up of all SingleJso types and the * result would be repeated method definitions due to the trampoline methods this visitor * would create. */ if (name.equals(OverlayTypesRewriter.JAVASCRIPTOBJECT_IMPL_DESC)) { return; } currentTypeName = name; inSingleJsoImplInterfaceType = jsoData.getSingleJsoIntfTypes().contains(name); /* * Implements objective #2: non-JSO types that implement a SingleJsoImpl interface don't have * their original instance methods altered. Instead, we add trampoline methods with mangled * names that simply call over to the original methods. */ if (interfaces != null && (access & Opcodes.ACC_INTERFACE) == 0) { Set<String> toStub = computeAllInterfaces(interfaces); toStub.retainAll(jsoData.getSingleJsoIntfTypes()); for (String stubIntr : toStub) { writeTrampoline(stubIntr); } } }
From source file:com.googlecode.japi.checker.model.ClassData.java
License:Apache License
public boolean isInterface() { return (this.getAccess() & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE; }
From source file:com.googlecode.japi.checker.model.JavaItem.java
License:Apache License
protected JavaItem(ClassDataLoader loader, ClassData owner, int access, String name) { this.setOwner(owner); this.setName(name); this.setVisibility(toScope(access)); this.setAbstract((access & Opcodes.ACC_ABSTRACT) == Opcodes.ACC_ABSTRACT); this.setInterface((access & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE); this.setFinal((access & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL); this.setStatic((access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC); this.setTransient((access & Opcodes.ACC_TRANSIENT) == Opcodes.ACC_TRANSIENT); this.setVariableArity((access & Opcodes.ACC_VARARGS) == Opcodes.ACC_VARARGS); this.setClassDataLoader(loader); }
From source file:com.igormaznitsa.jute.TestClassProcessor.java
License:Apache License
@Override public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { this.className = name.replace('/', '.'); this.inappropriateClass = (access & (Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_ANNOTATION | Opcodes.ACC_ENUM)) != 0; }
From source file:com.liferay.portal.nio.intraband.proxy.IntrabandProxyUtil.java
License:Open Source License
protected static Class<?> generateStubClass(ClassLoader classLoader, Class<?> clazz, String skeletonId) { String internalName = Type.getInternalName(clazz); ClassNode classNode = ASMUtil.loadAndRename(clazz, internalName.concat(STUB_POSTFIX)); // Class modifiers and hierarchy classNode.access &= ~(Opcodes.ACC_ABSTRACT | Opcodes.ACC_INTERFACE); classNode.access |= Opcodes.ACC_PUBLIC; if (clazz.isInterface()) { List<String> interfaces = classNode.interfaces; interfaces.clear();/*from ww w .j a v a2s. c o m*/ interfaces.add(internalName); } // Clean up MethodNodes that are going to be generated List<MethodNode> methodNodes = classNode.methods; MethodNode defaultInitMethodNode = ASMUtil.removeMethodNode(methodNodes, "<init>", Type.VOID_TYPE); ASMUtil.removeMethodNodes(methodNodes, "<init>"); ASMUtil.removeMethodNodes(methodNodes, Opcodes.ACC_ABSTRACT); ASMUtil.removeMethodNodes(methodNodes, _annotationDescriptors); // Apply template class ClassNode templateClassNode = ASMUtil.loadAndRename(TemplateStub.class, classNode.name); List<FieldNode> templateFieldNodes = templateClassNode.fields; FieldNode idFieldNode = ASMUtil.findFieldNode(templateFieldNodes, "_id"); idFieldNode.access |= Opcodes.ACC_FINAL; FieldNode intrabandFieldNode = ASMUtil.findFieldNode(templateFieldNodes, "_intraband"); intrabandFieldNode.access |= Opcodes.ACC_FINAL; FieldNode registrationReferenceFieldNode = ASMUtil.findFieldNode(templateFieldNodes, "_registrationReference"); registrationReferenceFieldNode.access |= Opcodes.ACC_FINAL; ASMUtil.addFieldNodes(classNode.fields, templateFieldNodes); List<MethodNode> templateMethodNodes = templateClassNode.methods; MethodNode templateInitMethodNode = ASMUtil.findMethodNode(templateMethodNodes, "<init>", Type.VOID_TYPE, _STRING_TYPE, _REGISTRATION_REFERENCE_TYPE, _EXCEPTION_HANDLER_TYPE); if (defaultInitMethodNode != null) { ASMUtil.mergeMethods(templateInitMethodNode, defaultInitMethodNode, templateInitMethodNode); } MethodNode defaultClinitMethodNode = ASMUtil.removeMethodNode(methodNodes, "<clinit>", Type.VOID_TYPE); if (defaultClinitMethodNode != null) { MethodNode templateClinitMethodNode = ASMUtil.findMethodNode(templateMethodNodes, "<clinit>", Type.VOID_TYPE); ASMUtil.mergeMethods(templateClinitMethodNode, defaultClinitMethodNode, templateClinitMethodNode); } methodNodes.addAll(templateMethodNodes); Type stubType = Type.getType(classNode.name); // Id methods MethodsBag methodsBag = extractMethods(clazz); for (Method idMethod : methodsBag.idMethods) { MethodNodeGenerator methodNodeGenerator = new MethodNodeGenerator(idMethod); methodNodeGenerator.loadThis(); methodNodeGenerator.getField(stubType, "_id", _STRING_TYPE); methodNodeGenerator.returnValue(); methodNodeGenerator.endMethod(); methodNodes.add(methodNodeGenerator.getMethodNode()); } // Proxy methods List<Method> proxyMethods = methodsBag.proxyMethods; for (int i = 0; i < proxyMethods.size(); i++) { methodNodes.add(createProxyMethodNode(proxyMethods.get(i), i, skeletonId, stubType)); } // Empty methods for (Method emptyMethod : methodsBag.emptyMethods) { MethodNodeGenerator methodNodeGenerator = new MethodNodeGenerator(emptyMethod); ASMUtil.addDefaultReturnInsns(methodNodeGenerator, Type.getType(emptyMethod.getReturnType())); methodNodeGenerator.endMethod(); methodNodes.add(methodNodeGenerator.getMethodNode()); } rewriteGetProxyMethodSignaturesMethodNode(classNode, methodsBag.proxyMethodSignatures); return toClass(classNode, classLoader); }
From source file:com.masetta.spann.metadata.reader.asm3_2.ClassModifierImpl.java
License:Apache License
public ClassType getClassType() { switch (modifier & TYPES) { case 0:/*ww w .j a v a 2 s . c o m*/ return ClassType.CLASS; case Opcodes.ACC_INTERFACE: return ClassType.INTERFACE; case ANN: return ClassType.ANNOTATION; case Opcodes.ACC_ENUM: return ClassType.ENUM; } throw new IllegalStateException("Unreachable"); }
From source file:com.mebigfatguy.deadmethods.ClassInfo.java
License:Apache License
public boolean isInterface() { return (classAccess & Opcodes.ACC_INTERFACE) != 0; }
From source file:com.mebigfatguy.junitflood.classpath.ClassInfoCollectingVisitor.java
License:Apache License
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {/*from w w w. j a v a2 s. c om*/ details.addInterfaces(interfaces); details.addSuperclass(superName); details.setFinal((access & Opcodes.ACC_FINAL) != 0); details.setInterface((access & Opcodes.ACC_INTERFACE) != 0); }