Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#ACC_ABSTRACT

The following examples show how to use jdk.internal.org.objectweb.asm.Opcodes#ACC_ABSTRACT . 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: CheckClassAdapter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the given access flags do not contain invalid flags. This
 * method also checks that mutually incompatible flags are not set
 * simultaneously.
 *
 * @param access
 *            the access flags to be checked
 * @param possibleAccess
 *            the valid access flags.
 */
static void checkAccess(final int access, final int possibleAccess) {
    if ((access & ~possibleAccess) != 0) {
        throw new IllegalArgumentException("Invalid access flags: "
                + access);
    }
    int pub = (access & Opcodes.ACC_PUBLIC) == 0 ? 0 : 1;
    int pri = (access & Opcodes.ACC_PRIVATE) == 0 ? 0 : 1;
    int pro = (access & Opcodes.ACC_PROTECTED) == 0 ? 0 : 1;
    if (pub + pri + pro > 1) {
        throw new IllegalArgumentException(
                "public private and protected are mutually exclusive: "
                        + access);
    }
    int fin = (access & Opcodes.ACC_FINAL) == 0 ? 0 : 1;
    int abs = (access & Opcodes.ACC_ABSTRACT) == 0 ? 0 : 1;
    if (fin + abs > 1) {
        throw new IllegalArgumentException(
                "final and abstract are mutually exclusive: " + access);
    }
}
 
Example 2
Source File: MethodNode.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
  * Constructs a new {@link MethodNode}.
  *
  * @param api the ASM API version implemented by this visitor. Must be one of {@link
  *     Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
  * @param access the method's access flags (see {@link Opcodes}). This parameter also indicates if
  *     the method is synthetic and/or deprecated.
  * @param name the method's name.
  * @param descriptor the method's descriptor (see {@link Type}).
  * @param signature the method's signature. May be {@literal null}.
  * @param exceptions the internal names of the method's exception classes (see {@link
  *     Type#getInternalName()}). May be {@literal null}.
  */
public MethodNode(
        final int api,
        final int access,
        final String name,
        final String descriptor,
        final String signature,
        final String[] exceptions) {
    super(api);
    this.access = access;
    this.name = name;
    this.desc = descriptor;
    this.signature = signature;
    this.exceptions = Util.asArrayList(exceptions);
    if ((access & Opcodes.ACC_ABSTRACT) == 0) {
        this.localVariables = new ArrayList<LocalVariableNode>(5);
    }
    this.tryCatchBlocks = new ArrayList<TryCatchBlockNode>();
    this.instructions = new InsnList();
}
 
Example 3
Source File: CheckClassAdapter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the given access flags do not contain invalid flags. This
 * method also checks that mutually incompatible flags are not set
 * simultaneously.
 *
 * @param access
 *            the access flags to be checked
 * @param possibleAccess
 *            the valid access flags.
 */
static void checkAccess(final int access, final int possibleAccess) {
    if ((access & ~possibleAccess) != 0) {
        throw new IllegalArgumentException("Invalid access flags: "
                + access);
    }
    int pub = (access & Opcodes.ACC_PUBLIC) == 0 ? 0 : 1;
    int pri = (access & Opcodes.ACC_PRIVATE) == 0 ? 0 : 1;
    int pro = (access & Opcodes.ACC_PROTECTED) == 0 ? 0 : 1;
    if (pub + pri + pro > 1) {
        throw new IllegalArgumentException(
                "public private and protected are mutually exclusive: "
                        + access);
    }
    int fin = (access & Opcodes.ACC_FINAL) == 0 ? 0 : 1;
    int abs = (access & Opcodes.ACC_ABSTRACT) == 0 ? 0 : 1;
    if (fin + abs > 1) {
        throw new IllegalArgumentException(
                "final and abstract are mutually exclusive: " + access);
    }
}
 
Example 4
Source File: CheckClassAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the given access flags do not contain invalid flags. This
 * method also checks that mutually incompatible flags are not set
 * simultaneously.
 *
 * @param access
 *            the access flags to be checked
 * @param possibleAccess
 *            the valid access flags.
 */
static void checkAccess(final int access, final int possibleAccess) {
    if ((access & ~possibleAccess) != 0) {
        throw new IllegalArgumentException("Invalid access flags: "
                + access);
    }
    int pub = (access & Opcodes.ACC_PUBLIC) == 0 ? 0 : 1;
    int pri = (access & Opcodes.ACC_PRIVATE) == 0 ? 0 : 1;
    int pro = (access & Opcodes.ACC_PROTECTED) == 0 ? 0 : 1;
    if (pub + pri + pro > 1) {
        throw new IllegalArgumentException(
                "public private and protected are mutually exclusive: "
                        + access);
    }
    int fin = (access & Opcodes.ACC_FINAL) == 0 ? 0 : 1;
    int abs = (access & Opcodes.ACC_ABSTRACT) == 0 ? 0 : 1;
    if (fin + abs > 1) {
        throw new IllegalArgumentException(
                "final and abstract are mutually exclusive: " + access);
    }
}
 
Example 5
Source File: CheckMethodAdapter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void visitCode() {
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        throw new RuntimeException("Abstract methods cannot have code");
    }
    startCode = true;
    super.visitCode();
}
 
