Example usage for org.objectweb.asm Opcodes ACC_STRICT

List of usage examples for org.objectweb.asm Opcodes ACC_STRICT

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ACC_STRICT.

Prototype

int ACC_STRICT

To view the source code for org.objectweb.asm Opcodes ACC_STRICT.

Click Source Link

Usage

From source file:blue.origami.asm.OAnno.java

License:Apache License

public void add(String spec) {
    String[] annos = spec.split(",");
    for (String s : annos) {
        s = s.toLowerCase();//from   w  w  w. java  2 s  . c  om
        switch (s) {
        case "public":
            acc |= Opcodes.ACC_PUBLIC;
            acc &= ~Opcodes.ACC_PROTECTED;
            acc &= ~Opcodes.ACC_PRIVATE;
            break;
        case "protected":
            acc |= Opcodes.ACC_PROTECTED;
            acc &= ~Opcodes.ACC_PUBLIC;
            acc &= ~Opcodes.ACC_PRIVATE;
            break;
        case "private":
            acc |= Opcodes.ACC_PRIVATE;
            acc &= ~Opcodes.ACC_PUBLIC;
            acc &= ~Opcodes.ACC_PROTECTED;
            break;
        case "static":
            acc |= Opcodes.ACC_STATIC;
            break;
        case "abstract":
            acc |= Opcodes.ACC_ABSTRACT;
            break;
        case "interface":
            acc |= Opcodes.ACC_INTERFACE;
            break;
        case "final":
            acc |= Opcodes.ACC_FINAL;
            break;
        case "native":
            acc |= Opcodes.ACC_NATIVE;
            break;
        case "synchronized":
            acc |= Opcodes.ACC_SYNCHRONIZED;
            break;
        case "strictfp":
            acc |= Opcodes.ACC_STRICT;
            break;
        }
    }
}

From source file:com.facebook.buck.jvm.java.abi.AccessFlags.java

License:Apache License

/** Gets the access flag (see JVMS8 4.1, 4.5, 4.6) corresponding to the given modifier. */
private static int modifierToAccessFlag(Modifier modifier) {
    switch (modifier) {
    case PUBLIC:/*  ww w. j a v a  2s . c om*/
        return Opcodes.ACC_PUBLIC;
    case PROTECTED:
        return Opcodes.ACC_PROTECTED;
    case PRIVATE:
        return Opcodes.ACC_PRIVATE;
    case ABSTRACT:
        return Opcodes.ACC_ABSTRACT;
    case DEFAULT:
        return 0;
    case STATIC:
        return Opcodes.ACC_STATIC;
    case FINAL:
        return Opcodes.ACC_FINAL;
    case TRANSIENT:
        return Opcodes.ACC_TRANSIENT;
    case VOLATILE:
        return Opcodes.ACC_VOLATILE;
    case SYNCHRONIZED:
        return Opcodes.ACC_SYNCHRONIZED;
    case NATIVE:
        return Opcodes.ACC_NATIVE;
    case STRICTFP:
        return Opcodes.ACC_STRICT;
    default:
        throw new IllegalArgumentException(String.format("Unexpected modifier: %s", modifier));
    }
}

From source file:com.facebook.buck.jvm.java.abi.AccessFlagsTest.java

License:Apache License

@Test
public void testFpStrictFlag() throws IOException {
    testMethodFlags("strictfp", Opcodes.ACC_STRICT);
}

From source file:com.gargoylesoftware.js.nashorn.internal.ir.debug.NashornTextifier.java

License:Open Source License

private static void appendAccess(final StringBuilder sb, final int access) {
    if ((access & Opcodes.ACC_PUBLIC) != 0) {
        sb.append("public ");
    }//from  w w  w .ja v a  2 s  . c o m
    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 ");
    }
}

From source file:com.github.jasmo.obfuscate.FullAccessFlags.java

License:Open Source License

