當前位置: 首頁>>代碼示例>>Java>>正文


Java Opcodes.ACC_ENUM屬性代碼示例

本文整理匯總了Java中org.objectweb.asm.Opcodes.ACC_ENUM屬性的典型用法代碼示例。如果您正苦於以下問題:Java Opcodes.ACC_ENUM屬性的具體用法?Java Opcodes.ACC_ENUM怎麽用?Java Opcodes.ACC_ENUM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.objectweb.asm.Opcodes的用法示例。


在下文中一共展示了Opcodes.ACC_ENUM屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAccess

public int getAccess() {
	if (asmNodes != null) {
		return asmNodes[0].access;
	} else {
		int ret = Opcodes.ACC_PUBLIC;

		if (!implementers.isEmpty()) {
			ret |= Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT;
		} else if (superClass != null && superClass.id.equals("Ljava/lang/Enum;")) {
			ret |= Opcodes.ACC_ENUM;
			if (childClasses.isEmpty()) ret |= Opcodes.ACC_FINAL;
		} else if (interfaces.size() == 1 && interfaces.iterator().next().id.equals("Ljava/lang/annotation/Annotation;")) {
			ret |= Opcodes.ACC_ANNOTATION | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT;
		}

		return ret;
	}
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:18,代碼來源:ClassInstance.java

示例2: visit

@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    computeSVUID = (access & Opcodes.ACC_ENUM) == 0;

    if (computeSVUID) {
        this.name = name;
        this.access = access;
        this.interfaces = new String[interfaces.length];
        System.arraycopy(interfaces, 0, this.interfaces, 0,
                interfaces.length);
    }

    super.visit(version, access, name, signature, superName, interfaces);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:16,代碼來源:SerialVersionUIDAdder.java

示例3: visit

@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
    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, name);

    javaClassBuilder = new DomainBuilders.JavaClassBuilder()
            .withSource(createSource(sourceURI))
            .withType(javaType)
            .withInterface(opCodeForInterfaceIsPresent)
            .withEnum(opCodeForEnumIsPresent)
            .withModifiers(JavaModifier.getModifiersForClass(access));

    className = javaType.getName();
    declarationHandler.onNewClass(className, superClassName, interfaceNames);
}
 
開發者ID:TNG,項目名稱:ArchUnit,代碼行數:25,代碼來源:JavaClassProcessor.java

示例4: getAccess

@Override
public int getAccess() {
	if (asmNode == null) {
		int ret = Opcodes.ACC_PUBLIC;
		if (isStatic) ret |= Opcodes.ACC_STATIC;
		if (isStatic && type == cls && cls.isEnum()) ret |= Opcodes.ACC_ENUM;
		if (isStatic && cls.isInterface()) ret |= Opcodes.ACC_FINAL;

		return ret;
	} else {
		return asmNode.access;
	}
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:13,代碼來源:FieldInstance.java

示例5: isEnum

public boolean isEnum() {
	return (getAccess() & Opcodes.ACC_ENUM) != 0;
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:3,代碼來源:ClassInstance.java

示例6: appendAccess

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) {
        sb.append("final ");
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        sb.append("static ");
    }
    if ((access & Opcodes.ACC_SUPER) != 0) {
        if ((access & ACCESS_CLASS) == 0) {
            sb.append("synchronized ");
        } else {
            sb.append("super ");
        }
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        if ((access & ACCESS_FIELD) == 0) {
            sb.append("bridge ");
        } else {
            sb.append("volatile ");
        }
    }
    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) {
        sb.append("mandated ");
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:65,代碼來源:SAXClassAdapter.java

示例7: visit

@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    this.access = access;
    int major = version & 0xFFFF;
    int minor = version >>> 16;
    buf.setLength(0);
    buf.append("// class version ").append(major).append('.').append(minor)
            .append(" (").append(version).append(")\n");
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append("// DEPRECATED\n");
    }
    buf.append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');

    appendDescriptor(CLASS_SIGNATURE, signature);
    if (signature != null) {
        TraceSignatureVisitor sv = new TraceSignatureVisitor(access);
        SignatureReader r = new SignatureReader(signature);
        r.accept(sv);
        buf.append("// declaration: ").append(name)
                .append(sv.getDeclaration()).append('\n');
    }

    appendAccess(access & ~Opcodes.ACC_SUPER);
    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
        buf.append("@interface ");
    } else if ((access & Opcodes.ACC_INTERFACE) != 0) {
        buf.append("interface ");
    } else if ((access & Opcodes.ACC_ENUM) == 0) {
        buf.append("class ");
    }
    appendDescriptor(INTERNAL_NAME, name);

    if (superName != null && !"java/lang/Object".equals(superName)) {
        buf.append(" extends ");
        appendDescriptor(INTERNAL_NAME, superName);
        buf.append(' ');
    }
    if (interfaces != null && interfaces.length > 0) {
        buf.append(" implements ");
        for (int i = 0; i < interfaces.length; ++i) {
            appendDescriptor(INTERNAL_NAME, interfaces[i]);
            buf.append(' ');
        }
    }
    buf.append(" {\n\n");

    text.add(buf.toString());
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:51,代碼來源:Textifier.java

