Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.errorprone.BugPattern.SeverityLevel.ERROR;
import static com.google.errorprone.matchers.Description.NO_MATCH;
import static com.google.errorprone.util.ASTHelpers.stripParentheses;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
Expand All @@ -41,7 +40,6 @@
import com.sun.source.tree.LiteralTree;
import com.sun.source.tree.MemberSelectTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.ParenthesizedTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.UnaryTree;
import com.sun.source.tree.WhileLoopTree;
Expand Down Expand Up @@ -138,11 +136,6 @@ public Boolean visitLiteral(LiteralTree tree, Void unused) {
return true;
}

@Override
public Boolean visitParenthesized(ParenthesizedTree node, Void unused) {
return node.getExpression().accept(this, null);
}

@Override
public Boolean visitUnary(UnaryTree node, Void unused) {
return node.getExpression().accept(this, null);
Expand Down Expand Up @@ -200,7 +193,7 @@ public Void visitCompoundAssignment(CompoundAssignmentTree tree, Void unused) {
}

private void check(ExpressionTree expression) {
Symbol sym = ASTHelpers.getSymbol(stripParentheses(expression));
Symbol sym = ASTHelpers.getSymbol(expression);
modified |= variables.contains(sym);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,25 +198,6 @@ void g() {
.doTest();
}

@Test
public void parenthesized() {
compilationTestHelper
.addSourceLines(
"Test.java",
"""
class Test {
void f() {
for (int i = 0; i < 10; (i)++) {
System.err.println(i);
}
// BUG: Diagnostic contains: condition variable(s) never modified in loop body: i
for (int i = 0; (i < 10); ) {}
}
}
""")
.doTest();
}

@Test
public void constantLoopBound() {
compilationTestHelper
Expand Down
Loading