typetools / typetools/checker-framework
charAt LowerBound Unknown
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
charAt should return a non-negative char. Consider the following test case:
class CharAtTest {
@NonNegative char test1(@MinLen(1) String s) {
return s.charAt(0);
}
}
Output:
CharAtTest.java:6: error: [return.type.incompatible] incompatible types in return.
return s.charAt(0);
^
type of expression: @LowerBoundUnknown char
method return type: @NonNegative char
1 error
Expected: No errors
I'll be working on fixing this issue.
Contributor guide
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.
Research direction
Start by reproducing the CharAtTest example using String.charAt(0) with the @NonNegative return type. Investigate the checker behavior that assigns @LowerBoundUnknown to charAt, then verify that the example compiles without errors and preserves the expected non-negative typing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100