Skip to content

Commit

Permalink
Add the SSTable to the CIRV stats collector.
Browse files Browse the repository at this point in the history
Tested with a local run: https://screenshot.googleplex.com/BKMXArP7HX9ooGD

PiperOrigin-RevId: 464626829
  • Loading branch information
nick-someone authored and Error Prone Team committed Aug 1, 2022
1 parent 173b0ed commit 9449d38
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import com.sun.tools.javac.util.List;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.stream.Stream;
Expand Down Expand Up @@ -92,26 +91,25 @@ interface MethodPredicate {
enum ConfigParser {
AS_STRINGS {
@Override
MethodPredicate load(Path file) throws IOException {
return configByInterpretingMethodsAsStrings(MoreFiles.asCharSource(file, UTF_8));
MethodPredicate load(String file, ErrorProneFlags flags) throws IOException {
return configByInterpretingMethodsAsStrings(MoreFiles.asCharSource(Paths.get(file), UTF_8));
}
},
PARSE_TOKENS {
@Override
MethodPredicate load(Path file) throws IOException {
return configByParsingApiObjects(MoreFiles.asCharSource(file, UTF_8));
MethodPredicate load(String file, ErrorProneFlags flags) throws IOException {
return configByParsingApiObjects(MoreFiles.asCharSource(Paths.get(file), UTF_8));
}
};

abstract MethodPredicate load(Path file) throws IOException;
abstract MethodPredicate load(String file, ErrorProneFlags flags) throws IOException;
}

private static MethodPredicate loadConfigListFromFile(String filename, ErrorProneFlags flags) {
ConfigParser configParser =
flags.getEnum(EXCLUSION_LIST_PARSER, ConfigParser.class).orElse(ConfigParser.AS_STRINGS);
try {
Path file = Paths.get(filename);
return configParser.load(file);
return configParser.load(filename, flags);
} catch (IOException e) {
throw new UncheckedIOException(
"Could not load external resource for CanIgnoreReturnValue", e);
Expand Down

0 comments on commit 9449d38

Please sign in to comment.