Review of Nullness Checker#1706
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refines implementation details of the Nullness Checker (NoInit variant), primarily by reducing repeated work in type/annotation scanning and simplifying some receiver-handling logic during method invocability checks.
Changes:
- Simplifies receiver processing in
NullnessNoInitVisitor.checkMethodInvocability. - Reuses a stateful
AnnotatedTypeScannerinNullnessNoInitTransferto reduce allocations. - Optimizes nullness-annotation detection in
NullnessNoInitAnnotatedTypeFactoryby canonicalizing aliases once. - Minor refactor to reduce repeated
getTypeArguments()calls inCollectionToArrayHeuristics.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| checker/src/main/java/org/checkerframework/checker/nullness/NullnessNoInitVisitor.java | Simplifies receiver annotation extraction during method invocability checks. |
| checker/src/main/java/org/checkerframework/checker/nullness/NullnessNoInitTransfer.java | Introduces reusable scanner instance and resets it per visit to avoid repeated allocations. |
| checker/src/main/java/org/checkerframework/checker/nullness/NullnessNoInitAnnotatedTypeFactory.java | Canonicalizes annotation aliases once before checking canonical nullness qualifier names. |
| checker/src/main/java/org/checkerframework/checker/nullness/CollectionToArrayHeuristics.java | Small readability refactor by caching type arguments list locally. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private boolean containsPolyNullNotAtTopLevel(AnnotatedTypeMirror t) { | ||
| return new ContainsPolyNullNotAtTopLevelScanner().visit(t); | ||
| // The scanner is stateful (isTopLevel and visitedNodes); reset before reuse. | ||
| polyNullScanner.isTopLevel = true; | ||
| polyNullScanner.reset(); | ||
| return polyNullScanner.visit(t); |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Implemented in 5559ab0. I moved isTopLevel reset into ContainsPolyNullNotAtTopLevelScanner.reset() (calling super.reset()), and removed the explicit polyNullScanner.reset()/state reset in containsPolyNullNotAtTopLevel, so visit(...) performs a single reset per call.
Agent-Logs-Url: https://github.com/eisop/checker-framework/sessions/e93436b1-54c2-4366-bfb6-73ce26d7d139 Co-authored-by: wmdietl <6699136+wmdietl@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
No description provided.