com.sun.source.tree.SynchronizedTree Java Examples

The following examples show how to use com.sun.source.tree.SynchronizedTree. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaInputAstVisitor.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitSynchronized(SynchronizedTree node, Void unused) {
    sync(node);
    token("synchronized");
    builder.space();
    token("(");
    builder.open(plusFour);
    builder.breakOp();
    scan(skipParen(node.getExpression()), null);
    builder.close();
    token(")");
    builder.space();
    scan(node.getBlock(), null);
    return null;
}
 
Example #2
Source File: TreeDuplicator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Tree visitSynchronized(SynchronizedTree tree, Void p) {
    SynchronizedTree n = make.Synchronized(tree.getExpression(), tree.getBlock());
    model.setType(n, model.getType(tree));
    comments.copyComments(tree, n);
    model.setPos(n, model.getPos(tree));
    return n;
}
 
Example #3
Source File: CopyFinder.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Boolean visitSynchronized(SynchronizedTree node, TreePath p) {
    if (p == null) {
        super.visitSynchronized(node, p);
        return false;
    }

    SynchronizedTree at = (SynchronizedTree) p.getLeaf();

    if (!scan(node.getExpression(), at.getExpression(), p)) {
        return false;
    }

    return scan(node.getBlock(), at.getBlock(), p);
}
 
Example #4
Source File: TreeNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitSynchronized(SynchronizedTree tree, List<Node> d) {
    List<Node> below = new ArrayList<Node>();
    
    addCorrespondingType(below);
    addCorrespondingComments(below);
    super.visitSynchronized(tree, below);
    
    d.add(new TreeNode(info, getCurrentPath(), below));
    return null;
}
 
Example #5
Source File: SyncOnNonFinal.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@TriggerTreeKind(Kind.SYNCHRONIZED)
public static ErrorDescription run(HintContext ctx) {
    ExpressionTree expression = ((SynchronizedTree) ctx.getPath().getLeaf()).getExpression();
    
    Element e = ctx.getInfo().getTrees().getElement(new TreePath(ctx.getPath(), expression));
    
    if (e == null || e.getKind() != ElementKind.FIELD || e.getModifiers().contains(Modifier.FINAL)) {
        return null;
    }
    
    String displayName = NbBundle.getMessage(SyncOnNonFinal.class, "ERR_SynchronizationOnNonFinalField");
    
    return ErrorDescriptionFactory.forTree(ctx, expression, displayName);
}
 
Example #6
Source File: ExpressionScanner.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public List<Tree> visitSynchronized(SynchronizedTree node, ExpressionScanner.ExpressionsInfo p) {
    List<Tree> result = null;
    if (acceptsTree(node)) {
        result = scan(node.getExpression(), p);
    }
    return reduce(result, scan(node.getBlock(), p));
}
 
Example #7
Source File: JavaInputAstVisitor.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Void visitSynchronized(SynchronizedTree node, Void unused) {
    sync(node);
    token("synchronized");
    builder.space();
    token("(");
    builder.open(plusFour);
    builder.breakOp();
    scan(skipParen(node.getExpression()), null);
    builder.close();
    token(")");
    builder.space();
    scan(node.getBlock(), null);
    return null;
}
 
Example #8
Source File: JavaInputAstVisitor.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitSynchronized(SynchronizedTree node, Void unused) {
  sync(node);
  token("synchronized");
  builder.space();
  token("(");
  builder.open(plusFour);
  builder.breakOp();
  scan(skipParen(node.getExpression()), null);
  builder.close();
  token(")");
  builder.space();
  scan(node.getBlock(), null);
  return null;
}
 
Example #9
Source File: TreeConverter.java    From j2objc with Apache License 2.0 5 votes vote down vote up
private TreeNode convertSynchronized(SynchronizedTree node, TreePath parent) {
  TreePath path = getTreePath(parent, node);
  Expression expr = convertWithoutParens(node.getExpression(), path);
  expr.setPosition(getPosition(node));
  return new SynchronizedStatement()
      .setExpression(expr)
      .setBody((Block) convert(node.getBlock(), path));
}
 
Example #10
Source File: TreeDiffer.java    From compile-testing with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitSynchronized(SynchronizedTree expected, Tree actual) {
  Optional<SynchronizedTree> other = checkTypeAndCast(expected, actual);
  if (!other.isPresent()) {
    addTypeMismatch(expected, actual);
    return null;
  }

  scan(expected.getExpression(), other.get().getExpression());
  scan(expected.getBlock(), other.get().getBlock());
  return null;
}
 
Example #11
Source File: Flow.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Boolean visitSynchronized(SynchronizedTree node, ConstructorData p) {
    super.visitSynchronized(node, p);
    return null;
}
 
Example #12
Source File: ExpectedTypeResolver.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends TypeMirror> visitSynchronized(SynchronizedTree node, Object p) {
    return null;
}
 
Example #13
Source File: UTemplater.java    From Refaster with Apache License 2.0 4 votes vote down vote up
@Override
public USynchronized visitSynchronized(SynchronizedTree tree, Void v) {
  return USynchronized.create(
      template(tree.getExpression()),
      visitBlock(tree.getBlock(), null));
}
 
Example #14
Source File: RefasterScanner.java    From Refaster with Apache License 2.0 4 votes vote down vote up
@Override
public Void visitSynchronized(SynchronizedTree node, Context context) {
  scan(SKIP_PARENS.visit(node.getExpression(), null), context);
  scan(node.getBlock(), context);
  return null;
}
 
Example #15
Source File: USynchronized.java    From Refaster with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public Unifier visitSynchronized(SynchronizedTree synced, @Nullable Unifier unifier) {
  unifier = getExpression().unify(synced.getExpression(), unifier);
  return getBlock().unify(synced.getBlock(), unifier);
}