本文整理汇总了Java中org.apache.bcel.classfile.InnerClasses.getInnerClasses方法的典型用法代码示例。如果您正苦于以下问题:Java InnerClasses.getInnerClasses方法的具体用法?Java InnerClasses.getInnerClasses怎么用?Java InnerClasses.getInnerClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.InnerClasses
的用法示例。
在下文中一共展示了InnerClasses.getInnerClasses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitInnerClasses
import org.apache.bcel.classfile.InnerClasses; //导入方法依赖的package包/类
@Override
public void visitInnerClasses(InnerClasses obj) {
super.visitInnerClasses(obj);
InnerClass[] inner_classes = obj.getInnerClasses();
for (InnerClass inner_class : inner_classes)
inner_class.accept(this);
}
示例2: visitInnerClasses
import org.apache.bcel.classfile.InnerClasses; //导入方法依赖的package包/类
public void visitInnerClasses(InnerClasses obj){//vmspec2 4.7.5
// exactly one InnerClasses attr per ClassFile if some inner class is refernced: see visitJavaClass()
checkIndex(obj, obj.getNameIndex(), CONST_Utf8);
String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
if (! name.equals("InnerClasses")){
throw new ClassConstraintException("The InnerClasses attribute '"+tostring(obj)+"' is not correctly named 'InnerClasses' but '"+name+"'.");
}
InnerClass[] ics = obj.getInnerClasses();
for (int i=0; i<ics.length; i++){
checkIndex(obj, ics[i].getInnerClassIndex(), CONST_Class);
int outer_idx = ics[i].getOuterClassIndex();
if (outer_idx != 0){
checkIndex(obj, outer_idx, CONST_Class);
}
int innername_idx = ics[i].getInnerNameIndex();
if (innername_idx != 0){
checkIndex(obj, innername_idx, CONST_Utf8);
}
int acc = ics[i].getInnerAccessFlags();
acc = acc & (~ (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_STATIC | ACC_FINAL | ACC_INTERFACE | ACC_ABSTRACT));
if (acc != 0){
addMessage("Unknown access flag for inner class '"+tostring(ics[i])+"' set (InnerClasses attribute '"+tostring(obj)+"').");
}
}
// Semantical consistency is not yet checked by Sun, see vmspec2 4.7.5.
// [marked TODO in JustIce]
}
示例3: Clazz
import org.apache.bcel.classfile.InnerClasses; //导入方法依赖的package包/类
/**
* Constructs a <code>Clazz</code> object.
*
* @param classProvider - a helper that provides the class information.
* @param className - a fully qualified name of a class.
* @param verbose - true, if output should be verbose. Otherwise false.
*/
public Clazz(ClassProvider classProvider, String className, boolean verbose)
throws ClassNotFoundException {
wrappedClass = classProvider.getJavaClass(className);
constPool = wrappedClass.getConstantPool();
this.verbose = verbose;
// Assign an empty array by default.
Vector foundInners = new Vector();
// Get the class attributes.
Attribute attrs[] = wrappedClass.getAttributes();
for (int i = 0; i < attrs.length; i++) {
// Find the InnerClasses attribute, if any.
if (attrs[i] instanceof InnerClasses) {
// The InnerClasses attribute is found.
innerClasses = (InnerClasses) attrs[i];
// Get an array of the inner classes.
InnerClass inners[] = innerClasses.getInnerClasses();
for (int j = 0; j < inners.length; j++) {
// Get the inner class name from a constant pool.
String innerClassName = Utility.compactClassName(
innerClasses.getConstantPool().getConstantString(
inners[j].getInnerClassIndex(),
Constants.CONSTANT_Class),
false);
// The inner class has the InnerClasses attribute as well
// as its outer class. So, we should ignore such an inner
// class.
if (!innerClassName.equals(className)) {
foundInners.addElement(innerClassName);
}
}
break;
}
}
// Fill in the inner class array with the found inner classes.
innerClassNames = new String[foundInners.size()];
foundInners.toArray(innerClassNames);
}
示例4: Clazz
import org.apache.bcel.classfile.InnerClasses; //导入方法依赖的package包/类
/**
* Constructs a <code>Clazz</code> object.
*
* @param classProvider - a helper that provides the class information.
* @param className - a fully qualified name of a class.
*/
public Clazz(ClassProvider classProvider, String className)
throws ClassNotFoundException {
wrappedClass = classProvider.getJavaClass(className);
// Assign an empty array by default.
Vector foundInners = new Vector();
// Get the class attributes.
Attribute attrs[] = wrappedClass.getAttributes();
for (int i = 0; i < attrs.length; i++) {
// Find the InnerClasses attribute, if any.
if (attrs[i] instanceof InnerClasses) {
// The InnerClasses attribute is found.
InnerClasses innerAttr = (InnerClasses) attrs[i];
// Get an array of the inner classes.
InnerClass inners[] = innerAttr.getInnerClasses();
for (int j = 0; j < inners.length; j++) {
// Get the inner class name from a constant pool.
String innerClassName = Utility.compactClassName(
innerAttr.getConstantPool().getConstantString(
inners[j].getInnerClassIndex(),
Constants.CONSTANT_Class),
false);
// The inner class has the InnerClasses attribute as well
// as its outer class. So, we should ignore such an inner
// class.
if (!innerClassName.equals(className)) {
foundInners.addElement(innerClassName);
}
}
break;
}
}
// Fill in the inner class array with the found inner classes.
innerClassNames = new String[foundInners.size()];
foundInners.toArray(innerClassNames);
// Collect up fields of the given class and all its ancestors.
fields = new Vector();
JavaClass clss = wrappedClass;
while (true) {
searchForFields(clss);
String superClassName = clss.getSuperclassName();
if (clss.getClassName().equals(superClassName)) {
break;
}
// Retrieve the next super class.
clss = classProvider.getJavaClass(superClassName);
}
// Collect up methods.
methods = new Vector();
searchForMethods(wrappedClass);
}