当前位置: 首页>>代码示例>>Java>>正文


Java Opcodes.ACC_PROTECTED属性代码示例

本文整理汇总了Java中org.objectweb.asm.Opcodes.ACC_PROTECTED属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.ACC_PROTECTED属性的具体用法?Java Opcodes.ACC_PROTECTED怎么用?Java Opcodes.ACC_PROTECTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.objectweb.asm.Opcodes的用法示例。


在下文中一共展示了Opcodes.ACC_PROTECTED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

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

示例2: checkAccess

/**
 * Checks that the given access flags do not contain invalid flags. This
 * method also checks that mutually incompatible flags are not set
 * simultaneously.
 * 
 * @param access
 *            the access flags to be checked
 * @param possibleAccess
 *            the valid access flags.
 */
static void checkAccess(final int access, final int possibleAccess) {
    if ((access & ~possibleAccess) != 0) {
        throw new IllegalArgumentException("Invalid access flags: "
                + access);
    }
    int pub = (access & Opcodes.ACC_PUBLIC) == 0 ? 0 : 1;
    int pri = (access & Opcodes.ACC_PRIVATE) == 0 ? 0 : 1;
    int pro = (access & Opcodes.ACC_PROTECTED) == 0 ? 0 : 1;
    if (pub + pri + pro > 1) {
        throw new IllegalArgumentException(
                "public private and protected are mutually exclusive: "
                        + access);
    }
    int fin = (access & Opcodes.ACC_FINAL) == 0 ? 0 : 1;
    int abs = (access & Opcodes.ACC_ABSTRACT) == 0 ? 0 : 1;
    if (fin + abs > 1) {
        throw new IllegalArgumentException(
                "final and abstract are mutually exclusive: " + access);
    }
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:30,代码来源:CheckClassAdapter.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) {
  /*
   * Record the original access bits so we can restore them before the next
   * link in the visitor chain.
   */
  originalClassAccess = access;
  accessCaptured = true;

  // If we're checking an inner class, suppress access bits that ASM chokes on.
  int checkClassAccess = access;
  if (name.indexOf('$') >= 0) {
    checkClassAccess &= ~(Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC);
  }
  super.visit(version, checkClassAccess, name, signature, superName, interfaces);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:17,代码来源:InnerClassAccessStripper.java

示例4: get_access

@Override
public int get_access() throws CompileException {
  if ((method_node.access & Opcodes.ACC_PUBLIC) != 0) {
    return Opcodes.ACC_PUBLIC;
  } else if ((method_node.access & Opcodes.ACC_PRIVATE) != 0) {
    return Opcodes.ACC_PRIVATE;
  } else if ((method_node.access & Opcodes.ACC_PROTECTED) != 0) {
    return Opcodes.ACC_PROTECTED;
  }
  throw new CompileException("Invalid access priviledge");
}
 
开发者ID:Samsung,项目名称:MeziLang,代码行数:11,代码来源:TResolvedFunc.java

示例5: getScore

@Override
public double getScore(MethodInstance methodA, MethodInstance methodB, ClassEnvironment env) {
	if (!checkAsmNodes(methodA, methodB)) return compareAsmNodes(methodA, methodB);

	int mask = (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE) | Opcodes.ACC_FINAL | Opcodes.ACC_SYNCHRONIZED | Opcodes.ACC_BRIDGE | Opcodes.ACC_VARARGS | Opcodes.ACC_STRICT | Opcodes.ACC_SYNTHETIC;
	int resultA = methodA.getAsmNode().access & mask;
	int resultB = methodB.getAsmNode().access & mask;

	return 1 - Integer.bitCount(resultA ^ resultB) / 8.;
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:10,代码来源:MethodClassifier.java

示例6: visitMethod

@Override
public MethodVisitor visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    if (computeSVUID) {
        if ("<clinit>".equals(name)) {
            hasStaticInitializer = true;
        }
        /*
         * Remembers non private constructors and methods for SVUID
         * computation For constructor and method modifiers, only the
         * ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
         * ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT and ACC_STRICT flags
         * are used.
         */
        int mods = access
                & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
                        | Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
                        | Opcodes.ACC_FINAL | Opcodes.ACC_SYNCHRONIZED
                        | Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STRICT);

        // all non private methods
        if ((access & Opcodes.ACC_PRIVATE) == 0) {
            if ("<init>".equals(name)) {
                svuidConstructors.add(new Item(name, mods, desc));
            } else if (!"<clinit>".equals(name)) {
                svuidMethods.add(new Item(name, mods, desc));
            }
        }
    }

    return super.visitMethod(access, name, desc, signature, exceptions);
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:32,代码来源:SerialVersionUIDAdder.java

示例7: 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:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:27,代码来源:SerialVersionUIDAdder.java

示例8: getOpcodeVisibility

public static int getOpcodeVisibility(String visibility) {
  if ("public".equals(visibility)) {
    return Opcodes.ACC_PUBLIC;
  }
  if ("protected".equals(visibility)) {
    return Opcodes.ACC_PROTECTED;
  }
  if ("private".equals(visibility)) {
    return Opcodes.ACC_PRIVATE;
  }
  return 0;
}
 
开发者ID:fergarrui,项目名称:custom-bytecode-analyzer,代码行数:12,代码来源:RuleHelper.java

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

示例10: 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:acmerli,项目名称:fastAOP,代码行数:48,代码来源:Textifier.java

示例11: setPublic

private int setPublic(int access) {
    return (access & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED)) | Opcodes.ACC_PUBLIC;
}
 
开发者ID:Meituan-Dianping,项目名称:Robust,代码行数:3,代码来源:AsmInsertImpl.java

示例12: toPublic

private static int toPublic(int access)
{
    return access & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED) | Opcodes.ACC_PUBLIC;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:4,代码来源:EventSubscriberTransformer.java

示例13: isProtect

public static MethodAccessMatch isProtect() {
    return new MethodAccessMatch(Opcodes.ACC_PROTECTED);
}
 
开发者ID:yutian-tianpl,项目名称:byte-cobweb,代码行数:3,代码来源:MethodMatchers.java

示例14: noPkgPrivate

private static int noPkgPrivate(int access) {
    if ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE)) == 0)
        access |= Opcodes.ACC_PUBLIC;
    return access;
}
 
开发者ID:iamahuman,项目名称:IdentObf,代码行数:5,代码来源:AsmClassAccessRequestAdapter.java

示例15: publicize

private static int publicize(int access) {
	access &= ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED);
	access |= Opcodes.ACC_PUBLIC;
	return access;
}
 
开发者ID:jonathanedgecombe,项目名称:anvil,代码行数:5,代码来源:ClassPublicizer.java


注:本文中的org.objectweb.asm.Opcodes.ACC_PROTECTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。