I was creating a check similar to UnusedLocalVariable and am stuck on identifying the scope of pattern variable, I checked the code of UnusedLocalVariable in but couldn’t find the logic sonar-
If anyone could point the file where scope recognition is done, it would be great.
Edit-
By scope resolution I mean-
if(o instanceof String s1) {
// s1 can be accessed over here.
}
if(!(o instanceof String s1)) {
// s1 cannot be accessed over here.
}
else {
// s1 can be accessed over here.
}
I couldn’t find the logic corresponding to scope resolution.