You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/09/14 00:44:51 UTC
groovy git commit: Revert "Groovyc did not correctly release
resources hold by GroovyClassLoader."(`close` method was added since JDK 1.7)
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_4_X 8ff366f25 -> db4ae2850
Revert "Groovyc did not correctly release resources hold by GroovyClassLoader."(`close` method was added since JDK 1.7)
This reverts commit 8ff366f
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/db4ae285
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/db4ae285
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/db4ae285
Branch: refs/heads/GROOVY_2_4_X
Commit: db4ae2850d9af1460c43625f6f9240022ce7e026
Parents: 8ff366f
Author: sunlan <su...@apache.org>
Authored: Thu Sep 14 08:44:44 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Thu Sep 14 08:44:44 2017 +0800
----------------------------------------------------------------------
.../java/org/codehaus/groovy/ant/Groovyc.java | 27 +++++---------------
1 file changed, 6 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/db4ae285/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
index c17b4ff..594dd40 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
@@ -1162,13 +1162,7 @@ public class Groovyc extends MatchingTask {
}
if (!fileNameErrors) {
- GroovyClassLoader loader = buildClassLoaderFor();
- try {
- FileSystemCompiler.doCompilation(configuration, makeCompileUnit(loader), filenames, forceLookupUnnamedFiles);
- } finally {
- if (loader != null)
- loader.close();
- }
+ FileSystemCompiler.doCompilation(configuration, makeCompileUnit(), filenames, forceLookupUnnamedFiles);
}
} catch (Exception re) {
@@ -1232,7 +1226,7 @@ public class Groovyc extends MatchingTask {
}
}
- protected CompilationUnit makeCompileUnit(GroovyClassLoader loader) {
+ protected CompilationUnit makeCompileUnit() {
Map<String, Object> options = configuration.getJointCompilationOptions();
if (options != null) {
if (keepStubs) {
@@ -1249,9 +1243,9 @@ public class Groovyc extends MatchingTask {
throw new BuildException(ioe);
}
}
- return new JavaAwareCompilationUnit(configuration, loader);
+ return new JavaAwareCompilationUnit(configuration, buildClassLoaderFor());
} else {
- return new CompilationUnit(configuration, null, loader);
+ return new CompilationUnit(configuration, null, buildClassLoaderFor());
}
}
@@ -1320,19 +1314,10 @@ public class Groovyc extends MatchingTask {
Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject());
final String[] pe = classpath.list();
final GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader());
- try {
- for (String file : pe) {
+ for (String file : pe) {
loader.addClasspath(file);
- }
- scriptExtensions.addAll(SourceExtensionHandler.getRegisteredExtensions(loader));
- } finally {
- try {
- loader.close();
- }
- catch ( IOException e ) {
- throw new RuntimeException( e );
- }
}
+ scriptExtensions.addAll(SourceExtensionHandler.getRegisteredExtensions(loader));
}
}
}