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


Java Opcodes.V1_7屬性代碼示例

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


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

示例1: checkLDCConstant

void checkLDCConstant(final Object cst) {
    if (cst instanceof Type) {
        int s = ((Type) cst).getSort();
        if (s != Type.OBJECT && s != Type.ARRAY && s != Type.METHOD) {
            throw new IllegalArgumentException("Illegal LDC constant value");
        }
        if (s != Type.METHOD && (version & 0xFFFF) < Opcodes.V1_5) {
            throw new IllegalArgumentException(
                    "ldc of a constant class requires at least version 1.5");
        }
        if (s == Type.METHOD && (version & 0xFFFF) < Opcodes.V1_7) {
            throw new IllegalArgumentException(
                    "ldc of a method type requires at least version 1.7");
        }
    } else if (cst instanceof Handle) {
        if ((version & 0xFFFF) < Opcodes.V1_7) {
            throw new IllegalArgumentException(
                    "ldc of a handle requires at least version 1.7");
        }
        int tag = ((Handle) cst).getTag();
        if (tag < Opcodes.H_GETFIELD || tag > Opcodes.H_INVOKEINTERFACE) {
            throw new IllegalArgumentException("invalid handle tag " + tag);
        }
    } else {
        checkConstant(cst);
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:27,代碼來源:CheckMethodAdapter.java

示例2: visit

@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
{
    if( (version == Opcodes.V1_8 && !SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) ||
        (version == Opcodes.V1_7 && !SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7)) )
    {
        if(classMap.containsKey(name)) blame(classMap.get(name), name);
        else orphanNaughtyClasses.add(name);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:10,代碼來源:BlamingTransformer.java

示例3: visit

@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:72,代碼來源:ASMifier.java


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