Closed rovo98 closed 5 months ago
When the showResult=true and logging is enabled, CodeCompletionCore will print some information after finishing collectionCandidates. According to the current code implementation,
showResult=true
CodeCompletionCore
https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L218-L228
this might occurs NPE at the line 221 since the collected candidates.tokens might contains null values which come from the collected followingSets.
candidates.tokens
null
https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L337-L343
https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L361-L365
The above followingSet which contains null following might be put into the candidates.tokens:
following
https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L456
I'm willing to draft a pr to fix this issue. 😊
Great! Let's continue in the PR.
Description
When the
showResult=true
and logging is enabled,CodeCompletionCore
will print some information after finishing collectionCandidates. According to the current code implementation,https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L218-L228
this might occurs NPE at the line 221 since the collected
candidates.tokens
might containsnull
values which come from the collected followingSets.https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L337-L343
https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L361-L365
The above followingSet which contains null
following
might be put into thecandidates.tokens
:https://github.com/mike-lischke/antlr4-c3/blob/60f62a4f4e39644280c8b666394bd8cf3cebb348/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java#L456
I'm willing to draft a pr to fix this issue. 😊