Java Code Examples for com.sun.tools.classfile.AccessFlags#ignore()

The following examples show how to use com.sun.tools.classfile.AccessFlags#ignore() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AttributeWriter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
    boolean first = true;
    if (options.compat) {
        writeInnerClassHeader();
        first = false;
    }
    for (int i = 0 ; i < attr.classes.length; i++) {
        InnerClasses_attribute.Info info = attr.classes[i];
        //access
        AccessFlags access_flags = info.inner_class_access_flags;
        if (options.compat) {
            // BUG 6622215: javap ignores certain relevant access flags
            access_flags = access_flags.ignore(ACC_STATIC | ACC_PROTECTED | ACC_PRIVATE | ACC_INTERFACE | ACC_SYNTHETIC | ACC_ENUM);
            // BUG 6622232: javap gets whitespace confused
            print("   ");
        }
        if (options.checkAccess(access_flags)) {
            if (first) {
                writeInnerClassHeader();
                first = false;
            }
            print("   ");
            for (String name: access_flags.getInnerClassModifiers())
                print(name + " ");
            if (info.inner_name_index!=0) {
                print("#" + info.inner_name_index + "= ");
            }
            print("#" + info.inner_class_info_index);
            if (info.outer_class_info_index != 0) {
                print(" of #" + info.outer_class_info_index);
            }
            print("; //");
            if (info.inner_name_index != 0) {
                print(getInnerName(constant_pool, info) + "=");
            }
            constantWriter.write(info.inner_class_info_index);
            if (info.outer_class_info_index != 0) {
                print(" of ");
                constantWriter.write(info.outer_class_info_index);
            }
            println();
        }
    }
    if (!first)
        indent(-1);
    return null;
}
 
Example 2
Source File: AttributeWriter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
    boolean first = true;
    if (options.compat) {
        writeInnerClassHeader();
        first = false;
    }
    for (int i = 0 ; i < attr.classes.length; i++) {
        InnerClasses_attribute.Info info = attr.classes[i];
        //access
        AccessFlags access_flags = info.inner_class_access_flags;
        if (options.compat) {
            // BUG 6622215: javap ignores certain relevant access flags
            access_flags = access_flags.ignore(ACC_STATIC | ACC_PROTECTED | ACC_PRIVATE | ACC_INTERFACE | ACC_SYNTHETIC | ACC_ENUM);
            // BUG 6622232: javap gets whitespace confused
            print("   ");
        }
        if (options.checkAccess(access_flags)) {
            if (first) {
                writeInnerClassHeader();
                first = false;
            }
            print("   ");
            for (String name: access_flags.getInnerClassModifiers())
                print(name + " ");
            if (info.inner_name_index!=0) {
                print("#" + info.inner_name_index + "= ");
            }
            print("#" + info.inner_class_info_index);
            if (info.outer_class_info_index != 0) {
                print(" of #" + info.outer_class_info_index);
            }
            print("; //");
            if (info.inner_name_index != 0) {
                print(getInnerName(constant_pool, info) + "=");
            }
            constantWriter.write(info.inner_class_info_index);
            if (info.outer_class_info_index != 0) {
                print(" of ");
                constantWriter.write(info.outer_class_info_index);
            }
            println();
        }
    }
    if (!first)
        indent(-1);
    return null;
}