Accept a type annotation on the qualifier of a method reference - #66
Merged
Merged
Conversation
"Supplier<List<?>> a = @A ArrayList::new;" failed with 'did not generate token "@"'. The printing of a type annotation on a method reference's qualifier was already in place, but visitMemberReference first synced to the tree's start position, and javac's start position for a member reference leaves out the annotation, so the sync reported the annotation's tokens as never generated. This ports google/google-java-format#984 by Liam Miller-Cushon: visitMemberReference no longer syncs to the start position. The golden B308157568 comes from upstream, with the expected output in this project's style. The 15,747 files of the JDK 21 sources format exactly as before.
This file contains hidden or 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
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.
Brings over google/google-java-format#984, a fix from google-java-format 1.19.
The bug
Supplier<List<?>> a = @A ArrayList::new;failed witherror: did not generate token "@". The printing of a type annotation on a method reference's qualifier was already in place, butvisitMemberReferencefirst synced to the tree's start position, and javac's start position for a member reference leaves out the annotation, so the sync reported the annotation's tokens as never generated.From upstream, with the author kept
visitMemberReferenceno longer syncs to the start position. The upstream goldenB308157568comes with it; it covers a type annotation in every other position too, with the expected output in this project's style.Checked
::exactly as before../gradlew :open-java-format:teston JDK 21: 1501 tests, all green.