Skip to content

fix(Java): prevent StackOverflow in normalizeIterableTypeArguments for self-referential collections#3817

Merged
chaokunyang merged 3 commits into
apache:mainfrom
Pigsy-Monk:main_fix
Jul 4, 2026
Merged

fix(Java): prevent StackOverflow in normalizeIterableTypeArguments for self-referential collections#3817
chaokunyang merged 3 commits into
apache:mainfrom
Pigsy-Monk:main_fix

Conversation

@Pigsy-Monk

@Pigsy-Monk Pigsy-Monk commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Add a check to detect when the element type's raw type matches the container type, which would cause infinite recursion in normalizeIterableTypeArguments.

This fixes issues with self-referential collections like Box implements List<Box<?>> where the element type is the same as the container type.

Why?

What does this PR do?

Related issues

AI Contribution Checklist

  • Substantial AI assistance was used in this PR: yes / no
  • If yes, I included a completed AI Contribution Checklist in this PR description and the required AI Usage Disclosure.
  • If yes, my PR description includes the required ai_review summary and screenshot evidence or equivalent persisted links of the final clean AI review results from both fresh reviewers described in AI_POLICY.md, the Fory-guided reviewer and the independent general reviewer, on the current PR diff or current HEAD after the latest code changes.

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

…r self-referential collections

Add a check to detect when the element type's raw type matches the container type,
which would cause infinite recursion in normalizeIterableTypeArguments.

This fixes issues with self-referential collections like Box<T> implements List<Box<?>>
where the element type is the same as the container type.
@Pigsy-Monk Pigsy-Monk requested a review from chaokunyang as a code owner July 4, 2026 03:47
@chaokunyang chaokunyang merged commit fa16b1e into apache:main Jul 4, 2026
61 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.

2 participants