private int access(int access) {
    int a = Opcodes.ACC_PUBLIC;
    if ((access & Opcodes.ACC_NATIVE) != 0)
        a |= Opcodes.ACC_NATIVE;/*from  ww w.  ja v a  2 s  . c  o m*/
    if ((access & Opcodes.ACC_ABSTRACT) != 0)
        a |= Opcodes.ACC_ABSTRACT;
    if ((access & Opcodes.ACC_ANNOTATION) != 0)
        a |= Opcodes.ACC_ANNOTATION;
    if ((access & Opcodes.ACC_BRIDGE) != 0)
        a |= Opcodes.ACC_BRIDGE;
    //if ((access & Opcodes.ACC_DEPRECATED) != 0) a |= Opcodes.ACC_DEPRECATED;
    if ((access & Opcodes.ACC_ENUM) != 0)
        a |= Opcodes.ACC_ENUM;
    if ((access & Opcodes.ACC_FINAL) != 0)
        a |= Opcodes.ACC_FINAL;
    if ((access & Opcodes.ACC_INTERFACE) != 0)
        a |= Opcodes.ACC_INTERFACE;
    if ((access & Opcodes.ACC_MANDATED) != 0)
        a |= Opcodes.ACC_MANDATED;
    if ((access & Opcodes.ACC_MODULE) != 0)
        a |= Opcodes.ACC_MODULE;
    if ((access & Opcodes.ACC_OPEN) != 0)
        a |= Opcodes.ACC_OPEN;
    if ((access & Opcodes.ACC_STATIC) != 0)
        a |= Opcodes.ACC_STATIC;
    if ((access & Opcodes.ACC_STATIC_PHASE) != 0)
        a |= Opcodes.ACC_STATIC_PHASE;
    if ((access & Opcodes.ACC_STRICT) != 0)
        a |= Opcodes.ACC_STRICT;
    if ((access & Opcodes.ACC_SUPER) != 0)
        a |= Opcodes.ACC_SUPER;
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0)
        a |= Opcodes.ACC_SYNCHRONIZED;
    if ((access & Opcodes.ACC_SYNTHETIC) != 0)
        a |= Opcodes.ACC_SYNTHETIC;
    if ((access & Opcodes.ACC_TRANSIENT) != 0)
        a |= Opcodes.ACC_TRANSIENT;
    if ((access & Opcodes.ACC_TRANSITIVE) != 0)
        a |= Opcodes.ACC_TRANSITIVE;
    if ((access & Opcodes.ACC_VARARGS) != 0)
        a |= Opcodes.ACC_VARARGS;
    if ((access & Opcodes.ACC_VOLATILE) != 0)
        a |= Opcodes.ACC_VOLATILE;
    return a;
}

From source file:com.googlecode.dex2jar.ir.ToStringUtil.java

License:Apache License

public static String getAccDes(int acc) {
    StringBuilder sb = new StringBuilder();
    if ((acc & Opcodes.ACC_PUBLIC) != 0) {
        sb.append("public ");
    }//from   w ww.jav  a2s  .  c  om
    if ((acc & Opcodes.ACC_PROTECTED) != 0) {
        sb.append("protected ");
    }
    if ((acc & Opcodes.ACC_PRIVATE) != 0) {
        sb.append("private ");
    }
    if ((acc & Opcodes.ACC_STATIC) != 0) {
        sb.append("static ");
    }
    if ((acc & Opcodes.ACC_ABSTRACT) != 0 && (acc & Opcodes.ACC_INTERFACE) == 0) {
        sb.append("abstract ");
    }
    if ((acc & Opcodes.ACC_ANNOTATION) != 0) {
        sb.append("annotation ");
    }
    if ((acc & Opcodes.ACC_BRIDGE) != 0) {
        sb.append("bridge ");
    }
    if ((acc & Opcodes.ACC_DEPRECATED) != 0) {
        sb.append("deprecated ");
    }
    if ((acc & Opcodes.ACC_ENUM) != 0) {
        sb.append("enum ");
    }
    if ((acc & Opcodes.ACC_FINAL) != 0) {
        sb.append("final ");
    }
    if ((acc & Opcodes.ACC_INTERFACE) != 0) {
        sb.append("interace ");
    }
    if ((acc & Opcodes.ACC_NATIVE) != 0) {
        sb.append("native ");
    }
    if ((acc & Opcodes.ACC_STRICT) != 0) {
        sb.append("strict ");
    }
    if ((acc & Opcodes.ACC_SYNCHRONIZED) != 0) {
        sb.append("synchronized ");
    }
    if ((acc & Opcodes.ACC_TRANSIENT) != 0) {
        sb.append("transient ");
    }
    if ((acc & Opcodes.ACC_VARARGS) != 0) {
        sb.append("varargs ");
    }
    if ((acc & Opcodes.ACC_VOLATILE) != 0) {
        sb.append("volatile ");
    }
    return sb.toString();
}