Example 6
Source File: SerialVersionUIDAdder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public MethodVisitor visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    if (computeSVUID) {
        if ("<clinit>".equals(name)) {
            hasStaticInitializer = true;
        }
        /*
         * Remembers non private constructors and methods for SVUID
         * computation For constructor and method modifiers, only the
         * ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
         * ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT and ACC_STRICT flags
         * are used.
         */
        int mods = access
                & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
                        | Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
                        | Opcodes.ACC_FINAL | Opcodes.ACC_SYNCHRONIZED
                        | Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STRICT);

        // all non private methods
        if ((access & Opcodes.ACC_PRIVATE) == 0) {
            if ("<init>".equals(name)) {
                svuidConstructors.add(new Item(name, mods, desc));
            } else if (!"<clinit>".equals(name)) {
                svuidMethods.add(new Item(name, mods, desc));
            }
        }
    }

    return super.visitMethod(access, name, desc, signature, exceptions);
}
 
Example 7
Source File: CheckMethodAdapter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void visitCode() {
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        throw new RuntimeException("Abstract methods cannot have code");
    }
    startCode = true;
    super.visitCode();
}
 
Example 8
Source File: SerialVersionUIDAdder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public MethodVisitor visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    if (computeSVUID) {
        if ("<clinit>".equals(name)) {
            hasStaticInitializer = true;
        }
        /*
         * Remembers non private constructors and methods for SVUID
         * computation For constructor and method modifiers, only the
         * ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
         * ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT and ACC_STRICT flags
         * are used.
         */
        int mods = access
                & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
                        | Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
                        | Opcodes.ACC_FINAL | Opcodes.ACC_SYNCHRONIZED
                        | Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STRICT);

        // all non private methods
        if ((access & Opcodes.ACC_PRIVATE) == 0) {
            if ("<init>".equals(name)) {
                svuidConstructors.add(new Item(name, mods, desc));
            } else if (!"<clinit>".equals(name)) {
                svuidMethods.add(new Item(name, mods, desc));
            }
        }
    }

    return super.visitMethod(access, name, desc, signature, exceptions);
}
 
Example 9
Source File: CheckMethodAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void visitCode() {
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        throw new RuntimeException("Abstract methods cannot have code");
    }
    startCode = true;
    super.visitCode();
}
 
Example 10
Source File: SerialVersionUIDAdder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public MethodVisitor visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    if (computeSVUID) {
        if ("<clinit>".equals(name)) {
            hasStaticInitializer = true;
        }
        /*
         * Remembers non private constructors and methods for SVUID
         * computation For constructor and method modifiers, only the
         * ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
         * ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT and ACC_STRICT flags
         * are used.
         */
        int mods = access
                & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
                        | Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
                        | Opcodes.ACC_FINAL | Opcodes.ACC_SYNCHRONIZED
                        | Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STRICT);

        // all non private methods
        if ((access & Opcodes.ACC_PRIVATE) == 0) {
            if ("<init>".equals(name)) {
                svuidConstructors.add(new Item(name, mods, desc));
            } else if (!"<clinit>".equals(name)) {
                svuidMethods.add(new Item(name, mods, desc));
            }
        }
    }

    return super.visitMethod(access, name, desc, signature, exceptions);
}
 
