本文整理汇总了Java中javassist.bytecode.AccessFlag.PUBLIC属性的典型用法代码示例。如果您正苦于以下问题:Java AccessFlag.PUBLIC属性的具体用法?Java AccessFlag.PUBLIC怎么用?Java AccessFlag.PUBLIC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javassist.bytecode.AccessFlag
的用法示例。
在下文中一共展示了AccessFlag.PUBLIC属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeInnerClass
private void writeInnerClass(InnerClassesAttribute attr, List<ClassEntry> obfClassChain, ClassEntry obfClassEntry) {
// get the new inner class name
ClassEntry obfInnerClassEntry = obfClassEntry.buildClassEntry(obfClassChain);
ClassEntry obfOuterClassEntry = obfInnerClassEntry.getOuterClassEntry();
// here's what the JVM spec says about the InnerClasses attribute
// append(inner, parent, 0 if anonymous else simple name, flags);
// update the attribute with this inner class
ConstPool constPool = attr.getConstPool();
int innerClassIndex = constPool.addClassInfo(obfInnerClassEntry.getName());
int parentClassIndex = constPool.addClassInfo(obfOuterClassEntry.getName());
int innerClassNameIndex = 0;
int accessFlags = AccessFlag.PUBLIC;
// TODO: need to figure out if we can put static or not
if (!m_index.isAnonymousClass(obfClassEntry)) {
innerClassNameIndex = constPool.addUtf8Info(obfInnerClassEntry.getInnermostClassName());
}
attr.append(innerClassIndex, parentClassIndex, innerClassNameIndex, accessFlags);
/* DEBUG
System.out.println(String.format("\tOBF: %s -> ATTR: %s,%s,%s (replace %s with %s)",
obfClassEntry,
attr.innerClass(attr.tableLength() - 1),
attr.outerClass(attr.tableLength() - 1),
attr.innerName(attr.tableLength() - 1),
Constants.NonePackage + "/" + obfInnerClassName,
obfClassEntry.getName()
));
*/
}
示例2: getModifier
public static String getModifier(CtMethod m){
switch (m.getModifiers()) {
case AccessFlag.PRIVATE:
return "private";
case AccessFlag.PUBLIC:
return "public";
case AccessFlag.PROTECTED:
return "protected";
default:
return "";
}
}
示例3: writeInnerClass
private void writeInnerClass(InnerClassesAttribute attr, List<ClassEntry> obfClassChain, ClassEntry obfClassEntry) {
// get the new inner class name
ClassEntry obfInnerClassEntry = obfClassEntry.buildClassEntry(obfClassChain);
ClassEntry obfOuterClassEntry = obfInnerClassEntry.getOuterClassEntry();
// here's what the JVM spec says about the InnerClasses attribute
// append(inner, parent, 0 if anonymous else simple name, flags);
// update the attribute with this inner class
ConstPool constPool = attr.getConstPool();
int innerClassIndex = constPool.addClassInfo(obfInnerClassEntry.getName());
int parentClassIndex = constPool.addClassInfo(obfOuterClassEntry.getName());
int innerClassNameIndex = 0;
int accessFlags = AccessFlag.PUBLIC;
// TODO: need to figure out if we can put static or not
if (!this.index.isAnonymousClass(obfClassEntry)) {
innerClassNameIndex = constPool.addUtf8Info(obfInnerClassEntry.getInnermostClassName());
}
attr.append(innerClassIndex, parentClassIndex, innerClassNameIndex, accessFlags);
/* DEBUG
System.out.println(String.format("\tOBF: %s -> ATTR: %s,%s,%s (replace %s with %s)",
obfClassEntry,
attr.innerClass(attr.tableLength() - 1),
attr.outerClass(attr.tableLength() - 1),
attr.innerName(attr.tableLength() - 1),
Constants.NonePackage + "/" + obfInnerClassName,
obfClassEntry.getName()
));
*/
}
示例4: writeInnerClass
private void writeInnerClass(InnerClassesAttribute attr,
List<ClassEntry> obfClassChain, ClassEntry obfClassEntry)
{
// get the new inner class name
ClassEntry obfInnerClassEntry =
obfClassEntry.buildClassEntry(obfClassChain);
ClassEntry obfOuterClassEntry = obfInnerClassEntry.getOuterClassEntry();
// here's what the JVM spec says about the InnerClasses attribute
// append(inner, parent, 0 if anonymous else simple name, flags);
// update the attribute with this inner class
ConstPool constPool = attr.getConstPool();
int innerClassIndex =
constPool.addClassInfo(obfInnerClassEntry.getName());
int parentClassIndex =
constPool.addClassInfo(obfOuterClassEntry.getName());
int innerClassNameIndex = 0;
int accessFlags = AccessFlag.PUBLIC;
// TODO: need to figure out if we can put static or not
if(!m_index.isAnonymousClass(obfClassEntry))
innerClassNameIndex =
constPool.addUtf8Info(obfInnerClassEntry
.getInnermostClassName());
attr.append(innerClassIndex, parentClassIndex, innerClassNameIndex,
accessFlags);
/*
* DEBUG
* System.out.println(String.format(
* "\tOBF: %s -> ATTR: %s,%s,%s (replace %s with %s)",
* obfClassEntry,
* attr.innerClass(attr.tableLength() - 1),
* attr.outerClass(attr.tableLength() - 1),
* attr.innerName(attr.tableLength() - 1),
* Constants.NonePackage + "/" + obfInnerClassName,
* obfClassEntry.getName()
* ));
*/
}