示例8: appendAccess

/**
 * 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 ");
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:48,代碼來源:Textifier.java

示例9: isEnum

private boolean isEnum(int access) {
    return (Opcodes.ACC_ENUM & access) == Opcodes.ACC_ENUM;
}
 
開發者ID:alibaba,項目名稱:jvm-sandbox,代碼行數:3,代碼來源:EventEnhancer.java

示例10: fixMethodBody

/**
 * Rewrites the method bytecode to remove the "Stub!" exception.
 */
private void fixMethodBody(MethodNode methodNode, ClassNode classNode) {
    if ((methodNode.access & Opcodes.ACC_NATIVE) != 0
            || (methodNode.access & Opcodes.ACC_ABSTRACT) != 0) {
        // Abstract and native method don't have bodies to rewrite.
        return;
    }
    
    if ((classNode.access & Opcodes.ACC_ENUM) != 0 && ENUM_METHODS.contains(methodNode.name)) {
        // Don't break enum classes.
        return;
    }
    
    Type returnType = Type.getReturnType(methodNode.desc);
    InsnList instructions = methodNode.instructions;
    List localVariables = methodNode.localVariables;
    List tryCatchBlocks = methodNode.tryCatchBlocks;

    if (localVariables != null && !localVariables.isEmpty()) {
        localVariables.clear();
    }
    if (tryCatchBlocks != null && !tryCatchBlocks.isEmpty()) {
        tryCatchBlocks.clear();
    }
    
    if (methodNode.name.equals(CONSTRUCTOR)) {
        // Keep the call to parent constructor, delete the exception after that.
        
        boolean deadCode = false;
        for (AbstractInsnNode instruction : instructions.toArray()) {
            if (!deadCode) {
                if (instruction.getOpcode() == Opcodes.INVOKESPECIAL) {
                    instructions.insert(instruction, new InsnNode(Opcodes.RETURN));
                    // Start removing all following instructions.
                    deadCode = true;
                }
            } else {
                instructions.remove(instruction);
            }
        }
    } else {
        instructions.clear();
        
        if (returnDefaultValues || methodNode.name.equals(CLASS_CONSTRUCTOR)) {
            if (INTEGER_LIKE_TYPES.contains(returnType)) {
                instructions.add(new InsnNode(Opcodes.ICONST_0));
            } else if (returnType.equals(Type.LONG_TYPE)) {
                instructions.add(new InsnNode(Opcodes.LCONST_0));
            } else if (returnType.equals(Type.FLOAT_TYPE)) {
                instructions.add(new InsnNode(Opcodes.FCONST_0));
            } else if (returnType.equals(Type.DOUBLE_TYPE)) {
                instructions.add(new InsnNode(Opcodes.DCONST_0));
            } else {
                instructions.add(new InsnNode(Opcodes.ACONST_NULL));
            }
            
            instructions.add(new InsnNode(returnType.getOpcode(Opcodes.IRETURN)));
        } else {
            instructions.insert(throwExceptionsList(methodNode, classNode));
        }
    }
}
 
開發者ID:codezjx,項目名稱:MockableJarGenerator,代碼行數:64,代碼來源:MockableJarGenerator.java


注:本文中的org.objectweb.asm.Opcodes.ACC_ENUM屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。