diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperation.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperation.java index 90835da4160..706d61428f2 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperation.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperation.java @@ -10,7 +10,6 @@ import com.sun.source.tree.ExpressionTree; import com.sun.source.tree.LambdaExpressionTree; import com.sun.source.tree.LambdaExpressionTree.BodyKind; -import com.sun.source.tree.Tree.Kind; import java.util.function.DoubleUnaryOperator; import java.util.function.Function; import java.util.function.IntUnaryOperator; @@ -49,7 +48,6 @@ private static Matcher isIdentityLambdaExpression() { (tree, state) -> tree.getBodyKind() == BodyKind.EXPRESSION && tree.getParameters().size() == 1 - && tree.getBody().getKind() == Kind.IDENTIFIER && ASTHelpers.getSymbol(tree.getParameters().get(0)) .equals(ASTHelpers.getSymbol(tree.getBody()))); } diff --git a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperationTest.java b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperationTest.java index 7536befc3b4..324a8f784dd 100644 --- a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperationTest.java +++ b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsIdentityOperationTest.java @@ -25,6 +25,10 @@ void matches() { " return (a, b) -> a;", " }", "", + " UnaryOperator negative2() {", + " return a -> a + a;", + " }", + "", " DoubleUnaryOperator positive1() {", " // BUG: Diagnostic contains:", " return DoubleUnaryOperator.identity();",