-
Bug
-
Resolution: Fixed
-
P4
-
9
-
b133
-
generic
-
generic
-
Not verified
This is in SourceCodeAnalysisImpl.java.
getStandardFileManager is defined to return a new instance each time it is called. Ideally, each such instance should be closed. This can be done by creating the file manager with try-with-resources,
public SourceCache(AnalyzeTask originalTask) {
this.originalTask = originalTask;
List<Path> sources = findSources();
if (sources.iterator().hasNext()) {
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
try {
fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, sources);
} catch (IOException ex) {
proc.debug(ex, "SourceCodeAnalysisImpl.SourceCache.<init>(...)");
fm = null;
}
this.fm = fm;
} else {
//don't waste time if there are no sources
this.fm = null;
}
}
- Jon
getStandardFileManager is defined to return a new instance each time it is called. Ideally, each such instance should be closed. This can be done by creating the file manager with try-with-resources,
public SourceCache(AnalyzeTask originalTask) {
this.originalTask = originalTask;
List<Path> sources = findSources();
if (sources.iterator().hasNext()) {
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
try {
fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, sources);
} catch (IOException ex) {
proc.debug(ex, "SourceCodeAnalysisImpl.SourceCache.<init>(...)");
fm = null;
}
this.fm = fm;
} else {
//don't waste time if there are no sources
this.fm = null;
}
}
- Jon