Example 11
Source File: MethodNode.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a new {@link MethodNode}.
 *
 * @param api
 *            the ASM API version implemented by this visitor. Must be one
 *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 * @param access
 *            the method's access flags (see {@link Opcodes}). This
 *            parameter also indicates if the method is synthetic and/or
 *            deprecated.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type}).
 * @param signature
 *            the method's signature. May be <tt>null</tt>.
 * @param exceptions
 *            the internal names of the method's exception classes (see
 *            {@link Type#getInternalName() getInternalName}). May be
 *            <tt>null</tt>.
 */
public MethodNode(final int api, final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    super(api);
    this.access = access;
    this.name = name;
    this.desc = desc;
    this.signature = signature;
    this.exceptions = new ArrayList<String>(exceptions == null ? 0
            : exceptions.length);
    boolean isAbstract = (access & Opcodes.ACC_ABSTRACT) != 0;
    if (!isAbstract) {
        this.localVariables = new ArrayList<LocalVariableNode>(5);
    }
    this.tryCatchBlocks = new ArrayList<TryCatchBlockNode>();
    if (exceptions != null) {
        this.exceptions.addAll(Arrays.asList(exceptions));
    }
    this.instructions = new InsnList();
}
 
Example 12
Source File: Textifier.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends a string representation of the given access modifiers to
 * {@link #buf buf}.
 *
 * @param access
 *            some access modifiers.
 */
private void appendAccess(final int access) {
    if ((access & Opcodes.ACC_PUBLIC) != 0) {
        buf.append("public ");
    }
    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        buf.append("private ");
    }
    if ((access & Opcodes.ACC_PROTECTED) != 0) {
        buf.append("protected ");
    }
    if ((access & Opcodes.ACC_FINAL) != 0) {
        buf.append("final ");
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        buf.append("static ");
    }
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        buf.append("synchronized ");
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        buf.append("volatile ");
    }
    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        buf.append("transient ");
    }
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        buf.append("abstract ");
    }
    if ((access & Opcodes.ACC_STRICT) != 0) {
        buf.append("strictfp ");
    }
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        buf.append("synthetic ");
    }
    if ((access & Opcodes.ACC_MANDATED) != 0) {
        buf.append("mandated ");
    }
    if ((access & Opcodes.ACC_ENUM) != 0) {
        buf.append("enum ");
    }
}
 
Example 13
Source File: NashornTextifier.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static void appendAccess(final StringBuilder sb, final int access) {
    if ((access & Opcodes.ACC_PUBLIC) != 0) {
        sb.append("public ");
    }
    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        sb.append("private ");
    }
    if ((access & Opcodes.ACC_PROTECTED) != 0) {
        sb.append("protected ");
    }
    if ((access & Opcodes.ACC_FINAL) != 0) {
        sb.append("final ");
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        sb.append("static ");
    }
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        sb.append("synchronized ");
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        sb.append("volatile ");
    }
    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        sb.append("transient ");
    }
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        sb.append("abstract ");
    }
    if ((access & Opcodes.ACC_STRICT) != 0) {
        sb.append("strictfp ");
    }
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        sb.append("synthetic ");
    }
    if ((access & Opcodes.ACC_MANDATED) != 0) {
        sb.append("mandated ");
    }
    if ((access & Opcodes.ACC_ENUM) != 0) {
        sb.append("enum ");
    }
}
 
Example 14
Source File: Textifier.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends a string representation of the given access modifiers to
 * {@link #buf buf}.
 *
 * @param access
 *            some access modifiers.
 */
private void appendAccess(final int access) {
    if ((access & Opcodes.ACC_PUBLIC) != 0) {
        buf.append("public ");
    }
    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        buf.append("private ");
    }
    if ((access & Opcodes.ACC_PROTECTED) != 0) {
        buf.append("protected ");
    }
    if ((access & Opcodes.ACC_FINAL) != 0) {
        buf.append("final ");
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        buf.append("static ");
    }
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        buf.append("synchronized ");
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        buf.append("volatile ");
    }
    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        buf.append("transient ");
    }
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        buf.append("abstract ");
    }
    if ((access & Opcodes.ACC_STRICT) != 0) {
        buf.append("strictfp ");
    }
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        buf.append("synthetic ");
    }
    if ((access & Opcodes.ACC_MANDATED) != 0) {
        buf.append("mandated ");
    }
    if ((access & Opcodes.ACC_ENUM) != 0) {
        buf.append("enum ");
    }
}
 
