typetools / typetools/checker-framework
Correct location and format of flow expression parse errors
Open
Nobody has claimed this yet.
enhancement
JavaExpressions
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
Take this example:
import org.checkerframework.checker.nullness.qual.*;
class ExpressionParse {
@RequiresNonNull("kdfj")
@EnsuresNonNull("skdfj")
void bar() {}
}
Running the Nullness Checker gives:
ExpressionParse.java:6: error: [flowexpr.parse.error] cannot parse the expression 'kdfj: identifier not found'
void bar() {}
^
ExpressionParse.java:6: error: [flowexpr.parse.error] cannot parse the expression 'kdfj: identifier not found'
void bar() {}
^
ExpressionParse.java:6: error: [flowexpr.parse.error] cannot parse the expression 'skdfj: identifier not found'
void bar() {}
^
3 errors
(The duplicate pre-condition error is being tracked as https://github.com/typetools/checker-framework/issues/1051)
Some possible improvements:
- It would be useful if the error message were on the line where the invalid String is and not always on the method declaration.
- It might also be useful to output more context, e.g. within which annotation the expression was.
- The message is rather confusingly presented: the code didn't try to parse
skdfj: identifier not found; it tried to parseskdfjand that failed because that identifier wasn't found.
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 example with the Nullness Checker and the @RequiresNonNull and @EnsuresNonNull annotations shown in ExpressionParse.java. Trace how the flow expression parse error is reported, then define completion as reporting the error at the invalid String, including useful annotation context, and presenting the failed expression and cause clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100