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


Java Opcodes.ACC_STATIC屬性代碼示例

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


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

示例1: registerClassMemberVar

private void registerClassMemberVar(TContextClass class_ctx, Container container) throws CompileException {
  ClassWriter cw = class_ctx.getClassWriter();
  Debug.assertion(cw != null, "ClassWriter should not be null");

  AbsType field_type = container.getType();
  Debug.assertion(field_type != null, "Container Type should not be null");

  //// Compiled Instruction
  LOG.debug(
      "Adding Field(" + container.name + ":" + field_type.getMthdDscStr() + ") in (" + class_ctx.getName() + ")");

  int access = 0;
  access |= Opcodes.ACC_PUBLIC;
  // access |= Opcodes.ACC_PROTECTED;

  if (container.isSingleton()) {
    access |= Opcodes.ACC_STATIC;
  }

  cw.visitField(access, container.name, field_type.getMthdDscStr(), null, null).visitEnd();
  //// End
}
 
開發者ID:Samsung,項目名稱:MeziLang,代碼行數:22,代碼來源:ASTCompileVisitor.java

示例2: visitField

@Override
public FieldVisitor visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    String s = remapper.mapFieldName(className, name, desc);
    if ("-".equals(s)) {
        return null;
    }
    if ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0) {
        if ((access & Opcodes.ACC_FINAL) != 0
                && (access & Opcodes.ACC_STATIC) != 0 && desc.length() == 1) {
            return null;
        }
        if ("org/objectweb/asm".equals(pkgName) && s.equals(name)) {
            System.out.println("INFO: " + clsName + "." + s
                    + " could be renamed");
        }
        super.visitField(access, name, desc, null, value);
    } else {
        if (!s.equals(name)) {
            throw new RuntimeException("The public or protected field "
                    + className + '.' + name + " must not be renamed.");
        }
        super.visitField(access, name, desc, null, value);
    }
    return null; // remove debug info
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:26,代碼來源:ClassOptimizer.java

示例3: CommonMethodVisitor

/**
 * 根據方法的描述符初始化參數Type數組
 *
 * @see AdviceAdapter#AdviceAdapter(int, MethodVisitor, int, String, String)
 */
private CommonMethodVisitor(int api, MethodVisitor mv, String className, int access, String name, String desc) {
    super(api, mv, access, name, desc);
    this.mv = mv;
    this.className = className;
    this.methodName = name;
    this.methodDesc = desc;

    this.index = ((access & Opcodes.ACC_STATIC) != 0 ? 0 : 1);
    this.argumentTypes = Type.getArgumentTypes(desc);
}
 
開發者ID:baidu,項目名稱:openrasp,代碼行數:15,代碼來源:CommonMethodVisitor.java

示例4: loadThis

/**
 * Generates the instruction to load 'this' on the stack.
 */
