Skip to content

[java] Fix #6926: skip file on unresolved generic arity mismatch - #6935

Merged
UncleOwen merged 1 commit into
pmd:mainfrom
kalayciburak:fix/6926-mismatched-unresolved-type-args
Sep 9, 2026
Merged

UncleOwen merged 1 commit into
pmd:mainfrom
kalayciburak:fix/6926-mismatched-unresolved-type-args

Conversation

@kalayciburak

@kalayciburak kalayciburak commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Describe the PR

Unresolved types keep the type-parameter arity of the first use (UnresolvedClassStore). A later use of the same unresolved name with a different argument count used to crash in Substitution.mapping / CollectionUtil.zip with:

IllegalArgumentException: Mismatched list sizes [T0, T1] to [...]

This reports a semantic error (type name + file, missing aux-classpath hint) and skips that file so the rest of the analysis can continue. It does not erase generics.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

Test plan (executed)

./mvnw -pl pmd-java test -Dtest=UnresolvedGenericArityMismatchTest -Dsurefire.failIfNoSpecifiedTests=false
./mvnw -pl pmd-java test -Dtest=TypeDisambiguationTest,TypeTestUtilTest -Dsurefire.failIfNoSpecifiedTests=false

GREEN locally (Java 25 / release 8 bytecode as configured by the project). TypeDisambiguationTest 14/0 skip 1.

@pmd-actions-helper

pmd-actions-helper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-09-08 20:27:05+00:00 for 9384d4e)

@kalayciburak
kalayciburak force-pushed the fix/6926-mismatched-unresolved-type-args branch from 7b030ad to 1cb2047 Compare August 19, 2026 21:57
@kalayciburak
kalayciburak force-pushed the fix/6926-mismatched-unresolved-type-args branch 3 times, most recently from ae7158e to d244ab5 Compare September 3, 2026 18:34
@kalayciburak
kalayciburak force-pushed the fix/6926-mismatched-unresolved-type-args branch from d244ab5 to 120bc2f Compare September 8, 2026 18:05
UnresolvedClassStore freezes type-parameter arity on the first use of an
unresolved name. A later use with a different argument count used to crash
in Substitution.mapping via localSubst.

Report a semantic error (type name + file) and skip that file instead of
erasing generics or aborting the whole analysis.
@kalayciburak
kalayciburak force-pushed the fix/6926-mismatched-unresolved-type-args branch from 120bc2f to 9384d4e Compare September 8, 2026 19:52
@kalayciburak kalayciburak changed the title [java] Fix #6926: tolerate mismatched unresolved generic arity [java] Fix #6926: skip file on unresolved generic arity mismatch Sep 8, 2026

@UncleOwen UncleOwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@UncleOwen UncleOwen added this to the 7.28.0 milestone Sep 9, 2026
@UncleOwen
UncleOwen merged commit eeac089 into pmd:main Sep 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] IllegalArgumentException (Mismatched list sizes) with inconsistent unresolved generic arity

4 participants