Skip to content

RAT-562: Use MutableInt in ClaimValidator#685

Merged
ottlinger merged 10 commits into
masterfrom
remove-boxing
Jul 1, 2026
Merged

RAT-562: Use MutableInt in ClaimValidator#685
ottlinger merged 10 commits into
masterfrom
remove-boxing

Conversation

@Claudenw

Copy link
Copy Markdown
Contributor

Switch to MutableInt in ClaimValidator to avoid boxing/unboxing

@Claudenw Claudenw requested a review from ottlinger June 28, 2026 07:14
@Claudenw Claudenw self-assigned this Jun 28, 2026
@ottlinger

ottlinger commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

@Claudenw not sure if my change changed the semantics (computeIfPresent) .... I stumbled into this change when I saw some NPE warnings within ClaimValidator. WDYT? Is the assertion that setting a max value sets a min value implicitly?

Not sure if you can imagine a test that runs into the remaining NPEs or if the issue is theoretical only ;)

Thanks

Comment thread apache-rat-core/src/main/java/org/apache/rat/config/results/ClaimValidator.java Outdated
@Claudenw Claudenw marked this pull request as draft June 28, 2026 21:32
@Claudenw Claudenw marked this pull request as ready for review June 29, 2026 06:58
@Claudenw

Copy link
Copy Markdown
Contributor Author

@ottlinger please review and merge if you see fit.

return v; });
min.compute(counter, (k, v) -> {
min.computeIfPresent(counter, (k, v) -> {
if (v.intValue() > maxValue.intValue()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Claudenw the IDE marks this line as possible NPE for maxValue.intValue due to the computerIfPresent before.

@Claudenw Claudenw requested a review from ottlinger June 30, 2026 07:37

@ottlinger ottlinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM - thanks for fixing the possibleNPE-related things

@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@ottlinger ottlinger merged commit 26d9c95 into master Jul 1, 2026
27 checks passed
@ottlinger ottlinger deleted the remove-boxing branch July 1, 2026 11:21
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