Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Commit d7dcb2d

Browse files
refactor: Annotate methods which may return null with @Nullable
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.staticanalysis.AnnotateNullableMethods?organizationId=ODQ2MGExMTUtNDg0My00N2EwLTgzMGMtNGE1NGExMTBmZDkw Co-authored-by: Moderne <team@moderne.io>
1 parent 09874cc commit d7dcb2d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rewrite-python/src/main/java/org/openrewrite/python/PythonVisitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public J visitSlice(Py.Slice slice, P p) {
480480
return slice;
481481
}
482482

483-
public <J2 extends J> JContainer<J2> visitContainer(@Nullable JContainer<J2> container,
483+
public <J2 extends J> @Nullable JContainer<J2> visitContainer(@Nullable JContainer<J2> container,
484484
PyContainer.Location loc, P p) {
485485
if (container == null) {
486486
//noinspection ConstantConditions
@@ -498,7 +498,7 @@ public <J2 extends J> JContainer<J2> visitContainer(@Nullable JContainer<J2> con
498498
JContainer.build(before, js, container.getMarkers());
499499
}
500500

501-
public <T> JLeftPadded<T> visitLeftPadded(@Nullable JLeftPadded<T> left, PyLeftPadded.Location loc, P p) {
501+
public <T> @Nullable JLeftPadded<T> visitLeftPadded(@Nullable JLeftPadded<T> left, PyLeftPadded.Location loc, P p) {
502502
if (left == null) {
503503
//noinspection ConstantConditions
504504
return null;
@@ -527,7 +527,7 @@ public <T> JLeftPadded<T> visitLeftPadded(@Nullable JLeftPadded<T> left, PyLeftP
527527
return (before == left.getBefore() && t == left.getElement()) ? left : new JLeftPadded<>(before, t, left.getMarkers());
528528
}
529529

530-
public <T> JRightPadded<T> visitRightPadded(@Nullable JRightPadded<T> right, PyRightPadded.Location loc, P p) {
530+
public <T> @Nullable JRightPadded<T> visitRightPadded(@Nullable JRightPadded<T> right, PyRightPadded.Location loc, P p) {
531531
if (right == null) {
532532
//noinspection ConstantConditions
533533
return null;

0 commit comments

Comments
 (0)