Example usage for org.objectweb.asm Opcodes ACC_STATIC

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

Introduction

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

Prototype

int ACC_STATIC

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

Click Source Link

Usage

From source file:org.springframework.migrationanalyzer.contributions.bytecode.AsmUtilsTests.java

License:Apache License

@Test
public void staticAccess() {
    assertEquals("static", AsmUtils.modifiersToString(Opcodes.ACC_STATIC));
}

From source file:org.springframework.migrationanalyzer.contributions.bytecode.AsmUtilsTests.java

License:Apache License

@Test
public void classAccessOrdering() {
    assertEquals("public protected private abstract static final strictfp",
            AsmUtils.modifiersToString(Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE
                    | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_STRICT));
}

From source file:org.springframework.migrationanalyzer.contributions.bytecode.AsmUtilsTests.java

License:Apache License

@Test
public void fieldAccessOrdering() {
    assertEquals("public protected private static final transient volatile",
            AsmUtils.modifiersToString(Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE
                    | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_TRANSIENT | Opcodes.ACC_VOLATILE));
}

From source file:org.springframework.migrationanalyzer.contributions.bytecode.AsmUtilsTests.java

License:Apache License

@Test
public void methodAccessOrdering() {
    assertEquals("public protected private abstract static final synchronized native strictfp",
            AsmUtils.modifiersToString(Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE
                    | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNCHRONIZED
                    | Opcodes.ACC_NATIVE | Opcodes.ACC_STRICT));
}

From source file:org.springsource.loaded.test.infra.ClassPrinter.java

License:Apache License

private String toAccessForClass(int flags) {
    StringBuilder sb = new StringBuilder();
    if ((flags & Opcodes.ACC_PUBLIC) != 0) {
        sb.append("public ");
    }//www .  j a v  a 2  s. c om
    if ((flags & Opcodes.ACC_PRIVATE) != 0) {
        sb.append("private ");
    }
    if ((flags & Opcodes.ACC_PROTECTED) != 0) {
        sb.append("protected ");
    }
    if ((flags & Opcodes.ACC_STATIC) != 0) {
        sb.append("static ");
    }
    if ((flags & Opcodes.ACC_FINAL) != 0) {
        sb.append("final ");
    }
    if ((flags & Opcodes.ACC_SYNCHRONIZED) != 0) {
        sb.append("synchronized ");
    }
    if ((flags & Opcodes.ACC_BRIDGE) != 0) {
        sb.append("bridge ");
    }
    if ((flags & Opcodes.ACC_VARARGS) != 0) {
        sb.append("varargs ");
    }
    if ((flags & Opcodes.ACC_NATIVE) != 0) {
        sb.append("native ");
    }
    if ((flags & Opcodes.ACC_ABSTRACT) != 0) {
        sb.append("abstract ");
    }
    if ((flags & Opcodes.ACC_SYNTHETIC) != 0) {
        sb.append("synthetic ");
    }
    if ((flags & Opcodes.ACC_DEPRECATED) != 0) {
        sb.append("deprecated ");
    }
    if ((flags & Opcodes.ACC_INTERFACE) != 0) {
        sb.append("interface ");
    }
    return sb.toString().trim();
}

From source file:org.springsource.loaded.test.infra.ClassPrinter.java

License:Apache License

public static String toAccessForMember(int flags) {
    StringBuilder sb = new StringBuilder();
    if ((flags & Opcodes.ACC_PUBLIC) != 0) {
        sb.append("public ");
    }//  w w w. jav a  2 s . c o m
    if ((flags & Opcodes.ACC_PRIVATE) != 0) {
        sb.append("private ");
    }
    if ((flags & Opcodes.ACC_STATIC) != 0) {
        sb.append("static ");
    }
    if ((flags & Opcodes.ACC_PROTECTED) != 0) {
        sb.append("protected ");
    }
    if ((flags & Opcodes.ACC_FINAL) != 0) {
        sb.append("final ");
    }
    if ((flags & Opcodes.ACC_SUPER) != 0) {
        sb.append("super ");
    }
    if ((flags & Opcodes.ACC_INTERFACE) != 0) {
        sb.append("interface ");
    }
    if ((flags & Opcodes.ACC_ABSTRACT) != 0) {
        sb.append("abstract ");
    }
    if ((flags & Opcodes.ACC_SYNTHETIC) != 0) {
        sb.append("synthetic ");
    }
    if ((flags & Opcodes.ACC_ANNOTATION) != 0) {
        sb.append("annotation ");
    }
    if ((flags & Opcodes.ACC_ENUM) != 0) {
        sb.append("enum ");
    }
    if ((flags & Opcodes.ACC_DEPRECATED) != 0) {
        sb.append("deprecated ");
    }
    return sb.toString().trim();
}

From source file:org.summer.aop.PointcutExpressionParser.java

License:Open Source License

