File tree 2 files changed +25
-0
lines changed
main/java/com/google/googlejavaformat/java
test/java/com/google/googlejavaformat/java
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -346,6 +346,10 @@ private ImportsAndIndex scanImports(int i) throws FormatterException {
346
346
i ++;
347
347
}
348
348
}
349
+ while (tokenAt (i ).equals (";" )) {
350
+ // Extra semicolons are not allowed by the JLS but are accepted by javac.
351
+ i ++;
352
+ }
349
353
imports .add (new Import (importedName , trailing .toString (), isStatic ));
350
354
// Remember the position just after the import we just saw, before skipping blank lines.
351
355
// If the next thing after the blank lines is not another import then we don't want to
Original file line number Diff line number Diff line change @@ -800,6 +800,27 @@ public static Collection<Object[]> parameters() {
800
800
"public class Blim {}" ,
801
801
},
802
802
},
803
+ {
804
+ {
805
+ "package p;" ,
806
+ "" ,
807
+ "import java.lang.Bar;" ,
808
+ "import java.lang.Baz;" ,
809
+ ";" ,
810
+ "import java.lang.Foo;" ,
811
+ "" ,
812
+ "interface Test {}" ,
813
+ },
814
+ {
815
+ "package p;" ,
816
+ "" ,
817
+ "import java.lang.Bar;" ,
818
+ "import java.lang.Baz;" ,
819
+ "import java.lang.Foo;" ,
820
+ "" ,
821
+ "interface Test {}" ,
822
+ }
823
+ }
803
824
};
804
825
ImmutableList .Builder <Object []> builder = ImmutableList .builder ();
805
826
Arrays .stream (inputsOutputs ).forEach (input -> builder .add (createRow (input )));
You can’t perform that action at this time.
0 commit comments