List of usage examples for org.objectweb.asm Opcodes ACC_STRICT
int ACC_STRICT
To view the source code for org.objectweb.asm Opcodes ACC_STRICT.
Click Source Link
From source file:org.codehaus.groovy.antlr.AntlrParserPlugin.java
License:Apache License
protected int modifiers(AST modifierNode, List<AnnotationNode> annotations, int defaultModifiers) { assertNodeType(MODIFIERS, modifierNode); boolean access = false; int answer = 0; for (AST node = modifierNode.getFirstChild(); node != null; node = node.getNextSibling()) { int type = node.getType(); switch (type) { case STATIC_IMPORT: // ignore break; // annotations case ANNOTATION: annotations.add(annotation(node)); break; // core access scope modifiers case LITERAL_private: answer = setModifierBit(node, answer, Opcodes.ACC_PRIVATE); access = setAccessTrue(node, access); break; case LITERAL_protected: answer = setModifierBit(node, answer, Opcodes.ACC_PROTECTED); access = setAccessTrue(node, access); break; case LITERAL_public: answer = setModifierBit(node, answer, Opcodes.ACC_PUBLIC); access = setAccessTrue(node, access); break; // other modifiers case ABSTRACT: answer = setModifierBit(node, answer, Opcodes.ACC_ABSTRACT); break; case FINAL: answer = setModifierBit(node, answer, Opcodes.ACC_FINAL); break; case LITERAL_native: answer = setModifierBit(node, answer, Opcodes.ACC_NATIVE); break; case LITERAL_static: answer = setModifierBit(node, answer, Opcodes.ACC_STATIC); break; case STRICTFP: answer = setModifierBit(node, answer, Opcodes.ACC_STRICT); break; case LITERAL_synchronized: answer = setModifierBit(node, answer, Opcodes.ACC_SYNCHRONIZED); break; case LITERAL_transient: answer = setModifierBit(node, answer, Opcodes.ACC_TRANSIENT); break; case LITERAL_volatile: answer = setModifierBit(node, answer, Opcodes.ACC_VOLATILE); break; default://from w w w. ja v a 2 s . c o m unknownAST(node); } } if (!access) { answer |= defaultModifiers; // ACC_SYNTHETIC isn't used here, use it as a special flag if (defaultModifiers == Opcodes.ACC_PUBLIC) answer |= Opcodes.ACC_SYNTHETIC; } return answer; }
From source file:org.codehaus.groovy.parser.antlr4.ASTBuilder.java
License:Apache License
public int parseClassModifiers(List<? extends GroovyLangParser.ClassModifierContext> ctxs) { List<TerminalNode> visibilityModifiers = new LinkedList<TerminalNode>(); int modifiers = 0; for (int i = 0; i < ctxs.size(); i++) { for (Object ctx : ctxs.get(i).children) { ParseTree child = null;//from w ww. j av a 2 s. c o m if (ctx instanceof List) { List list = (List) ctx; assert list.size() == 1; child = (ParseTree) list.get(0); } else child = (ParseTree) ctx; assert child instanceof TerminalNode; switch (((TerminalNode) child).getSymbol().getType()) { case GroovyLangLexer.VISIBILITY_MODIFIER: visibilityModifiers.add((TerminalNode) child); break; case GroovyLangLexer.KW_STATIC: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_STATIC, (TerminalNode) child); break; case GroovyLangLexer.KW_ABSTRACT: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_ABSTRACT, (TerminalNode) child); break; case GroovyLangLexer.KW_FINAL: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_FINAL, (TerminalNode) child); break; case GroovyLangLexer.KW_STRICTFP: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_STRICT, (TerminalNode) child); break; } } } if (asBoolean(visibilityModifiers)) modifiers |= parseVisibilityModifiers(visibilityModifiers, 0); else modifiers |= Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC; return modifiers; }
From source file:org.evosuite.symbolic.instrument.AccessFlags.java
License:Open Source License
static boolean isStrict(int access) { return is(access, Opcodes.ACC_STRICT); }
From source file:org.freud.analysed.classbytecode.parser.asm.AsmMethod.java
License:Apache License
@Override public boolean isStrict() { return isAccessModifier(Opcodes.ACC_STRICT); }
From source file:org.openjdk.jmh.generators.asm.ASMClassInfo.java
License:Open Source License
@Override public boolean isStrictFP() { return (access & Opcodes.ACC_STRICT) > 0; }
From source file:org.sonar.java.resolve.FlagsTest.java
License:Open Source License
/** * Flags can be easily loaded from class-files into symbols. *///www. ja v a2s.com @Test public void flags_match_asm_opcodes() { assertThat(Flags.PUBLIC).isEqualTo(Opcodes.ACC_PUBLIC); assertThat(Flags.PRIVATE).isEqualTo(Opcodes.ACC_PRIVATE); assertThat(Flags.PROTECTED).isEqualTo(Opcodes.ACC_PROTECTED); assertThat(Flags.STATIC).isEqualTo(Opcodes.ACC_STATIC); assertThat(Flags.FINAL).isEqualTo(Opcodes.ACC_FINAL); assertThat(Flags.SYNCHRONIZED).isEqualTo(Opcodes.ACC_SYNCHRONIZED); assertThat(Flags.VOLATILE).isEqualTo(Opcodes.ACC_VOLATILE); assertThat(Flags.TRANSIENT).isEqualTo(Opcodes.ACC_TRANSIENT); assertThat(Flags.NATIVE).isEqualTo(Opcodes.ACC_NATIVE); assertThat(Flags.INTERFACE).isEqualTo(Opcodes.ACC_INTERFACE); assertThat(Flags.ABSTRACT).isEqualTo(Opcodes.ACC_ABSTRACT); assertThat(Flags.STRICTFP).isEqualTo(Opcodes.ACC_STRICT); assertThat(Flags.SYNTHETIC).isEqualTo(Opcodes.ACC_SYNTHETIC); assertThat(Flags.ANNOTATION).isEqualTo(Opcodes.ACC_ANNOTATION); assertThat(Flags.ENUM).isEqualTo(Opcodes.ACC_ENUM); }
From source file:org.springframework.migrationanalyzer.contributions.bytecode.AsmUtils.java
License:Apache License
/** * Converts the given bitwise ORed <code>modifiers</code> into a {@link String}. * /* w w w .ja v a 2s .co m*/ * <p/> * * The returned String should reflect the ordering recommended in the JLS: * * <ul> * <li>Classes: <code>public protected private abstract static final strictfp</code></li> * <li>Fields: <code>public protected private static final transient volatile</code></li> * <li>Constructors: <code>public protected private</code></li> * <li>Methods: <code>public protected private abstract static final synchronized native strictfp</code></li> * </ul> * * @param modifiers the modifiers * * @return The String representation of the modifiers * * @see Opcodes */ // CHECKSTYLE:OFF static final String modifiersToString(int modifiers) { StringBuilder accessBuilder = new StringBuilder(); if ((modifiers & Opcodes.ACC_PUBLIC) == Opcodes.ACC_PUBLIC) { accessBuilder.append("public "); } if ((modifiers & Opcodes.ACC_PROTECTED) == Opcodes.ACC_PROTECTED) { accessBuilder.append("protected "); } if ((modifiers & Opcodes.ACC_PRIVATE) == Opcodes.ACC_PRIVATE) { accessBuilder.append("private "); } if ((modifiers & Opcodes.ACC_ABSTRACT) == Opcodes.ACC_ABSTRACT) { accessBuilder.append("abstract "); } if ((modifiers & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC) { accessBuilder.append("static "); } if ((modifiers & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL) { accessBuilder.append("final "); } if ((modifiers & Opcodes.ACC_SYNCHRONIZED) == Opcodes.ACC_SYNCHRONIZED) { accessBuilder.append("synchronized "); } if ((modifiers & Opcodes.ACC_NATIVE) == Opcodes.ACC_NATIVE) { accessBuilder.append("native "); } if ((modifiers & Opcodes.ACC_TRANSIENT) == Opcodes.ACC_TRANSIENT) { accessBuilder.append("transient "); } if ((modifiers & Opcodes.ACC_VOLATILE) == Opcodes.ACC_VOLATILE) { accessBuilder.append("volatile "); } if ((modifiers & Opcodes.ACC_STRICT) == Opcodes.ACC_STRICT) { accessBuilder.append("strictfp "); } return accessBuilder.toString().trim(); }
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 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.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 ww w .ja v a 2 s .c om 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); } }