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 2020/03/28 13:07:47 UTC

[groovy] branch master updated: Close GCL finally

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 27152f8  Close GCL finally
27152f8 is described below

commit 27152f81912e4b717744cf5aae30d04efc528970
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Mar 28 21:07:14 2020 +0800

    Close GCL finally
    
    See https://sonarcloud.io/project/issues?id=apache_groovy&issues=AXD-_k5PDC9Fk2pZiXeD&open=AXD-_k5PDC9Fk2pZiXeD
---
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
index 3784de3..757ec77 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -81,10 +81,9 @@ public class Java9 extends Java8 {
         }
 
         Map<String, Set<String>> result = new LinkedHashMap<>(2048);
-        try {
+        try (GroovyClassLoader gcl = new GroovyClassLoader(this.getClass().getClassLoader())) {
             result.putAll(doFindClasses(URI.create("jrt:/modules/java.base/"), "java", javaPns));
 
-            GroovyClassLoader gcl = new GroovyClassLoader(this.getClass().getClassLoader());
             URI gsLocation = DefaultGroovyMethods.getLocation(gcl.loadClass("groovy.lang.GroovySystem")).toURI();
             result.putAll(doFindClasses(gsLocation, "groovy", groovyPns));