diff --git a/src/test/java/org/openrewrite/staticanalysis/NullableOnMethodReturnTypeTest.java b/src/test/java/org/openrewrite/staticanalysis/NullableOnMethodReturnTypeTest.java index 5eba00501..d87eab43a 100644 --- a/src/test/java/org/openrewrite/staticanalysis/NullableOnMethodReturnTypeTest.java +++ b/src/test/java/org/openrewrite/staticanalysis/NullableOnMethodReturnTypeTest.java @@ -16,6 +16,7 @@ package org.openrewrite.staticanalysis; import org.junit.jupiter.api.Test; +import org.junitpioneer.jupiter.ExpectedToFail; import org.openrewrite.DocumentExample; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; @@ -96,6 +97,39 @@ public class Foo { ); } + @ExpectedToFail("Annotation is placed before the qualified name, producing `@Nullable Map.Entry` which javac rejects") + @Test + void moveNullableToNestedTypeSimpleName() { + rewriteRun( + //language=java + java( + """ + import org.jspecify.annotations.Nullable; + + import java.util.Map; + + class Test { + @Nullable + public Map.Entry entry() { + return null; + } + } + """, + """ + import org.jspecify.annotations.Nullable; + + import java.util.Map; + + class Test { + public Map.@Nullable Entry entry() { + return null; + } + } + """ + ) + ); + } + @Test void dontTouchArguments() { rewriteRun(