Skip to content

Commit

Permalink
Don't leak file managers
Browse files Browse the repository at this point in the history
--
PiperOrigin-RevId: 148860690
MOS_MIGRATED_REVID=148860690
  • Loading branch information
cushon authored and hermione521 committed Mar 1, 2017
1 parent b869e58 commit dc857b3
Showing 1 changed file with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,22 @@ public static BlazeJavacResult compile(BlazeJavacArguments arguments) {
Listener diagnostics = new Listener(context);
BlazeJavaCompiler compiler;

JavacFileManager fileManager = new ClassloaderMaskingFileManager();
JavacTask task =
JavacTool.create()
.getTask(
errWriter,
fileManager,
diagnostics,
javacArguments,
ImmutableList.of() /*classes*/,
fileManager.getJavaFileObjectsFromPaths(arguments.sourceFiles()),
context);
if (arguments.processors() != null) {
task.setProcessors(arguments.processors());
}
fileManager.setContext(context);
setLocations(fileManager, arguments);
try {
try (JavacFileManager fileManager = new ClassloaderMaskingFileManager()) {
JavacTask task =
JavacTool.create()
.getTask(
errWriter,
fileManager,
diagnostics,
javacArguments,
ImmutableList.of() /*classes*/,
fileManager.getJavaFileObjectsFromPaths(arguments.sourceFiles()),
context);
if (arguments.processors() != null) {
task.setProcessors(arguments.processors());
}
fileManager.setContext(context);
setLocations(fileManager, arguments);
try {
ok = task.call();
} catch (PropagatedException e) {
Expand Down

0 comments on commit dc857b3

Please sign in to comment.