AST visitors in Semantic API internal implementation throws NPEs and need to Handle them explicitly #28002
nadeeshaan
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the current implementation of the semantic API, we use tree visitors to visit the AST and extract symbols. For an example,
ReferenceFinder
. When there are semantically invalid scenarios such as we have been added an unresolved import and when there are usages of that, Semantic API fails even for symbol extraction for the valid symbols as well. We need to check these cases properly. One such usage ishttps://github.com/ballerina-platform/ballerina-lang/blob/master/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ReferenceFinder.java#L972
Here
userDefinedType.type.tsymbol
is null.@pubudu91 thoughts? What's the possibility of handle these in a common place?
As a temp fix we can skip them with a null check. But cannot guarantee that we cover all the cases gracefully
Beta Was this translation helpful? Give feedback.
All reactions