Repository navigation
[java] Fix #6546: Consolidate the Vector replacement rules - #7199
Merged
Merged
Conversation
Consolidate UseArrayListInsteadOfVector into ReplaceVectorWithList and cover Vector subclasses. Fixes pmd#6546
Use the standard alias declaration and assert its expected deprecation warning.
zbynek
reviewed
Oct 19, 2026
zbynek
reviewed
Oct 19, 2026
zbynek
reviewed
Oct 19, 2026
Contributor
Author
|
Thanks for the review, @zbynek! Fixed the test snippet and removed the unqualified |
zbynek
approved these changes
Oct 20, 2026
Contributor
|
Compared to main: (comment created at 2026-10-25 19:48:06+00:00 for f82ab25) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the PR
Adds
ReplaceJavaUtilVectorto consolidate the Vector replacement rules. It reportsVector v = new Vector()once, covers constructor-only uses and subclasses includingStack, and recommendsArrayListorDeque/ArrayDequewhen thread safety is not required. Type matching uses the qualifiedjava.util.Vectortype and ignores unresolved, unqualifiedVectortypes.Both
ReplaceVectorWithListandUseArrayListInsteadOfVectorare deprecated aliases of the new rule. The regression cases cover duplicate declarations, constructor-only uses, subclasses, both legacy aliases and deprecation warnings. TheStackregression snippet also compiles on JDK 21.Validation
./mvnw -o -pl pmd-java -am -Dmaven.javadoc.skip=true -Ddokka.skip=true verifyRelated issues
Fixes #6546.
Ready?
./mvnw clean verifypasses (checked automatically by GitHub Actions)I used AI assistance for the implementation and tests.