Example 15
Source File: Textifier.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Textifier visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    buf.setLength(0);
    buf.append('\n');
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append(tab).append("// DEPRECATED\n");
    }
    buf.append(tab).append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');

    if (signature != null) {
        buf.append(tab);
        appendDescriptor(METHOD_SIGNATURE, signature);

        TraceSignatureVisitor v = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.accept(v);
        String genericDecl = v.getDeclaration();
        String genericReturn = v.getReturnType();
        String genericExceptions = v.getExceptions();

        buf.append(tab).append("// declaration: ").append(genericReturn)
                .append(' ').append(name).append(genericDecl);
        if (genericExceptions != null) {
            buf.append(" throws ").append(genericExceptions);
        }
        buf.append('\n');
    }

    buf.append(tab);
    appendAccess(access & ~Opcodes.ACC_VOLATILE);
    if ((access & Opcodes.ACC_NATIVE) != 0) {
        buf.append("native ");
    }
    if ((access & Opcodes.ACC_VARARGS) != 0) {
        buf.append("varargs ");
    }
    if ((access & Opcodes.ACC_BRIDGE) != 0) {
        buf.append("bridge ");
    }
    if ((this.access & Opcodes.ACC_INTERFACE) != 0
            && (access & Opcodes.ACC_ABSTRACT) == 0
            && (access & Opcodes.ACC_STATIC) == 0) {
        buf.append("default ");
    }

    buf.append(name);
    appendDescriptor(METHOD_DESCRIPTOR, desc);
    if (exceptions != null && exceptions.length > 0) {
        buf.append(" throws ");
        for (int i = 0; i < exceptions.length; ++i) {
            appendDescriptor(INTERNAL_NAME, exceptions[i]);
            buf.append(' ');
        }
    }

    buf.append('\n');
    text.add(buf.toString());

    Textifier t = createTextifier();
    text.add(t.getText());
    return t;
}
 
Example 16
Source File: Textifier.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends a string representation of the given access modifiers to
 * {@link #buf buf}.
 *
 * @param access
 *            some access modifiers.
 */
private void appendAccess(final int access) {
    if ((access & Opcodes.ACC_PUBLIC) != 0) {
        buf.append("public ");
    }
    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        buf.append("private ");
    }
    if ((access & Opcodes.ACC_PROTECTED) != 0) {
        buf.append("protected ");
    }
    if ((access & Opcodes.ACC_FINAL) != 0) {
        buf.append("final ");
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        buf.append("static ");
    }
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        buf.append("synchronized ");
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        buf.append("volatile ");
    }
    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        buf.append("transient ");
    }
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        buf.append("abstract ");
    }
    if ((access & Opcodes.ACC_STRICT) != 0) {
        buf.append("strictfp ");
    }
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        buf.append("synthetic ");
    }
    if ((access & Opcodes.ACC_MANDATED) != 0) {
        buf.append("mandated ");
    }
    if ((access & Opcodes.ACC_ENUM) != 0) {
        buf.append("enum ");
    }
}
 
Example 17
Source File: Textifier.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Textifier visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    buf.setLength(0);
    buf.append('\n');
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append(tab).append("// DEPRECATED\n");
    }
    buf.append(tab).append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');

    if (signature != null) {
        buf.append(tab);
        appendDescriptor(METHOD_SIGNATURE, signature);

        TraceSignatureVisitor v = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.accept(v);
        String genericDecl = v.getDeclaration();
        String genericReturn = v.getReturnType();
        String genericExceptions = v.getExceptions();

        buf.append(tab).append("// declaration: ").append(genericReturn)
                .append(' ').append(name).append(genericDecl);
        if (genericExceptions != null) {
            buf.append(" throws ").append(genericExceptions);
        }
        buf.append('\n');
    }

    buf.append(tab);
    appendAccess(access & ~Opcodes.ACC_VOLATILE);
    if ((access & Opcodes.ACC_NATIVE) != 0) {
        buf.append("native ");
    }
    if ((access & Opcodes.ACC_VARARGS) != 0) {
        buf.append("varargs ");
    }
    if ((access & Opcodes.ACC_BRIDGE) != 0) {
        buf.append("bridge ");
    }
    if ((this.access & Opcodes.ACC_INTERFACE) != 0
            && (access & Opcodes.ACC_ABSTRACT) == 0
            && (access & Opcodes.ACC_STATIC) == 0) {
        buf.append("default ");
    }

    buf.append(name);
    appendDescriptor(METHOD_DESCRIPTOR, desc);
    if (exceptions != null && exceptions.length > 0) {
        buf.append(" throws ");
        for (int i = 0; i < exceptions.length; ++i) {
            appendDescriptor(INTERNAL_NAME, exceptions[i]);
            buf.append(' ');
        }
    }

    buf.append('\n');
    text.add(buf.toString());

    Textifier t = createTextifier();
    text.add(t.getText());
    return t;
}
 
