-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser does not handle annotated varargs correctly #4628
Draft
Laurens-W
wants to merge
17
commits into
main
Choose a base branch
from
annotated-varargs-issue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+86
−16
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Laurens-W
commented
Oct 31, 2024
rewrite-java/src/main/java/org/openrewrite/java/JavaPrinter.java
Outdated
Show resolved
Hide resolved
As a sanity check, I suggest looking at a few things:
|
Thanks for the helpful counter example @traceyyoshima ! That indeed still fails; when I revert the printer changes I see: diff --git a/C2.java b/C2.java
index 2b026e1..326aa32 100644
--- a/C2.java
+++ b/C2.java
@@ -1,6 +1,6 @@
import org.jspecify.annotations.NonNull;
class C2 {
- void m(@NonNull String @NonNull ... varArgs) {
+ void m(@NonNull String @NonNull[] ... varArgs) {
}
} diff --git a/C3.java b/C3.java
index 108e4b9..389aba9 100644
--- a/C3.java
+++ b/C3.java
@@ -1,6 +1,6 @@
import org.jspecify.annotations.NonNull;
class C3 {
- void m(String @NonNull [ ] @NonNull ... s) {
+ void m(String @NonNull [ ] ... s) {
}
} |
Laurens-W
commented
Nov 13, 2024
rewrite-java/src/main/java/org/openrewrite/java/JavaPrinter.java
Outdated
Show resolved
Hide resolved
rewrite-java-17/src/main/java/org/openrewrite/java/isolated/ReloadableJava17ParserVisitor.java
Outdated
Show resolved
Hide resolved
Saving others a click: javaTypesFromJsonCreatorConstructor() diff --git a/Test.java b/Test.java
index 5b8c2a6..edbc80e 100644
--- a/Test.java
+++ b/Test.java
@@ -1,5 +1,5 @@
class Test {
Integer[ ] n1 = new Integer[0];
Integer[] [ ] n2 = new Integer[0][0];
- Integer[][] [ ] n3 = new Integer[0][0][0];
+ Integer[] [ ][] n3 = new Integer[0][0][0];
}
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's changed?
Added reproducer testcase
What's your motivation?
Checklist