From source file:com.googlecode.dex2jar.tools.JarAccessCmd.java

License:Apache License

static int str2acc(String s) {
    if (s == null) {
        return 0;
    }/*from   w ww  . ja v  a 2 s .c om*/
    int result = 0;
    s = s.toLowerCase();
    if (s.contains("public")) {
        result |= Opcodes.ACC_PUBLIC;
    }
    if (s.contains("private")) {
        result |= Opcodes.ACC_PRIVATE;
    }
    if (s.contains("protected")) {
        result |= Opcodes.ACC_PROTECTED;
    }
    if (s.contains("final")) {
        result |= Opcodes.ACC_FINAL;
    }
    if (s.contains("static")) {
        result |= Opcodes.ACC_STATIC;
    }
    if (s.contains("super")) {
        result |= Opcodes.ACC_SUPER;
    }
    if (s.contains("synchronized")) {
        result |= Opcodes.ACC_SYNCHRONIZED;
    }
    if (s.contains("volatile")) {
        result |= Opcodes.ACC_VOLATILE;
    }
    if (s.contains("bridge")) {
        result |= Opcodes.ACC_BRIDGE;
    }
    if (s.contains("transient")) {
        result |= Opcodes.ACC_TRANSIENT;
    }
    if (s.contains("varargs")) {
        result |= Opcodes.ACC_VARARGS;
    }
    if (s.contains("native")) {
        result |= Opcodes.ACC_NATIVE;
    }
    if (s.contains("strict")) {
        result |= Opcodes.ACC_STRICT;
    }
    if (s.contains("interface")) {
        result |= Opcodes.ACC_INTERFACE;
    }
    if (s.contains("abstract")) {
        result |= Opcodes.ACC_ABSTRACT;
    }
    if (s.contains("synthetic")) {
        result |= Opcodes.ACC_SYNTHETIC;
    }
    if (s.contains("annotation")) {
        result |= Opcodes.ACC_ANNOTATION;
    }
    if (s.contains("enum")) {
        result |= Opcodes.ACC_ENUM;
    }
    if (s.contains("deprecated")) {
        result |= Opcodes.ACC_DEPRECATED;
    }
    return result;
}

From source file:com.poolik.classfinder.info.ClassInfo.java

License:BSD License

/**
 * Convert an ASM access mask to a reflection Modifier mask.
 *
 * @param asmAccessMask the ASM access mask
 * @return the Modifier mask//from   w w w .  ja v  a2  s .c  o m
 */
private int convertAccessMaskToModifierMask(int asmAccessMask) {
    int modifier = 0;

    // Convert the ASM access info into Reflection API modifiers.

    if ((asmAccessMask & Opcodes.ACC_FINAL) != 0)
        modifier |= Modifier.FINAL;

    if ((asmAccessMask & Opcodes.ACC_NATIVE) != 0)
        modifier |= Modifier.NATIVE;

    if ((asmAccessMask & Opcodes.ACC_INTERFACE) != 0)
        modifier |= Modifier.INTERFACE;

    if ((asmAccessMask & Opcodes.ACC_ABSTRACT) != 0)
        modifier |= Modifier.ABSTRACT;

    if ((asmAccessMask & Opcodes.ACC_PRIVATE) != 0)
        modifier |= Modifier.PRIVATE;

    if ((asmAccessMask & Opcodes.ACC_PROTECTED) != 0)
        modifier |= Modifier.PROTECTED;

    if ((asmAccessMask & Opcodes.ACC_PUBLIC) != 0)
        modifier |= Modifier.PUBLIC;

    if ((asmAccessMask & Opcodes.ACC_STATIC) != 0)
        modifier |= Modifier.STATIC;

    if ((asmAccessMask & Opcodes.ACC_STRICT) != 0)
        modifier |= Modifier.STRICT;

    if ((asmAccessMask & Opcodes.ACC_SYNCHRONIZED) != 0)
        modifier |= Modifier.SYNCHRONIZED;

    if ((asmAccessMask & Opcodes.ACC_TRANSIENT) != 0)
        modifier |= Modifier.TRANSIENT;

    if ((asmAccessMask & Opcodes.ACC_VOLATILE) != 0)
        modifier |= Modifier.VOLATILE;

    return modifier;
}

