File tree 1 file changed +5
-2
lines changed
src/main/java/org/openrewrite/staticanalysis 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -291,8 +291,11 @@ private boolean isFinalTrue(Expression condition) {
291
291
List <Statement > statements = ((J .Case ) value ).getStatements ();
292
292
declaration = finalVariableDeclaration (statements , id );
293
293
} else if (value instanceof J .MethodDeclaration ) {
294
- List <Statement > statements = ((J .MethodDeclaration ) value ).getBody ().getStatements ();
295
- declaration = finalVariableDeclaration (statements , id );
294
+ J .Block body = ((J .MethodDeclaration ) value ).getBody ();
295
+ if (body != null ) {
296
+ List <Statement > statements = body .getStatements ();
297
+ declaration = finalVariableDeclaration (statements , id );
298
+ }
296
299
} else if (value instanceof J .ClassDeclaration ) {
297
300
List <Statement > statements = ((J .ClassDeclaration ) value ).getBody ().getStatements ();
298
301
declaration = finalVariableDeclaration (statements , id );
You can’t perform that action at this time.
0 commit comments