File tree Expand file tree Collapse file tree 4 files changed +15
-2
lines changed
main/java/com/google/googlejavaformat
test/resources/com/google/googlejavaformat/java/testdata Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -266,9 +266,15 @@ public final void close() {
266266
267267 /** Return the text of the next {@link Input.Token}, or absent if there is none. */
268268 public final Optional <String > peekToken () {
269+ return peekToken (0 );
270+ }
271+
272+ /** Return the text of an upcoming {@link Input.Token}, or absent if there is none. */
273+ public final Optional <String > peekToken (int skip ) {
269274 ImmutableList <? extends Input .Token > tokens = input .getTokens ();
270- return tokenI < tokens .size ()
271- ? Optional .of (tokens .get (tokenI ).getTok ().getOriginalText ())
275+ int idx = tokenI + skip ;
276+ return idx < tokens .size ()
277+ ? Optional .of (tokens .get (idx ).getTok ().getOriginalText ())
272278 : Optional .absent ();
273279 }
274280
Original file line number Diff line number Diff line change @@ -3324,6 +3324,9 @@ private void maybeAddDims(
33243324 lastWasAnnotation = false ;
33253325 break ;
33263326 case "." :
3327+ if (!builder .peekToken ().get ().equals ("." ) || !builder .peekToken (1 ).get ().equals ("." )) {
3328+ return ;
3329+ }
33273330 if (lastWasAnnotation ) {
33283331 builder .breakToFill (" " );
33293332 } else {
Original file line number Diff line number Diff line change @@ -6,4 +6,6 @@ public class ArrayVsVarargs {
66 void i(String @B... arg) {}
77 void j(String @C [] @D [] arg) {}
88 void k(String @E [] @F... arg) {}
9+
10+ Class<?> c = byte[].class;
911}
Original file line number Diff line number Diff line change @@ -11,4 +11,6 @@ public class ArrayVsVarargs {
1111 void j(String @C [] @D [] arg) {}
1212
1313 void k(String @E [] @F ... arg) {}
14+
15+ Class<?> c = byte[].class;
1416}
You can’t perform that action at this time.
0 commit comments