File tree Expand file tree Collapse file tree
main/java/com/palantir/javaformat/java
test/resources/com/palantir/javaformat/java/testdata Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -928,7 +928,8 @@ public boolean visitEnumDeclaration(ClassTree node) {
928928
929929 @ Override
930930 public Void visitMemberReference (MemberReferenceTree node , Void unused ) {
931- sync (node );
931+ // No sync(node): javac's start position for a member reference leaves out a type annotation on its
932+ // qualifier ("@A ArrayList::new"), so syncing to it would report the annotation as never generated.
932933 builder .open (OpenOp .builder ()
933934 .plusIndent (plusFour )
934935 .debugName ("methodReference" )
Original file line number Diff line number Diff line change 1+ class C {
2+ @A(0x14)
3+ int f(Object o) {
4+ @A(0x40)
5+ int local;
6+ try (@A(0x41)
7+ JarFile jarFile = new JarFile("hello.jar")) {
8+ } catch (
9+ @A(0x42)
10+ IOException e) {
11+ }
12+ if (o instanceof @A(0x43) String) {}
13+ new @A(0x44) ArrayList<>();
14+ Supplier<List<?>> a = @A(0x45) ArrayList::new;
15+ Supplier<List<?>> b = @A(0x46) ImmutableList::of;
16+ String s = (@A(0x47) String) o;
17+ List<?> xs = new ArrayList<@A(0x48) String>();
18+ xs = ImmutableList.<@A(0x49) String>of();
19+ Supplier<List<?>> c = ArrayList<@A(0x4A) String>::new;
20+ Supplier<List<?>> d = ImmutableList::<@A(0x4B) String>of;
21+ return 0;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ class C {
2+ @A(0x14)
3+ int f(Object o) {
4+ @A(0x40)
5+ int local;
6+ try (@A(0x41)
7+ JarFile jarFile = new JarFile("hello.jar")) {
8+ } catch (
9+ @A(0x42)
10+ IOException e) {
11+ }
12+ if (o instanceof @A(0x43) String) {}
13+ new @A(0x44) ArrayList<>();
14+ Supplier<List<?>> a = @A(0x45) ArrayList::new;
15+ Supplier<List<?>> b = @A(0x46) ImmutableList::of;
16+ String s = (@A(0x47) String) o;
17+ List<?> xs = new ArrayList<@A(0x48) String>();
18+ xs = ImmutableList.<@A(0x49) String>of();
19+ Supplier<List<?>> c = ArrayList<@A(0x4A) String>::new;
20+ Supplier<List<?>> d = ImmutableList::<@A(0x4B) String>of;
21+ return 0;
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments