List of usage examples for org.objectweb.asm Opcodes ACC_ENUM
int ACC_ENUM
To view the source code for org.objectweb.asm Opcodes ACC_ENUM.
Click Source Link
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.masetta.spann.metadata.reader.asm3_2.ClassModifierImpl.java
License:Apache License
public ClassType getClassType() { switch (modifier & TYPES) { case 0:/*from w w w .ja v a2 s. c om*/ 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.tngtech.archunit.core.importer.JavaClassProcessor.java
License:Apache License
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {//from w ww . j av a 2 s . c o m LOG.info("Analysing class '{}'", name); JavaType javaType = JavaTypeImporter.createFromAsmObjectTypeName(name); if (alreadyImported(javaType)) { return; } ImmutableSet<String> interfaceNames = createInterfaceNames(interfaces); LOG.debug("Found interfaces {} on class '{}'", interfaceNames, name); boolean opCodeForInterfaceIsPresent = (access & Opcodes.ACC_INTERFACE) != 0; boolean opCodeForEnumIsPresent = (access & Opcodes.ACC_ENUM) != 0; Optional<String> superClassName = getSuperClassName(superName, opCodeForInterfaceIsPresent); LOG.debug("Found superclass {} on class '{}'", superClassName.orNull(), name); javaClassBuilder = new DomainBuilders.JavaClassBuilder().withSourceUri(sourceURI).withType(javaType) .withInterface(opCodeForInterfaceIsPresent).withEnum(opCodeForEnumIsPresent) .withModifiers(JavaModifier.getModifiersForClass(access)); className = javaType.getName(); declarationHandler.onNewClass(className, superClassName, interfaceNames); }
From source file:cz.vutbr.fit.xhriba01.bc.lib.Utils.java
License:Open Source License
/** * Creates text representation of asm class access flag. * //from ww w .j ava 2 s .c o m * @param flag asm class access flag * @return formatted string representing the access flag */ public static String formatClassAccessFlags(int flag) { List<String> accesses = new ArrayList<>(); if ((flag & Opcodes.ACC_PUBLIC) != 0) { accesses.add("public"); } if ((flag & Opcodes.ACC_PROTECTED) != 0) { accesses.add("protected"); } if ((flag & Opcodes.ACC_PRIVATE) != 0) { accesses.add("private"); } if ((flag & Opcodes.ACC_STATIC) != 0) { accesses.add("static"); } if ((flag & Opcodes.ACC_ABSTRACT) != 0) { accesses.add("abstract"); } if ((flag & Opcodes.ACC_FINAL) != 0) { accesses.add("final"); } if ((flag & Opcodes.ACC_ENUM) != 0) { accesses.add("enum"); } else if ((flag & Opcodes.ACC_INTERFACE) != 0) { accesses.add("interface"); } else { accesses.add("class"); } return join(accesses.toArray(new String[accesses.size()]), " "); }
From source file:edu.ubc.mirrors.holograms.HologramClassGenerator.java
License:Open Source License
private static int forcePublic(int access) { return (~(Opcodes.ACC_ENUM | Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED) & access) | Opcodes.ACC_PUBLIC; }
From source file:edu.ubc.mirrors.holograms.HologramClassGenerator.java
License:Open Source License
@Override public void visitInnerClass(String name, String outerName, String innerName, int access) { int hologramAccess = ~Opcodes.ACC_ENUM & access; super.visitInnerClass(name, outerName, innerName, hologramAccess); }
From source file:graph.Modifier.java
License:Apache License
/** * Returns an integer bit field for the EnumSet, where the bit values are * defined as in the class file format./* www .ja v a2 s. c o m*/ * * @param set Set of modifiers to convert to a bit field. * @return Integer bit field. */ public static int getBitField(EnumSet<Modifier> set) { int access = 0; if (set.contains(PUBLIC)) { access |= Opcodes.ACC_PUBLIC; } if (set.contains(PROTECTED)) { access |= Opcodes.ACC_PROTECTED; } if (set.contains(PRIVATE)) { access |= Opcodes.ACC_PRIVATE; } if (set.contains(STATIC)) { access |= Opcodes.ACC_STATIC; } if (set.contains(FINAL)) { access |= Opcodes.ACC_FINAL; } if (set.contains(SUPER)) { access |= Opcodes.ACC_SUPER; } if (set.contains(INTERFACE)) { access |= Opcodes.ACC_INTERFACE; } if (set.contains(ABSTRACT)) { access |= Opcodes.ACC_ABSTRACT; } if (set.contains(SYNTHETIC)) { access |= Opcodes.ACC_SYNTHETIC; } if (set.contains(ANNOTATION)) { access |= Opcodes.ACC_ANNOTATION; } if (set.contains(ENUM)) { access |= Opcodes.ACC_ENUM; } if (set.contains(VOLATILE)) { access |= Opcodes.ACC_VOLATILE; } if (set.contains(TRANSIENT)) { access |= Opcodes.ACC_TRANSIENT; } if (set.contains(SYNCHRONIZED)) { access |= Opcodes.ACC_SYNCHRONIZED; } if (set.contains(BRIDGE)) { access |= Opcodes.ACC_BRIDGE; } if (set.contains(VARARGS)) { access |= Opcodes.ACC_VARARGS; } if (set.contains(NATIVE)) { access |= Opcodes.ACC_NATIVE; } return access; }
From source file:graph.Modifier.java
License:Apache License
/** * Returns an EnumSet of the modifiers, based on the given bit field (where * the bit values are defined as in the class file format). * * @param access Integer bit field giving access modifiers. * @return Set of modifiers.//from w w w . j a va 2s .c om */ public static EnumSet<Modifier> getSet(int access) { EnumSet<Modifier> modifiers = EnumSet.noneOf(Modifier.class); if ((access & Opcodes.ACC_PUBLIC) != 0) { modifiers.add(Modifier.PUBLIC); } if ((access & Opcodes.ACC_PROTECTED) != 0) { modifiers.add(Modifier.PROTECTED); } if ((access & Opcodes.ACC_PRIVATE) != 0) { modifiers.add(Modifier.PRIVATE); } if ((access & Opcodes.ACC_STATIC) != 0) { modifiers.add(Modifier.STATIC); } if ((access & Opcodes.ACC_FINAL) != 0) { modifiers.add(Modifier.FINAL); } if ((access & Opcodes.ACC_SUPER) != 0) { modifiers.add(Modifier.SUPER); } if ((access & Opcodes.ACC_INTERFACE) != 0) { modifiers.add(Modifier.INTERFACE); } if ((access & Opcodes.ACC_ABSTRACT) != 0) { modifiers.add(Modifier.ABSTRACT); } if ((access & Opcodes.ACC_SYNTHETIC) != 0) { modifiers.add(Modifier.SYNTHETIC); } if ((access & Opcodes.ACC_ANNOTATION) != 0) { modifiers.add(Modifier.ANNOTATION); } if ((access & Opcodes.ACC_ENUM) != 0) { modifiers.add(Modifier.ENUM); } if ((access & Opcodes.ACC_VOLATILE) != 0) { modifiers.add(Modifier.VOLATILE); } if ((access & Opcodes.ACC_TRANSIENT) != 0) { modifiers.add(Modifier.TRANSIENT); } if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) { modifiers.add(Modifier.SYNCHRONIZED); } if ((access & Opcodes.ACC_BRIDGE) != 0) { modifiers.add(Modifier.BRIDGE); } if ((access & Opcodes.ACC_VARARGS) != 0) { modifiers.add(Modifier.VARARGS); } if ((access & Opcodes.ACC_NATIVE) != 0) { modifiers.add(Modifier.NATIVE); } if ((access & Opcodes.ACC_STRICT) != 0) { modifiers.add(Modifier.STRICT); } return modifiers; }
From source file:jp.co.dgic.testing.common.virtualmock.asm.AsmClassChecker.java
License:Open Source License
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {// www . ja v a 2 s. co m _className = name.replace('/', '.'); _superClassName = superName; _interfaces = interfaces; isInterface = (access & Opcodes.ACC_INTERFACE) > 0; isAnnotation = (access & Opcodes.ACC_ANNOTATION) > 0; isEnum = (access & Opcodes.ACC_ENUM) > 0; if (isInterface && interfaces != null && interfaces.length > 0) { _superClassName = interfaces[0]; } if (_superClassName != null) { _superClassName = _superClassName.replace('/', '.'); } InternalMockObjectManager.printConsole( "[AsmClassChecker] " + _className + ".class is " + (isInterface ? "<INTERFACE>" : "<CLASS>")); collectSuperClassInfo(); }
From source file:net.minecraftforge.gradle.tasks.DeobfuscateJar.java
License:Open Source License
private byte[] stripSynthetics(String name, byte[] data) { ClassReader reader = new ClassReader(data); ClassNode node = new ClassNode(); reader.accept(node, 0);/*w w w . j av a2s. c o m*/ if ((node.access & Opcodes.ACC_ENUM) == 0 && !node.superName.equals("java/lang/Enum") && (node.access & Opcodes.ACC_SYNTHETIC) == 0) { // ^^ is for ignoring enums. for (FieldNode f : ((List<FieldNode>) node.fields)) { f.access = f.access & (0xffffffff - Opcodes.ACC_SYNTHETIC); //getLogger().lifecycle("Stripping field: "+f.name); } for (MethodNode m : ((List<MethodNode>) node.methods)) { m.access = m.access & (0xffffffff - Opcodes.ACC_SYNTHETIC); //getLogger().lifecycle("Stripping method: "+m.name); } } ClassWriter writer = new ClassWriter(0); node.accept(writer); return writer.toByteArray(); }