Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<K, V> {
@Nullable
public Map.Entry<K, V> entry() {
return null;
}
}
""",
"""
import org.jspecify.annotations.Nullable;

import java.util.Map;

class Test<K, V> {
public Map.@Nullable Entry<K, V> entry() {
return null;
}
}
"""
)
);
}

@Test
void dontTouchArguments() {
rewriteRun(
Expand Down
Loading