Skip to content

Use effective annotations for type-variable operands in the Units and Value Checkers - #8349

Merged
smillst merged 5 commits into
typetools:masterfrom
smillst:typevar-effective-annotations
Oct 13, 2026
Merged

smillst merged 5 commits into
typetools:masterfrom
smillst:typevar-effective-annotations

Conversation

@smillst

@smillst smillst commented Oct 13, 2026

Copy link
Copy Markdown
Member

These changes are pulled from #8329

… Value checkers

The Units Checker's compound-assignment check and the Value Checker's array-dimension
refinement read the primary annotation of the operand's type.  When the operand's type is a
type variable, such as `T extends Integer`, there is no primary annotation: the Units Checker
issued a false-positive compound.assignment error, and the Value Checker crashed with a
BugInCF.  Use the effective annotation (the upper bound's) instead.
smillst added a commit to msridhar/checker-framework that referenced this pull request Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: typetools/checker-framework/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 960cd112-f5ab-42f2-bf16-760d43f113d5
📥 Commits

Reviewing files that changed from the base of the PR and between 7349bc4 and 3f07b25.

📒 Files selected for processing (1)
  • framework/src/main/java/org/checkerframework/common/value/ValueTreeAnnotator.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The Units checker now detects UnknownUnits anywhere in an expression’s annotations when checking non-addition and non-subtraction compound assignments. Value analysis now retrieves array-dimension annotations from the UNKNOWNVAL hierarchy and uses primitive parameter types when retrieving argument values for statically executable method calls. New tests cover generic compound assignments, array dimensions with exact or ranged values, and boxed increments and decrements.

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 3f07b

The reviewed changes have no established merge-blocking issue, so the PR appears ready to merge after normal checks.

Security architecture risk: 🔵 Low · up to 7349b

The change improves evaluation of methods already opted into compile-time execution without removing existing execution checks. No introduced security issue was established, but coverage limitations prevent a comprehensive assurance.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Primitive conversion can make additional call sites successfully execute methods already eligible for compile-time evaluation. The effective exposure remains execution inside the checker JVM; no new method eligibility, process authority, or independently attackable service scope was established.

Trust Boundaries and Controls

  • observed — The evaluator resolves the compiler-selected declaration's class and formal parameter classes, then invokes the reflective method. Class loading, accessibility adjustment, and invocation are unchanged from the PR base. The annotation gate is an execution opt-in, not an independent sandbox or authorization boundary.
Pre-merge checks · Passed 2 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (2 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The synthetic Byte.valueOf call that boxes the result of `b++` on a Byte has the `b + 1` tree,
of type int, as its argument.  The Value Checker passed the argument's values as Integers, so
evaluating Byte.valueOf(byte) by reflection failed with an argument type mismatch.
smillst added a commit to msridhar/checker-framework that referenced this pull request Oct 13, 2026
@smillst
smillst merged commit f049382 into typetools:master Oct 13, 2026
29 checks passed
@smillst
smillst deleted the typevar-effective-annotations branch October 13, 2026 21:29
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.

1 participant