From ce8f0781de452273a41e2aebc923bdb3a9fd9e47 Mon Sep 17 00:00:00 2001 From: Giovanni Zotta Date: Sat, 10 Feb 2024 22:07:09 +0100 Subject: [PATCH] Extend --- .../tech/picnic/errorprone/refasterrules/CollectionRules.java | 3 ++- .../errorprone/refasterrules/CollectionRulesTestInput.java | 3 ++- .../errorprone/refasterrules/CollectionRulesTestOutput.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java index 7a9802cb1fc..bdcffa86615 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java @@ -41,7 +41,8 @@ boolean before(Collection collection) { collection.size() == 0, collection.size() <= 0, collection.size() < 1, - Iterables.isEmpty(collection)); + Iterables.isEmpty(collection), + collection.stream().findAny().isEmpty()); } @BeforeTemplate diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java index 735587515c9..56f194cd4db 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java @@ -29,7 +29,8 @@ ImmutableSet testCollectionIsEmpty() { ImmutableSet.of(5).size() > 0, ImmutableSet.of(6).size() >= 1, Iterables.isEmpty(ImmutableSet.of(7)), - ImmutableSet.of(8).asList().isEmpty()); + ImmutableSet.of(8).stream().findAny().isEmpty(), + ImmutableSet.of(9).asList().isEmpty()); } ImmutableSet testCollectionSize() { diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java index cf2040e33b0..96719dcdbf0 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java @@ -29,7 +29,8 @@ ImmutableSet testCollectionIsEmpty() { !ImmutableSet.of(5).isEmpty(), !ImmutableSet.of(6).isEmpty(), ImmutableSet.of(7).isEmpty(), - ImmutableSet.of(8).isEmpty()); + ImmutableSet.of(8).isEmpty(), + ImmutableSet.of(9).isEmpty()); } ImmutableSet testCollectionSize() {