Skip to content

Use SUPPORTS_REMOVE for CollectionRemoveIfTester feature requirements. - #8643

Open
Divyansh151005 wants to merge 2 commits into
google:masterfrom
Divyansh151005:fix/collection-removeif-feature-flags
Open

Divyansh151005 wants to merge 2 commits into
google:masterfrom
Divyansh151005:fix/collection-removeif-feature-flags

Conversation

@Divyansh151005

@Divyansh151005 Divyansh151005 commented Aug 30, 2026

Copy link
Copy Markdown

Problem

CollectionRemoveIfTester was inconsistent about which collection feature flags gate removeIf tests:

  • Positive removeIf tests required SUPPORTS_ITERATOR_REMOVE.
  • Unsupported-case tests correctly used absent = SUPPORTS_REMOVE.

Collections that support removeIf (and remove) but not iterator removal therefore skipped all removeIf coverage in Guava Testlib.

Fixes #6076

Solution

Require SUPPORTS_REMOVE for the positive removeIf tests, matching CollectionRemoveTester and the unsupported tests in the same class.

Add CollectionRemoveIfFeatureTest, which builds a suite for a collection with SUPPORTS_REMOVE but without SUPPORTS_ITERATOR_REMOVE and verifies that removeIf tests are included.

Testing

$ export JAVA_HOME=~/.m2/jdks/jdk-26.0.2+10/Contents/Home
$ ./mvnw -B -Dtoolchain.skip -P!standard-with-extra-repos test \
    -Dmaven.javadoc.skip=true -Dsurefire.toolchain.version=17 \
    -Dtest=CollectionRemoveIfFeatureTest -DfailIfNoTests=false -pl guava-testlib

[INFO] Running com.google.common.collect.testing.CollectionRemoveIfFeatureTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS

…ents.

Fixes google#6076

RELNOTES=`testing`: Fixed `CollectionRemoveIfTester` so that `removeIf` tests run for collections with `SUPPORTS_REMOVE` even when `SUPPORTS_ITERATOR_REMOVE` is absent.

Co-authored-by: Cursor <cursoragent@cursor.com>
@google-cla

google-cla Bot commented Aug 30, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cgdecker

Copy link
Copy Markdown
Member

We can't review your PR unless you sign the CLA.

@cgdecker cgdecker added P3 no SLO P4 no SLO and removed P3 no SLO labels Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P4 no SLO

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] GuavaTestLib RemoveIf Flag Inconsistencies

2 participants