Example 18
Source File: Textifier.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
  * Appends a string representation of the given access flags to {@link #stringBuilder}.
  *
  * @param accessFlags some access flags.
  */
private void appendAccess(final int accessFlags) {
    if ((accessFlags & Opcodes.ACC_PUBLIC) != 0) {
        stringBuilder.append("public ");
    }
    if ((accessFlags & Opcodes.ACC_PRIVATE) != 0) {
        stringBuilder.append("private ");
    }
    if ((accessFlags & Opcodes.ACC_PROTECTED) != 0) {
        stringBuilder.append("protected ");
    }
    if ((accessFlags & Opcodes.ACC_FINAL) != 0) {
        stringBuilder.append("final ");
    }
    if ((accessFlags & Opcodes.ACC_STATIC) != 0) {
        stringBuilder.append("static ");
    }
    if ((accessFlags & Opcodes.ACC_SYNCHRONIZED) != 0) {
        stringBuilder.append("synchronized ");
    }
    if ((accessFlags & Opcodes.ACC_VOLATILE) != 0) {
        stringBuilder.append("volatile ");
    }
    if ((accessFlags & Opcodes.ACC_TRANSIENT) != 0) {
        stringBuilder.append("transient ");
    }
    if ((accessFlags & Opcodes.ACC_ABSTRACT) != 0) {
        stringBuilder.append("abstract ");
    }
    if ((accessFlags & Opcodes.ACC_STRICT) != 0) {
        stringBuilder.append("strictfp ");
    }
    if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0) {
        stringBuilder.append("synthetic ");
    }
    if ((accessFlags & Opcodes.ACC_MANDATED) != 0) {
        stringBuilder.append("mandated ");
    }
    if ((accessFlags & Opcodes.ACC_ENUM) != 0) {
        stringBuilder.append("enum ");
    }
}
 
Example 19
Source File: MethodNode.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a new {@link MethodNode}.
 *
 * @param api
 *            the ASM API version implemented by this visitor. Must be one
 *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 * @param access
 *            the method's access flags (see {@link Opcodes}). This
 *            parameter also indicates if the method is synthetic and/or
 *            deprecated.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type}).
 * @param signature
 *            the method's signature. May be <tt>null</tt>.
 * @param exceptions
 *            the internal names of the method's exception classes (see
 *            {@link Type#getInternalName() getInternalName}). May be
 *            <tt>null</tt>.
 */
public MethodNode(final int api, final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    super(api);
    this.access = access;
    this.name = name;
    this.desc = desc;
    this.signature = signature;
    this.exceptions = new ArrayList<String>(exceptions == null ? 0
            : exceptions.length);
    boolean isAbstract = (access & Opcodes.ACC_ABSTRACT) != 0;
    if (!isAbstract) {
        this.localVariables = new ArrayList<LocalVariableNode>(5);
    }
    this.tryCatchBlocks = new ArrayList<TryCatchBlockNode>();
    if (exceptions != null) {
        this.exceptions.addAll(Arrays.asList(exceptions));
    }
    this.instructions = new InsnList();
}
 
Example 20
Source File: Textifier.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends a string representation of the given access modifiers to
 * {@link #buf buf}.
 *
 * @param access
 *            some access modifiers.
 */
private void appendAccess(final int access) {
    if ((access & Opcodes.ACC_PUBLIC) != 0) {
        buf.append("public ");
    }
    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        buf.append("private ");
    }
    if ((access & Opcodes.ACC_PROTECTED) != 0) {
        buf.append("protected ");
    }
    if ((access & Opcodes.ACC_FINAL) != 0) {
        buf.append("final ");
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        buf.append("static ");
    }
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        buf.append("synchronized ");
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        buf.append("volatile ");
    }
    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        buf.append("transient ");
    }
    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        buf.append("abstract ");
    }
    if ((access & Opcodes.ACC_STRICT) != 0) {
        buf.append("strictfp ");
    }
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        buf.append("synthetic ");
    }
    if ((access & Opcodes.ACC_MANDATED) != 0) {
        buf.append("mandated ");
    }
    if ((access & Opcodes.ACC_ENUM) != 0) {
        buf.append("enum ");
    }
}