Package com.sun.source.tree

Examples of com.sun.source.tree.SynchronizedTree


      if (enclosingLoop != null) {
        break;
      }
    }
    if (enclosingLoop != null) {
      SynchronizedTree enclosingSynchronized = ASTHelpers.findEnclosingNode(
          state.getPath().getParentPath(), SynchronizedTree.class);
      if (enclosingSynchronized != null) {
        String blockStatements = enclosingSynchronized.getBlock().toString();
        int openBracketIndex = blockStatements.indexOf('{');
        int closeBracketIndex = blockStatements.lastIndexOf('}');
        blockStatements = blockStatements.substring(openBracketIndex + 1, closeBracketIndex).trim();
        return describeMatch(tree, SuggestedFix.builder()
            .replace(enclosingSynchronized, blockStatements)
            .prefixWith(enclosingLoop, "synchronized " + enclosingSynchronized.getExpression() + " {\n")
            .postfixWith(enclosingLoop, "\n}")
            .build());
      }
    }
View Full Code Here


   */
  public static final <T extends Tree> Matcher<T> inSynchronized() {
    return new Matcher<T>() {
      @Override
      public boolean matches(T tree, VisitorState state) {
        SynchronizedTree synchronizedTree =
            ASTHelpers.findEnclosingNode(state.getPath(), SynchronizedTree.class);
        if (synchronizedTree != null) {
          return true;
        }

View Full Code Here

TOP

Related Classes of com.sun.source.tree.SynchronizedTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.