Skip to content

Commit

Permalink
Replace usages of @deprecated methods in com.google.common.io.Files w…
Browse files Browse the repository at this point in the history
…ith non-deprecated replacements.

	Change on 2018/11/28 by glorioso <glorioso@google.com>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=223180609
  • Loading branch information
nick-someone authored and antonio-cortes-perez committed Dec 12, 2018
1 parent 6efe926 commit 5395b1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ private File stripIncompatible(
String relativePath = qualifiedName.replace('.', File.separatorChar) + ".java";
File strippedFile = new File(strippedDir, relativePath);
Files.createParentDirs(strippedFile);
Files.write(parseResult.getSource(), strippedFile, Charset.forName(options.fileEncoding()));
Files.asCharSink(strippedFile, Charset.forName(options.fileEncoding()))
.write(parseResult.getSource());
sourceFileNames.set(i, strippedFile.getPath());
}
return strippedDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,14 @@ private void findCycles() throws IOException {
Options options = new Options();
if (!whitelistEntries.isEmpty()) {
File whitelistFile = new File(tempDir, "whitelist");
Files.write(Joiner.on("\n").join(whitelistEntries), whitelistFile, Charset.defaultCharset());
Files.asCharSink(whitelistFile, Charset.defaultCharset())
.write(Joiner.on("\n").join(whitelistEntries));
options.addWhitelistFile(whitelistFile.getAbsolutePath());
}
if (!blacklistEntries.isEmpty()) {
File blacklistFile = new File(tempDir, "type_filter");
Files.write(Joiner.on("\n").join(blacklistEntries), blacklistFile, Charset.defaultCharset());
Files.asCharSink(blacklistFile, Charset.defaultCharset())
.write(Joiner.on("\n").join(blacklistEntries));
options.addBlacklistFile(blacklistFile.getAbsolutePath());
}
options.setSourceFiles(inputFiles);
Expand All @@ -472,7 +474,7 @@ private void findCycles() throws IOException {
private void addSourceFile(String fileName, String source) throws IOException {
File file = new File(tempDir, fileName);
file.getParentFile().mkdirs();
Files.write(source, file, Charset.defaultCharset());
Files.asCharSink(file, Charset.defaultCharset()).write(source);
inputFiles.add(file.getAbsolutePath());
}

Expand Down

0 comments on commit 5395b1d

Please sign in to comment.