Skip to content

Parser: not idempotent on annotated varargs #3881

@Bananeweizen

Description

@Bananeweizen

What version of OpenRewrite are you using?

I am using

  • Maven/Gradle plugin v5.17.1

What is the smallest, simplest way to reproduce the problem?

class ParserError {
    private String method(@NonNull final String @NonNull... args) {
        return "";
    }
}

What is the full stack trace of any errors you encountered?

java.lang.IllegalStateException: ParserError.java is not print idempotent.
(several lines removed)
-    private String method(@NonNull final String @NonNull... args) {
+    private String method(@NonNull final String[] @NonNull... args) {
         return "";
     }
 
  org.openrewrite.Parser.requirePrintEqualsInput(Parser.java:52)

The NonNull is from org.eclipse.jdt.annotations, but that should work for any type annotation which can be applied to arrays and types. When a normal array is used instead of the varargs, the parser doesn't produce an error.

Are you interested in contributing a fix to OpenRewrite?

probably not, I only feel confident in the recipes area, not the parser

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions