@@ -248,7 +248,7 @@ private record VariableScope(CtVariable<?> variable, CtElement element) implemen
248248 // the parent `CtBinaryOperator`, the variables introduced by the branch `CtExpression b` will become relevant too.
249249 //
250250 // The function below can be used to explore the variables introduced by that unexplored branch `CtExpression b`.
251- private static List <Scope > exploreBranchForNewScopes (CtQueryable branch ) {
251+ private static List <Scope > exploreBranchForNewScopes (@ NonNull CtQueryable branch ) {
252252 List <Scope > result = new ArrayList <>();
253253
254254 // Where pattern variables apply changes depending on their parents (e.g. !(< pattern >) will change the matches),
@@ -306,14 +306,14 @@ private static List<Scope> exploreBranchForNewScopes(CtQueryable branch) {
306306 }
307307
308308 @ SuppressWarnings ("unchecked" )
309- private static List <PatternScope > exploreBranchForNewPatternScopes (CtExpression <?> branch ) {
309+ private static List <PatternScope > exploreBranchForNewPatternScopes (@ NonNull CtExpression <?> branch ) {
310310 // SAFETY: In an expression only PatternScope can appear
311311 // -> the returns of exploreBranchForNewScopes is guaranteed to be a list of PatternScope
312312 return (List <PatternScope >) (List <?>) exploreBranchForNewScopes (branch );
313313 }
314314
315315 @ SuppressWarnings ("unchecked" )
316- private static List <PatternScope > exploreBranchForNewPatternScopes (CtPattern branch ) {
316+ private static List <PatternScope > exploreBranchForNewPatternScopes (@ NonNull CtPattern branch ) {
317317 // SAFETY: In a pattern only PatternScope can appear
318318 // -> the returns of exploreBranchForNewScopes is guaranteed to be a list of PatternScope
319319 return (List <PatternScope >) (List <?>) exploreBranchForNewScopes (branch );
@@ -577,7 +577,7 @@ private static List<Scope> updatePatternScopesForParent(Collection<PatternScope>
577577 return result ;
578578 }
579579
580- if (parent instanceof CtFor ctFor ) {
580+ if (parent instanceof CtFor ctFor && ctFor . getExpression () != null ) {
581581 List <Scope > result = new ArrayList <>();
582582
583583 // The following rules apply to a basic for statement (§14.14.1):
0 commit comments