Used version
rewrite-java 8.56.1
The gist
Object @Nullable ... other is interpreted as Object @Nullable[] ... other
while e.g. the following is interpreted correctly:
Object @Nullable[] ... other
Object ... other
Issue fully replicated in test:
package de.domagoj.or.test;
import static org.openrewrite.java.Assertions.java;
import org.junit.jupiter.api.Test;
import org.openrewrite.java.JavaParser;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
public class MyTest implements RewriteTest {
@Test
void shouldParse() {
rewriteRun(
java(
"""
package de.domagoj.or.test.example;
import static java.lang.annotation.ElementType.TYPE_USE;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
public interface Itf {
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ TYPE_USE })
public @interface NonNull {
}
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ TYPE_USE })
public @interface Nullable {
}
@NonNull
Object exampleMethod(@NonNull Object @Nullable ... other);
}
"""
)
);
}
}
Used version
rewrite-java 8.56.1
The gist
Object @Nullable ... otheris interpreted asObject @Nullable[] ... otherwhile e.g. the following is interpreted correctly:
Object @Nullable[] ... otherObject ... otherIssue fully replicated in test: