List of usage examples for org.objectweb.asm Opcodes ACC_SYNCHRONIZED
int ACC_SYNCHRONIZED
To view the source code for org.objectweb.asm Opcodes ACC_SYNCHRONIZED.
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:// w w w. ja v a 2s.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
/** * Traverse through modifiers, and combine them in one int value. Raise an error if there is multiple occurrences of same modifier. * * @param ctxList modifiers list. * @param defaultVisibilityModifier Default visibility modifier. Can be null. Applied if providen, and no visibility modifier exists in the ctxList. * @return tuple of int modifier and boolean flag, signalising visibility modifiers presence(true if there is visibility modifier in list, false otherwise). * @see #checkModifierDuplication(int, int, TerminalNode) *//*w w w . j a va 2 s. c om*/ public List<Object> parseModifiers(List<? extends GroovyLangParser.MemberModifierContext> ctxList, Integer defaultVisibilityModifier) { int modifiers = 0; boolean hasVisibilityModifier = false; for (GroovyLangParser.MemberModifierContext it : ctxList) { TerminalNode child = (TerminalNode) it.getChild(0); switch (child.getSymbol().getType()) { case GroovyLangLexer.KW_STATIC: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_STATIC, child); break; case GroovyLangLexer.KW_ABSTRACT: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_ABSTRACT, child); break; case GroovyLangLexer.KW_FINAL: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_FINAL, child); break; case GroovyLangLexer.KW_NATIVE: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_NATIVE, child); break; case GroovyLangLexer.KW_SYNCHRONIZED: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_SYNCHRONIZED, child); break; case GroovyLangLexer.KW_TRANSIENT: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_TRANSIENT, child); break; case GroovyLangLexer.KW_VOLATILE: modifiers |= checkModifierDuplication(modifiers, Opcodes.ACC_VOLATILE, child); break; case GroovyLangLexer.VISIBILITY_MODIFIER: modifiers |= parseVisibilityModifiers(child); hasVisibilityModifier = true; break; } } if (!hasVisibilityModifier && defaultVisibilityModifier != null) modifiers |= defaultVisibilityModifier; return new LinkedList<Object>(Arrays.asList(modifiers, hasVisibilityModifier)); }
From source file:org.codehaus.groovy.tools.javac.JavaStubGenerator.java
License:Apache License
private static void printModifiers(PrintWriter out, int modifiers) { if ((modifiers & Opcodes.ACC_PUBLIC) != 0) out.print("public "); if ((modifiers & Opcodes.ACC_PROTECTED) != 0) out.print("protected "); if ((modifiers & Opcodes.ACC_PRIVATE) != 0) out.print("private "); if ((modifiers & Opcodes.ACC_STATIC) != 0) out.print("static "); if ((modifiers & Opcodes.ACC_SYNCHRONIZED) != 0) out.print("synchronized "); if ((modifiers & Opcodes.ACC_FINAL) != 0) out.print("final "); if ((modifiers & Opcodes.ACC_ABSTRACT) != 0) out.print("abstract "); }
From source file:org.evosuite.symbolic.instrument.AccessFlags.java
License:Open Source License
static boolean isSynchronized(int access) { return is(access, Opcodes.ACC_SYNCHRONIZED); }
From source file:org.fehrman.jcm.find.Find.java
License:CDDL license
@SuppressWarnings("unchecked") private String processMethod(MethodNode methodNode) throws Exception //---------------------------------------------------------------- { StringBuilder methodDescription = new StringBuilder(); String className = null;/*from w w w . ja v a 2s.com*/ Type returnType = Type.getReturnType(methodNode.desc); Type[] argumentTypes = Type.getArgumentTypes(methodNode.desc); List<String> thrownInternalClassNames = methodNode.exceptions; _logger.entering(CLASS, Thread.currentThread().getStackTrace()[1].getMethodName()); if ((methodNode.access & Opcodes.ACC_PUBLIC) != 0) { methodDescription.append("public "); } if ((methodNode.access & Opcodes.ACC_PRIVATE) != 0) { methodDescription.append("private "); } if ((methodNode.access & Opcodes.ACC_PROTECTED) != 0) { methodDescription.append("protected "); } if ((methodNode.access & Opcodes.ACC_STATIC) != 0) { methodDescription.append("static "); } if ((methodNode.access & Opcodes.ACC_ABSTRACT) != 0) { methodDescription.append("abstract "); } if ((methodNode.access & Opcodes.ACC_SYNCHRONIZED) != 0) { methodDescription.append("synchronized "); } className = returnType.getClassName(); if (className != null && className.startsWith(JAVA_LANG)) { methodDescription.append(className.substring(JAVA_LANG.length())); } else { methodDescription.append(className); } methodDescription.append(" "); methodDescription.append(methodNode.name); methodDescription.append("("); for (int i = 0; i < argumentTypes.length; i++) { Type argumentType = argumentTypes[i]; if (i > 0) { methodDescription.append(", "); } className = argumentType.getClassName(); if (className != null && className.startsWith(JAVA_LANG)) { methodDescription.append(className.substring(JAVA_LANG.length())); } else { methodDescription.append(className); } } methodDescription.append(")"); if (!thrownInternalClassNames.isEmpty()) { methodDescription.append(" throws "); int i = 0; for (String thrownInternalClassName : thrownInternalClassNames) { if (i > 0) { methodDescription.append(", "); } className = Type.getObjectType(thrownInternalClassName).getClassName(); if (className != null && className.startsWith(JAVA_LANG)) { methodDescription.append(className.substring(JAVA_LANG.length())); } else { methodDescription.append(className); } i++; } } _logger.exiting(CLASS, Thread.currentThread().getStackTrace()[1].getMethodName()); return methodDescription.toString(); }
From source file:org.freud.analysed.classbytecode.parser.asm.AsmMethod.java
License:Apache License
@Override public boolean isSynchronized() { return isAccessModifier(Opcodes.ACC_SYNCHRONIZED); }
From source file:org.jtsan.MethodTransformer.java
License:Apache License
@Override protected void onMethodEnter() { // TODO: this is a workaround to having not all <init>s in onMethodEnter(), needs fixing. if (!methodName.equals("<init>")) { push(codePos.incMethodEnterPC()); captureMethodEnter();//from ww w . jav a 2 s . co m } if ((methodAccess & Opcodes.ACC_SYNCHRONIZED) != 0) { if (methodIsStatic) { Type classType = Type.getType(className); visitLdcInsn(classType); } else { loadThis(); } push(codePos.incMethodEnterPC()); captureMonitorEnter(); } }
From source file:org.jtsan.MethodTransformer.java
License:Apache License
private void onFinally() { if ((methodAccess & Opcodes.ACC_SYNCHRONIZED) != 0) { if (methodIsStatic) { Type classType = Type.getType(className); visitLdcInsn(classType);//from w ww . j a v a 2 s . com } else { loadThis(); } push(genCodePosition()); captureMonitorExit(); } // TODO: this is a workaround to having not all <init>s in onMethodEnter(), needs fixing. if (!methodName.equals("<init>")) { push(genCodePosition()); captureMethodExit(); } }
From source file:org.openjdk.jmh.generators.asm.ASMMethodInfo.java
License:Open Source License
@Override public boolean isSynchronized() { return (access & Opcodes.ACC_SYNCHRONIZED) > 0; }
From source file:org.openspotlight.bundle.language.java.resolver.JavaGraphNodeSupport.java
License:Open Source License
/** * Sets the method data./*from ww w . j av a2s .co m*/ * * @param method the method * @param access the access */ private void setMethodData(final JavaMethod method, final int access) { final boolean isMethodPublic = (access & Opcodes.ACC_PUBLIC) != 0; final boolean isMethodPrivate = (access & Opcodes.ACC_PRIVATE) != 0; final boolean isMethodStatic = (access & Opcodes.ACC_STATIC) != 0; final boolean isMethodFinal = (access & Opcodes.ACC_FINAL) != 0; final boolean isMethodProtected = (access & Opcodes.ACC_PROTECTED) != 0; final boolean isMethodSynchronized = (access & Opcodes.ACC_SYNCHRONIZED) != 0; method.setPublic(isMethodPublic); method.setPrivate(isMethodPrivate); method.setStatic(isMethodStatic); method.setFinal(isMethodFinal); method.setProtected(isMethodProtected); method.setSynchronized(isMethodSynchronized); }