public void loadThis() {
    if ((access & Opcodes.ACC_STATIC) != 0) {
        throw new IllegalStateException(
                "no 'this' pointer within static method");
    }
    mv.visitVarInsn(Opcodes.ALOAD, 0);
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:10,代碼來源:GeneratorAdapter.java

示例5: MethodInsert

protected MethodInsert(MethodVisitor mv, int access, String name, String desc) {
    super(Opcodes.ASM5, mv, access, name, desc);
    this.mv = mv;
    this.start = new Label();
    this.change = -1;
    this.returnType = Type.getReturnType(desc);
    this.name = name;
    this.desc = desc;
    this.types = new ArrayList<Type>(Arrays.asList(Type.getArgumentTypes(desc)));
    this.isStatic = (access & Opcodes.ACC_STATIC) != 0;
    if (!isStatic){
        types.add(0, Type.getType(Object.class));
    }
}
 
開發者ID:Idtk,項目名稱:Hotfix,代碼行數:14,代碼來源:ASMInsert.java

示例6: 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

示例7: getStackIndex

private int getStackIndex(int arg) {
    int index = (access & Opcodes.ACC_STATIC) == 0 ? 1 : 0;
    for (int i = 0; i < arg; i++) {
        index += argTypes[i].getSize();
    }
    return index;
}
 
開發者ID:willfleury,項目名稱:prometheus-metrics-agent,代碼行數:7,代碼來源:AbstractInjector.java

示例8: getAccess

@Override
public int getAccess() {
	if (asmNode == null) {
		int ret = Opcodes.ACC_PUBLIC;
		if (isStatic) ret |= Opcodes.ACC_STATIC;

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

示例9: insertClassInit

/**
 * Generates a new clinit.
 * @param className
 * @param target 
 */
private void insertClassInit(String className, ClassNode target) {
    // method void static clinit()
    MethodNode clinit = new MethodNode(Opcodes.ASM5,
        Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC,
        CLASS_INIT_NAME,
        CLASS_INIT_DESC,
        null,
        new String[0]
    );
    
    transformClassInit(className, clinit);
    target.methods.add(clinit);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:NbJShellAgent.java

示例10: visitField

@Override
public FieldVisitor visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    if (computeSVUID) {
        if ("serialVersionUID".equals(name)) {
            // since the class already has SVUID, we won't be computing it.
            computeSVUID = false;
            hasSVUID = true;
        }
        /*
         * Remember field for SVUID computation For field modifiers, only
         * the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC,
         * ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when
         * computing serialVersionUID values.
         */
        if ((access & Opcodes.ACC_PRIVATE) == 0
                || (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
            int mods = access
                    & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
                            | Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
                            | Opcodes.ACC_FINAL | Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT);
            svuidFields.add(new Item(name, mods, desc));
        }
    }

    return super.visitField(access, name, desc, signature, value);
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:27,代碼來源:SerialVersionUIDAdder.java

示例11: write

/** Writes the function to given ClassVisitor. */
void write (ClassVisitor writer, CompilerSettings settings, Globals globals) {
    int access = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC;
    if (synthetic) {
        access |= Opcodes.ACC_SYNTHETIC;
    }
    final MethodWriter function = new MethodWriter(access, method.method, writer, globals.getStatements(), settings);
    function.visitCode();
    write(function, globals);
    function.endMethod();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:11,代碼來源:SFunction.java

示例12: addSVUID

protected void addSVUID(long svuid) {
    FieldVisitor fv = super.visitField(Opcodes.ACC_FINAL
            + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, svuid);
    if (fv != null) {
        fv.visitEnd();
    }
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:7,代碼來源:SerialVersionUIDAdder.java

示例13: is_static

@Override
public boolean is_static() {
  return ((method_node.access & Opcodes.ACC_STATIC) != 0);
}
 
開發者ID:Samsung,項目名稱:MeziLang,代碼行數:4,代碼來源:TResolvedFunc.java

示例14: 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

示例15: visitMethod

@Override
public Textifier visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    buf.setLength(0);
    buf.append('\n');
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append(tab).append("// DEPRECATED\n");
    }
    buf.append(tab).append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');

    if (signature != null) {
        buf.append(tab);
        appendDescriptor(METHOD_SIGNATURE, signature);

        TraceSignatureVisitor v = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.accept(v);
        String genericDecl = v.getDeclaration();
        String genericReturn = v.getReturnType();
        String genericExceptions = v.getExceptions();

        buf.append(tab).append("// declaration: ").append(genericReturn)
                .append(' ').append(name).append(genericDecl);
        if (genericExceptions != null) {
            buf.append(" throws ").append(genericExceptions);
        }
        buf.append('\n');
    }

    buf.append(tab);
    appendAccess(access & ~Opcodes.ACC_VOLATILE);
    if ((access & Opcodes.ACC_NATIVE) != 0) {
        buf.append("native ");
    }
    if ((access & Opcodes.ACC_VARARGS) != 0) {
        buf.append("varargs ");
    }
    if ((access & Opcodes.ACC_BRIDGE) != 0) {
        buf.append("bridge ");
    }
    if ((this.access & Opcodes.ACC_INTERFACE) != 0
            && (access & Opcodes.ACC_ABSTRACT) == 0
            && (access & Opcodes.ACC_STATIC) == 0) {
        buf.append("default ");
    }

    buf.append(name);
    appendDescriptor(METHOD_DESCRIPTOR, desc);
    if (exceptions != null && exceptions.length > 0) {
        buf.append(" throws ");
        for (int i = 0; i < exceptions.length; ++i) {
            appendDescriptor(INTERNAL_NAME, exceptions[i]);
            buf.append(' ');
        }
    }

    buf.append('\n');
    text.add(buf.toString());

    Textifier t = createTextifier();
    text.add(t.getText());
    return t;
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:64,代碼來源:Textifier.java


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