Skip to content

Fix #5493: [java] IllegalArgumentException with wildcard bound#5529

Merged
adangel merged 6 commits into
pmd:mainfrom
oowekyala:issue5493-illegal-wildcard
Feb 27, 2025
Merged

Fix #5493: [java] IllegalArgumentException with wildcard bound#5529
adangel merged 6 commits into
pmd:mainfrom
oowekyala:issue5493-illegal-wildcard

Conversation

@oowekyala

Copy link
Copy Markdown
Member

This is a leftover from #5387. Additionally, lambda parameter types are now projected upwards. That means they are "clean", like inferred local variable types, they don't mention capture variables. Since their uses are captured
anyway where it matters, this shouldn't change anything to the precision of inferred types.

Describe the PR

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)

This is a leftover from pmd#5387.
Additionally, lambda parameter types are now
projected upwards. That means they are "clean",
like inferred variable types, they don't mention
capture variables. Since their uses are captured
anyway where it matters, this shouldn't change
anything to the precision of inferred types.
@ghost

ghost commented Feb 14, 2025

Copy link
Copy Markdown
1 Message
📖 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.
Download full report as build artifact
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.
Download full report as build artifact
Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 1 violations, 0 errors and 0 configuration errors.
Download full report as build artifact
Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 1 violations, 0 errors and 0 configuration errors.
Download full report as build artifact
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.
Download full report as build artifact

Generated by 🚫 Danger

@oowekyala oowekyala changed the title Fix #5493 - illegal wildcard [java] Fix #5493 - illegal wildcard Feb 15, 2025
@adangel adangel changed the title [java] Fix #5493 - illegal wildcard Fix #5493: [java] IllegalArgumentException with wildcard bound Feb 20, 2025
@adangel adangel added this to the 7.11.0 milestone Feb 20, 2025
@adangel

adangel commented Feb 20, 2025

Copy link
Copy Markdown
Member

This change unfortunately triggers now an UnusedPrivateMethod problem in pmd-core:

2025-02-20T14:43:30.1597334Z [INFO] --- pmd:3.26.0:check (pmd-main) @ pmd-core ---
2025-02-20T14:43:30.1624831Z [WARNING] PMD Failure: net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeBuilder:184 Rule:UnusedPrivateMethod Priority:1 Avoid unused private methods such as 'closeImpl(N, JavaccToken)'..

@adangel adangel removed this from the 7.11.0 milestone Feb 20, 2025
@oowekyala

Copy link
Copy Markdown
Member Author

Aah I thought that was a red herring. I didn't consider that the change might really change the behaviour of the rule. And since this is reported as a warning I thought the actual error was hidden. I will look into it

Capturing a tvar does not return a tvar with a changed bound
anymore. The upper bound only needs to be captured if we are
trying to find its methods, eg if it is the LHS of a method
call expression.
@oowekyala oowekyala force-pushed the issue5493-illegal-wildcard branch from 6bbe605 to ab3240c Compare February 23, 2025 18:57
@adangel adangel self-requested a review February 25, 2025 19:36
@adangel adangel added this to the 7.11.0 milestone Feb 25, 2025

@adangel adangel 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!

@adangel adangel merged commit 4e8ab68 into pmd:main Feb 27, 2025
@oowekyala oowekyala deleted the issue5493-illegal-wildcard branch February 27, 2025 11:49
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: <?> cannot be a wildcard bound

2 participants