本文整理匯總了Java中org.apache.bcel.classfile.JavaClass.getConstantPool方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaClass.getConstantPool方法的具體用法?Java JavaClass.getConstantPool怎麽用?Java JavaClass.getConstantPool使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.bcel.classfile.JavaClass
的用法示例。
在下文中一共展示了JavaClass.getConstantPool方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitObject
import org.apache.bcel.classfile.JavaClass; //導入方法依賴的package包/類
/** @see com.puppycrawl.tools.checkstyle.bcel.IDeepVisitor */
public void visitObject(Object aObject)
{
final JavaClass javaClass = (JavaClass) aObject;
final ConstantPool pool = javaClass.getConstantPool();
mCurrentPoolGen = new ConstantPoolGen(pool);
}
示例2: visitClassContext
import org.apache.bcel.classfile.JavaClass; //導入方法依賴的package包/類
@Override
public void visitClassContext(ClassContext classContext) {
JavaClass javaClass = classContext.getJavaClass();
if (!javaClass.getPackageName().contains(".pages")) {
return;
}
//The package contains ".pages" and has some references to tapestry
// then it must be an endpoint.
//The constants pool contains all references that are reused in the bytecode
// including full class name and interface name.
if (javaClass.getPackageName().contains(".pages")) {
ConstantPool constants = javaClass.getConstantPool();
for (Constant c : constants.getConstantPool()) {
if (c instanceof ConstantUtf8) {
ConstantUtf8 utf8 = (ConstantUtf8) c;
String constantValue = String.valueOf(utf8.getBytes());
if (constantValue.startsWith("Lorg/apache/tapestry5/annotations")) {
bugReporter.reportBug(new BugInstance(this, TAPESTRY_ENDPOINT_TYPE, Priorities.LOW_PRIORITY) //
.addClass(javaClass));
return;
}
}
}
}
}