Skip to content

Commit 2a348f7

Browse files
authored
Eclipse compiler: close the StandardJavaFileManager (#103)
Compare #98.
1 parent 79d7aa6 commit 2a348f7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,19 +400,16 @@ public void report( Diagnostic<? extends JavaFileObject> diagnostic )
400400
{
401401
charset = Charset.defaultCharset();
402402
}
403-
StandardJavaFileManager manager =
404-
compiler.getStandardFileManager( messageCollector, defaultLocale, charset );
405-
406403
if ( getLogger().isDebugEnabled() )
407404
{
408405
getLogger().debug( "ecj: using character set " + charset.displayName() );
409406
getLogger().debug( "ecj command line: " + args );
410407
getLogger().debug( "ecj input source files: " + allSources );
411408
}
412409

413-
Iterable<? extends JavaFileObject> units = manager.getJavaFileObjectsFromStrings( allSources );
414-
try
415-
{
410+
try ( StandardJavaFileManager manager =
411+
compiler.getStandardFileManager( messageCollector, defaultLocale, charset ) ) {
412+
Iterable<? extends JavaFileObject> units = manager.getJavaFileObjectsFromStrings( allSources );
416413
success = Boolean.TRUE.equals(
417414
compiler.getTask( devNull, manager, messageCollector, args, null, units ).call() );
418415
}

0 commit comments

Comments
 (0)