List of usage examples for org.eclipse.jdt.core.dom SynchronizedStatement getExpression
public Expression getExpression()
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(SynchronizedStatement node) { this.fBuffer.append("synchronized (");//$NON-NLS-1$ node.getExpression().accept(this); this.fBuffer.append(") ");//$NON-NLS-1$ node.getBody().accept(this); return false; }
From source file:boa.datagen.util.Java7Visitor.java
License:Apache License
@Override public boolean visit(SynchronizedStatement node) { boa.types.Ast.Statement.Builder b = boa.types.Ast.Statement.newBuilder(); // b.setPosition(pos.build()); List<boa.types.Ast.Statement> list = statements.peek(); b.setKind(boa.types.Ast.Statement.StatementKind.SYNCHRONIZED); node.getExpression().accept(this); b.setExpression(expressions.pop());//from w w w . j a v a 2 s .co m statements.push(new ArrayList<boa.types.Ast.Statement>()); for (Object s : node.getBody().statements()) ((org.eclipse.jdt.core.dom.Statement) s).accept(this); for (boa.types.Ast.Statement s : statements.pop()) b.addStatements(s); list.add(b.build()); return false; }
From source file:chibi.gumtreediff.gen.jdt.cd.CdJdtVisitor.java
License:Open Source License
@Override public boolean visit(SynchronizedStatement node) { pushNode(node, node.getExpression().toString()); return true; }
From source file:coloredide.utils.CopiedNaiveASTFlattener.java
License:Open Source License
public boolean visit(SynchronizedStatement node) { this.buffer.append("synchronized (");//$NON-NLS-1$ node.getExpression().accept(this); this.buffer.append(") ");//$NON-NLS-1$ node.getBody().accept(this); return false; }
From source file:com.chookapp.org.bracketeer.jdt.ClosingBracketHintVisitor.java
License:Open Source License
@Override public boolean visit(SynchronizedStatement node) { String hint = GetNodeText(node.getExpression()); int startLoc = node.getStartPosition(); int endLoc = startLoc + node.getLength() - 1; try {/*from ww w . j a v a 2s.com*/ _container.add(new Hint("synchronized", startLoc, endLoc, "synchronized( " + hint + " )")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } catch (BadLocationException e) { _cancelProcessing.set(true); } return shouldContinue(); }
From source file:com.google.devtools.j2cpp.gen.CppStatementGenerator.java
License:Open Source License
@Override public boolean visit(SynchronizedStatement node) { buffer.append("@synchronized ("); node.getExpression().accept(this); buffer.append(") "); node.getBody().accept(this); return false; }
From source file:com.google.devtools.j2cpp.translate.ClassConverter.java
License:Open Source License
@SuppressWarnings("unchecked") public static void setProperty(ASTNode node, Expression expr) { ASTNode parent = node.getParent();/*from w w w. ja v a 2 s .c o m*/ StructuralPropertyDescriptor locator = node.getLocationInParent(); if (locator instanceof ChildPropertyDescriptor) { parent.setStructuralProperty(locator, expr); } else { // JDT doesn't directly support ChildListProperty replacement. List<Expression> args; if (parent instanceof MethodInvocation) { args = ((MethodInvocation) parent).arguments(); } else if (parent instanceof ClassInstanceCreation) { args = ((ClassInstanceCreation) parent).arguments(); } else if (parent instanceof InfixExpression) { args = ((InfixExpression) parent).extendedOperands(); } else if (parent instanceof SynchronizedStatement) { SynchronizedStatement stmt = (SynchronizedStatement) parent; if (node.equals(stmt.getExpression())) { stmt.setExpression((Expression) node); } return; } else if (parent instanceof SuperConstructorInvocation) { args = ((SuperConstructorInvocation) parent).arguments(); } else if (parent instanceof ArrayCreation) { args = ((ArrayCreation) parent).dimensions(); } else { throw new AssertionError("unknown parent node type: " + parent.getClass().getSimpleName()); } for (int i = 0; i < args.size(); i++) { if (node.equals(args.get(i))) { args.set(i, expr); } } } }
From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java
License:Apache License
@Override public boolean visit(SynchronizedStatement node) { sb.print("synchronized ("); node.getExpression().accept(this); sb.print(") "); node.getBody().accept(this); return false; }
From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java
License:Apache License
/** Visitor method for {@link SynchronizedStatement}s. */ @Override// w w w . ja v a 2 s. c o m public boolean visit(SynchronizedStatement node) { sync(node); token("synchronized"); builder.space(); token("("); builder.open(plusFour); builder.breakOp(); node.getExpression().accept(this); builder.close(); token(")"); builder.space(); node.getBody().accept(this); return false; }
From source file:com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.java
License:Open Source License
private CAstNode visit(SynchronizedStatement n, WalkContext context) { CAstNode exprNode = visitNode(n.getExpression(), context); String exprName = fFactory.makeUnique(); CAstNode declStmt = makeNode(context, fFactory, n, CAstNode.DECL_STMT, fFactory.makeConstant(new CAstSymbolImpl(exprName, fTypeDict.getCAstTypeFor(n.getExpression().resolveTypeBinding()), true)), exprNode);/*w w w.j a va 2 s . c o m*/ CAstNode monitorEnterNode = makeNode(context, fFactory, n, CAstNode.MONITOR_ENTER, makeNode(context, fFactory, n, CAstNode.VAR, fFactory.makeConstant(exprName))); context.cfg().map(monitorEnterNode, monitorEnterNode); for (Pair<ITypeBinding, Object> catchTarget : context.getCatchTargets(fNullPointerExcType)) context.cfg().add(monitorEnterNode, catchTarget.snd, catchTarget.fst); CAstNode bodyNodes = visitNode(n.getBody(), context); CAstNode monitorExitNode = makeNode(context, fFactory, n, CAstNode.MONITOR_EXIT, makeNode(context, fFactory, n, CAstNode.VAR, fFactory.makeConstant(exprName))); context.cfg().map(monitorExitNode, monitorExitNode); for (Pair<ITypeBinding, Object> catchTarget : context.getCatchTargets(fNullPointerExcType)) context.cfg().add(monitorExitNode, catchTarget.snd, catchTarget.fst); CAstNode tryBody = makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, monitorEnterNode, bodyNodes); CAstNode bigBody = makeNode(context, fFactory, n, CAstNode.UNWIND, tryBody, monitorExitNode); return makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, declStmt, bigBody); }