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


Java InnerClasses.getInnerClasses方法代码示例

本文整理汇总了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);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:8,代码来源:PreorderVisitor.java

示例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]
		}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:33,代码来源:Pass2Verifier.java

示例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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:49,代码来源:Clazz.java

示例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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:63,代码来源:Clazz.java


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