NullPointer in DefaultErrorStrategy when Using CommonToken with EMPTY_SOURCE
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
Line 589 in DefaultErrorStrategy gives a null pointer when I'm feeding a customly new'ed CommonToken that has the default source of EMPTY_SOURCE
new Pair<TokenSource, CharStream>(current.getTokenSource(), current.getTokenSource().getInputStream())
When getTokenSource returns null, an NPE happens here. The workaround is to make sure a CommonToken has a valid tokenSource...
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 in DefaultErrorStrategy at line 589 and trace the CommonToken path when its source is EMPTY_SOURCE. Reproduce the failure with a newly constructed CommonToken, then compare it with a token that has a valid tokenSource. Done means this scenario no longer raises a NullPointerException and the relevant Java runtime tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100