From source file:graph.Modifier.java

License:Apache License

/**
 * Returns an EnumSet of the modifiers, based on the given bit field (where
 * the bit values are defined as in the class file format).
 *
 * @param access Integer bit field giving access modifiers.
 * @return       Set of modifiers./*from  w w w. ja  v  a 2s .  c  om*/
 */
public static EnumSet<Modifier> getSet(int access) {
    EnumSet<Modifier> modifiers = EnumSet.noneOf(Modifier.class);

    if ((access & Opcodes.ACC_PUBLIC) != 0) {
        modifiers.add(Modifier.PUBLIC);
    }

    if ((access & Opcodes.ACC_PROTECTED) != 0) {
        modifiers.add(Modifier.PROTECTED);
    }

    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        modifiers.add(Modifier.PRIVATE);
    }

    if ((access & Opcodes.ACC_STATIC) != 0) {
        modifiers.add(Modifier.STATIC);
    }

    if ((access & Opcodes.ACC_FINAL) != 0) {
        modifiers.add(Modifier.FINAL);
    }

    if ((access & Opcodes.ACC_SUPER) != 0) {
        modifiers.add(Modifier.SUPER);
    }

    if ((access & Opcodes.ACC_INTERFACE) != 0) {
        modifiers.add(Modifier.INTERFACE);
    }

    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        modifiers.add(Modifier.ABSTRACT);
    }

    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        modifiers.add(Modifier.SYNTHETIC);
    }

    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
        modifiers.add(Modifier.ANNOTATION);
    }

    if ((access & Opcodes.ACC_ENUM) != 0) {
        modifiers.add(Modifier.ENUM);
    }

    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        modifiers.add(Modifier.VOLATILE);
    }

    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        modifiers.add(Modifier.TRANSIENT);
    }

    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        modifiers.add(Modifier.SYNCHRONIZED);
    }

    if ((access & Opcodes.ACC_BRIDGE) != 0) {
        modifiers.add(Modifier.BRIDGE);
    }

    if ((access & Opcodes.ACC_VARARGS) != 0) {
        modifiers.add(Modifier.VARARGS);
    }

    if ((access & Opcodes.ACC_NATIVE) != 0) {
        modifiers.add(Modifier.NATIVE);
    }

    if ((access & Opcodes.ACC_STRICT) != 0) {
        modifiers.add(Modifier.STRICT);
    }

    return modifiers;
}

From source file:org.adjective.stout.writer.ByteCodeWriter.java

License:Apache License

private int getModifierCode(Set<ElementModifier> modifiers, MemberType type) {
    int code = getModifierCode(modifiers, (Sort) null);
    int illegal = Opcodes.ACC_ANNOTATION | Opcodes.ACC_BRIDGE | Opcodes.ACC_ENUM | Opcodes.ACC_INTERFACE
            | Opcodes.ACC_SUPER;/*w w  w .ja  v a2 s  .c  om*/
    switch (type) {
    case FIELD:
        illegal |= Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE | Opcodes.ACC_STRICT | Opcodes.ACC_SYNCHRONIZED;
        break;
    case METHOD:
        if (isBitSet(Opcodes.ACC_ABSTRACT, code)) {
            illegal |= Opcodes.ACC_NATIVE | Opcodes.ACC_STRICT | Opcodes.ACC_SYNCHRONIZED | Opcodes.ACC_STATIC
                    | Opcodes.ACC_FINAL;
        }
        break;
    }
    if (isBitSet(illegal, code)) {
        throw new IllegalStateException(
                "Illegal combination of modifier codes: " + code + " (illegal codes: " + illegal + ")");
    }
    return code;
}