File tree Expand file tree Collapse file tree
service/processor/src/main/java/com/google/auto/service/processor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 */
1616package com .google .auto .service .processor ;
1717
18- import static com . google . common . base . Charsets .UTF_8 ;
18+ import static java . nio . charset . StandardCharsets .UTF_8 ;
1919
20- import com .google .common .io .Closer ;
2120import java .io .BufferedReader ;
2221import java .io .BufferedWriter ;
2322import java .io .IOException ;
@@ -57,12 +56,9 @@ static String getPath(String serviceName) {
5756 */
5857 static Set <String > readServiceFile (InputStream input ) throws IOException {
5958 HashSet <String > serviceClasses = new HashSet <String >();
60- Closer closer = Closer .create ();
61- try {
62- // TODO(gak): use CharStreams
63- BufferedReader r = closer .register (new BufferedReader (new InputStreamReader (input , UTF_8 )));
59+ try (BufferedReader reader = new BufferedReader (new InputStreamReader (input , UTF_8 ))) {
6460 String line ;
65- while ((line = r .readLine ()) != null ) {
61+ while ((line = reader .readLine ()) != null ) {
6662 int commentStart = line .indexOf ('#' );
6763 if (commentStart >= 0 ) {
6864 line = line .substring (0 , commentStart );
@@ -73,10 +69,6 @@ static Set<String> readServiceFile(InputStream input) throws IOException {
7369 }
7470 }
7571 return serviceClasses ;
76- } catch (Throwable t ) {
77- throw closer .rethrow (t );
78- } finally {
79- closer .close ();
8072 }
8173 }
8274
You can’t perform that action at this time.
0 commit comments