From 92eff23fe5567446c1fe4bc4462f8adeb788fdc9 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Wed, 11 Oct 2023 13:25:52 +0200 Subject: [PATCH] Rebase cleanup --- .../tech/picnic/errorprone/refaster/matchers/IsEmpty.java | 3 +-- .../refaster/matchers/AbstractMatcherTestChecker.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsEmpty.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsEmpty.java index fb0c77b7484..595a94734cf 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsEmpty.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsEmpty.java @@ -139,11 +139,10 @@ private boolean isEmptyCollectionConstructor(ExpressionTree tree, VisitorState s } private static boolean isEmptyArrayCreation(ExpressionTree tree) { - if (!(tree instanceof NewArrayTree)) { + if (!(tree instanceof NewArrayTree newArray)) { return false; } - NewArrayTree newArray = (NewArrayTree) tree; return (!newArray.getDimensions().isEmpty() && ASTHelpers.constValue(newArray.getDimensions().get(0), Integer.class) == 0) || (newArray.getInitializers() != null && newArray.getInitializers().isEmpty()); diff --git a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/AbstractMatcherTestChecker.java b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/AbstractMatcherTestChecker.java index eca823c53e3..1eaba1215d1 100644 --- a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/AbstractMatcherTestChecker.java +++ b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/AbstractMatcherTestChecker.java @@ -93,7 +93,7 @@ private static boolean isMethodSelect(ExpressionTree tree, TreePath path) { } Tree parentTree = parentPath.getLeaf(); - return parentTree instanceof MethodInvocationTree - && ((MethodInvocationTree) parentTree).getMethodSelect().equals(tree); + return parentTree instanceof MethodInvocationTree methodInvocation + && methodInvocation.getMethodSelect().equals(tree); } }