private static boolean matchModifiersPattern(int access, String modifier1, String modifier2, String modifier3) {
    if (modifier1 == null && modifier2 == null && modifier3 == null)
        return true; // modifiers-pattern is optional
    if ("*".equals(modifier1))
        modifier1 = null;/*from w  w  w  .  j  av a 2 s.  c o  m*/
    switch (access) {
    case Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("public")) && "static".equals(modifier2)
                && "final".equals(modifier3);
    case Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("protected")) && "static".equals(modifier2)
                && "final".equals(modifier3);
    case Opcodes.ACC_STATIC + Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("package-private")) && "static".equals(modifier2)
                && "final".equals(modifier3);
    case Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("private")) && "static".equals(modifier2)
                && "final".equals(modifier3);
    case Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC:
        return (modifier1 == null || modifier1.equals("public")) && "static".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC:
        return (modifier1 == null || modifier1.equals("protected")) && "static".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_STATIC:
        return (modifier1 == null || modifier1.equals("package-private")) && "static".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC:
        return (modifier1 == null || modifier1.equals("private")) && "static".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("public")) && "final".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("protected")) && "final".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("package-private")) && "final".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL:
        return (modifier1 == null || modifier1.equals("private")) && "final".equals(modifier2)
                && modifier3 == null;
    case Opcodes.ACC_PUBLIC:
        return (modifier1 == null || modifier1.equals("public")) && modifier2 == null && modifier3 == null;
    case Opcodes.ACC_PROTECTED:
        return (modifier1 == null || modifier1.equals("protected")) && modifier2 == null && modifier3 == null;
    case 0x0000:
        return (modifier1 == null || modifier1.equals("package-private")) && modifier2 == null
                && modifier3 == null;
    case Opcodes.ACC_PRIVATE:
        return (modifier1 == null || modifier1.equals("private")) && modifier2 == null && modifier3 == null;
    }
    return false;
}

From source file:org.teavm.parsing.Parser.java

License:Apache License

public static void parseModifiers(int access, ElementHolder member) {
    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        member.setLevel(AccessLevel.PRIVATE);
    } else if ((access & Opcodes.ACC_PROTECTED) != 0) {
        member.setLevel(AccessLevel.PROTECTED);
    } else if ((access & Opcodes.ACC_PUBLIC) != 0) {
        member.setLevel(AccessLevel.PUBLIC);
    }//from  w  ww .j a v  a 2  s .  c  o m

    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        member.getModifiers().add(ElementModifier.ABSTRACT);
    }
    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
        member.getModifiers().add(ElementModifier.ANNOTATION);
    }
    if ((access & Opcodes.ACC_BRIDGE) != 0) {
        member.getModifiers().add(ElementModifier.BRIDGE);
    }
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        member.getModifiers().add(ElementModifier.DEPRECATED);
    }
    if ((access & Opcodes.ACC_ENUM) != 0) {
        member.getModifiers().add(ElementModifier.ENUM);
    }
    if ((access & Opcodes.ACC_FINAL) != 0) {
        member.getModifiers().add(ElementModifier.FINAL);
    }
    if ((access & Opcodes.ACC_INTERFACE) != 0) {
        member.getModifiers().add(ElementModifier.INTERFACE);
    }
    if ((access & Opcodes.ACC_NATIVE) != 0) {
        member.getModifiers().add(ElementModifier.NATIVE);
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        member.getModifiers().add(ElementModifier.STATIC);
    }
    if ((access & Opcodes.ACC_STRICT) != 0) {
        member.getModifiers().add(ElementModifier.STRICT);
    }
    if ((access & Opcodes.ACC_SUPER) != 0) {
        member.getModifiers().add(ElementModifier.SUPER);
    }
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        member.getModifiers().add(ElementModifier.SYNCHRONIZED);
    }
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        member.getModifiers().add(ElementModifier.SYNTHETIC);
    }
    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        member.getModifiers().add(ElementModifier.TRANSIENT);
    }
    if ((access & Opcodes.ACC_VARARGS) != 0) {
        member.getModifiers().add(ElementModifier.VARARGS);
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        member.getModifiers().add(ElementModifier.VOLATILE);
    }
}

From source file:org.teavm.parsing.ProgramParser.java

License:Apache License

private void prepare(MethodNode method) {
    InsnList instructions = method.instructions;
    minLocal = 0;/*from w  ww .ja v  a  2 s . c om*/
    if ((method.access & Opcodes.ACC_STATIC) != 0) {
        minLocal = 1;
    }
    labelIndexes = new HashMap<>();
    lineNumbers = new HashMap<>();
    for (int i = 0; i < instructions.size(); ++i) {
        AbstractInsnNode node = instructions.get(i);
        if (node instanceof LabelNode) {
            labelIndexes.put(((LabelNode) node).getLabel(), i);
        }
        if (node instanceof LineNumberNode) {
            LineNumberNode lineNumberNode = (LineNumberNode) node;
            lineNumbers.put(lineNumberNode.start.getLabel(), lineNumberNode.line);
        }
    }
    for (LocalVariableNode localVar : method.localVariables) {
        int location = labelIndexes.get(localVar.start.getLabel());
        List<LocalVariableNode> vars = localVariableMap.get(location);
        if (vars == null) {
            vars = new ArrayList<>();
            localVariableMap.put(location, vars);
        }
        vars.add(localVar);
    }
    targetInstructions = new ArrayList<>(instructions.size());
    targetInstructions.addAll(Collections.nCopies(instructions.size(), null));
    basicBlocks.addAll(Collections.nCopies(instructions.size(), null));
    stackBefore = new StackFrame[instructions.size()];
    stackAfter = new StackFrame[instructions.size()];
}