4.3.0: BitSet.clear() fails with flowexpr.parse.index.too.big — @SideEffectsOnly("#1") on a no-arg method
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- testing-qa
Research direction
The issue identifies the three clear overloads in annotated-jdk/src/java.base/share/classes/java/util/BitSet.java and provides a reproducer. Read the @SideEffectsOnly annotations and run the supplied Nullness Checker command with the 4.3.0 jars. Done when the no-arg reproducer no longer reports the parameter-index error and the other overloads' annotations reflect receiver mutation.
Written by the indexing model from the issue text.
Description
Problem
Since 4.3.0, any call to the no-arg BitSet.clear() fails the Nullness Checker:
Repro.java:5: error: [flowexpr.parse.index.too.big] the method has no parameter #1 (total 0 parameters)
bits.clear();
^
It worked on 4.2.2.
Reproduce
import java.util.BitSet;
class Repro {
void reset(BitSet bits) {
bits.clear();
}
}
javac -proc:only \
-cp checker-qual-4.3.0.jar \
-processorpath checker-4.3.0.jar:checker-qual-4.3.0.jar \
-processor org.checkerframework.checker.nullness.NullnessChecker \
Repro.java
With 4.2.2 jars: no errors. With 4.3.0 jars: the error above.
JDK: 21.0.3.
Cause
4.3.0 added @SideEffectsOnly("#1") to all three clear overloads in annotated-jdk/src/java.base/share/classes/java/util/BitSet.java:
@SideEffectsOnly("#1")
public void clear(@GuardSatisfied BitSet this, @NonNegative int bitIndex);
@SideEffectsOnly("#1")
public void clear(@GuardSatisfied BitSet this, @NonNegative int fromIndex, @NonNegative int toIndex);
@SideEffectsOnly("#1")
public void clear(@GuardSatisfied BitSet this);
On clear(), #1 doesn't exist, which causes the error. On the other two overloads, #1 is an int index, but the method mutates the receiver. So "this" looks like the intended value for all three:
@SideEffectsOnly("this")
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 154
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from typetools/checker-framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
typetools/checker-framework#8043 ·
Maintainers usually reply within 1 day
-
Enforce `@TargetLocations`Possibly taken @w3lld1 claimed this 34 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
typetools/checker-framework#8042 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
typetools/checker-framework#7096 · 1 comment ·
Maintainers usually reply within 1 day
-
Inference crashes on a chained call whose lambda returns a capture of an F-bounded type argumentPossibly taken @smillst claimed this 1 day ago. Opencrash
typetools/checker-framework#8323 · 1 assignee ·
Maintainers usually reply within 1 day
-
Index Checker crash: "Cannot be negated: a class java.lang.Character" on (char) ('a' + i)Possibly taken @mernst claimed this 2 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
typetools/checker-framework#8320 ·
Maintainers usually reply within 1 day
All issues in typetools/checker-framework
Similar issues
-
waiting-for-triage
Difficulty 1/5 Under an hour Newbie friendliness 72/100
spring-cloud/spring-cloud-openfeign#1443 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
ADORSYS-GIS/keycloak-oid4vp-plugin#221 ·
Maintainers usually reply within 2 days
-
status: team-only type: dependency-upgrade
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
spring-projects/spring-boot#52099 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
tchiotludo/akhq#3307 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/jeo-maven-plugin#1885 ·
Maintainers usually reply within 4 days