You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2020/07/30 18:04:03 UTC

[groovy] branch async-parse created (now 7b5e997)

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

emilles pushed a change to branch async-parse
in repository https://gitbox.apache.org/repos/asf/groovy.git.


      at 7b5e997  The fork-join pool does not provide a good ClassLoader for Groovy types

This branch includes the following new commits:

     new 7b5e997  The fork-join pool does not provide a good ClassLoader for Groovy types

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[groovy] 01/01: The fork-join pool does not provide a good ClassLoader for Groovy types

Posted by em...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch async-parse
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 7b5e997ccebfa116a969af7344dd52af6225dec8
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Thu Jul 30 13:03:47 2020 -0500

    The fork-join pool does not provide a good ClassLoader for Groovy types
    
     - Thread.currentThread().getContextClassLoader() was used starting with
    46b1fface0b17cf41f9681894bcb8d78fc831258 -- commit does not state that
    this parentage is required for any specific reason; fallback loader (the
    one that loaded ProcessingUnit) seems like a better option for Groovy
    
     - StaticTypeCheckingSupport.evaluateExpression(...) relies on loader
    created by this block; it does not transfer loader(s) from it's context
---
 src/main/java/org/codehaus/groovy/control/ProcessingUnit.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java b/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java
index 0b12ebf..75f1075 100644
--- a/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java
@@ -101,8 +101,7 @@ public abstract class ProcessingUnit {
         // ClassLoaders should only be created inside a doPrivileged block in case
         // this method is invoked by code that does not have security permissions.
         this.classLoader = loader != null ? loader : AccessController.doPrivileged((PrivilegedAction<GroovyClassLoader>) () -> {
-            ClassLoader parent = Thread.currentThread().getContextClassLoader();
-            if (parent == null) parent = ProcessingUnit.class.getClassLoader();
+            ClassLoader parent = ProcessingUnit.class.getClassLoader();
             return new GroovyClassLoader(parent, getConfiguration());
         });
     }