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 2019/09/13 17:03:41 UTC

[groovy] branch GROOVY_2_4_X updated: Console, GroovyMain and Groovysh use context class loader

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

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


The following commit(s) were added to refs/heads/GROOVY_2_4_X by this push:
     new 6aed91b  Console, GroovyMain and Groovysh use context class loader
6aed91b is described below

commit 6aed91bed106dcc5ac749a49413d14d6c6da054a
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Sep 13 12:02:58 2019 -0500

    Console, GroovyMain and Groovysh use context class loader
---
 src/main/groovy/ui/GroovyMain.java                                  | 4 ++--
 subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/groovy/ui/GroovyMain.java b/src/main/groovy/ui/GroovyMain.java
index 77df5fe..3df7f4a 100644
--- a/src/main/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/ui/GroovyMain.java
@@ -472,7 +472,7 @@ public class GroovyMain {
      * Process the input files.
      */
     private void processFiles() throws CompilationFailedException, IOException, URISyntaxException {
-        GroovyShell groovy = new GroovyShell(conf);
+        GroovyShell groovy = new GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
         setupContextClassLoader(groovy);
 
         Script s = groovy.parse(getScriptSource(isScriptFile, script));
@@ -592,7 +592,7 @@ public class GroovyMain {
      * Process the standard, single script with args.
      */
     private void processOnce() throws CompilationFailedException, IOException, URISyntaxException {
-        GroovyShell groovy = new GroovyShell(conf);
+        GroovyShell groovy = new GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
         setupContextClassLoader(groovy);
         groovy.run(getScriptSource(isScriptFile, script), args);
     }
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
index a37dc76..88e721d 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
@@ -200,7 +200,7 @@ options:
         //when starting via main set the look and feel to system
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
 
-        def console = new Console(Console.class.classLoader?.getRootLoader())
+        def console = new Console(Thread.currentThread().contextClassLoader)
         console.useScriptClassLoaderForScriptExecution = true
         console.run()
         if (args.length == 1) console.loadScriptFile(args[0] as File)


Re: [groovy] branch GROOVY_2_4_X updated: Console, GroovyMain and Groovysh use context class loader

Posted by "Milles, Eric (TR Tech, Content & Ops)" <er...@thomsonreuters.com>.
I don't think a separate ticket was created for Groovy 2.4 and 2.5.
________________________________
From: Paul King <pa...@asert.com.au>
Sent: Monday, September 23, 2019 1:27 AM
To: Groovy_Developers <de...@groovy.apache.org>
Subject: Re: [groovy] branch GROOVY_2_4_X updated: Console, GroovyMain and Groovysh use context class loader

Hi Eric, was there an issue associated with this change for the other branches? If not, we should add one. If so, we should update the fix version appropriately.

Cheers, Paul.


On Sat, Sep 14, 2019 at 3:03 AM <em...@apache.org>> wrote:
This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY_2_4_X
in repository https://gitbox.apache.org/repos/asf/groovy.git<https://urldefense.proofpoint.com/v2/url?u=https-3A__gitbox.apache.org_repos_asf_groovy.git&d=DwMFaQ&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=3VQsNoXLsqwDfrToxEEcwYkc7uLg10Nw9zcPGiSAZnc&s=dz9gV2sNYuItLkc2xOp7fTDRJ3fGcoU_sBJIpnYghDA&e=>


The following commit(s) were added to refs/heads/GROOVY_2_4_X by this push:
     new 6aed91b  Console, GroovyMain and Groovysh use context class loader
6aed91b is described below

commit 6aed91bed106dcc5ac749a49413d14d6c6da054a
Author: Eric Milles <er...@thomsonreuters.com>>
AuthorDate: Fri Sep 13 12:02:58 2019 -0500

    Console, GroovyMain and Groovysh use context class loader
---
 src/main/groovy/ui/GroovyMain.java                                  | 4 ++--
 subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/groovy/ui/GroovyMain.java b/src/main/groovy/ui/GroovyMain.java
index 77df5fe..3df7f4a 100644
--- a/src/main/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/ui/GroovyMain.java
@@ -472,7 +472,7 @@ public class GroovyMain {
      * Process the input files.
      */
     private void processFiles() throws CompilationFailedException, IOException, URISyntaxException {
-        GroovyShell groovy = new GroovyShell(conf);
+        GroovyShell groovy = new GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
         setupContextClassLoader(groovy);

         Script s = groovy.parse(getScriptSource(isScriptFile, script));
@@ -592,7 +592,7 @@ public class GroovyMain {
      * Process the standard, single script with args.
      */
     private void processOnce() throws CompilationFailedException, IOException, URISyntaxException {
-        GroovyShell groovy = new GroovyShell(conf);
+        GroovyShell groovy = new GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
         setupContextClassLoader(groovy);
         groovy.run(getScriptSource(isScriptFile, script), args);
     }
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
index a37dc76..88e721d 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
@@ -200,7 +200,7 @@ options:
         //when starting via main set the look and feel to system
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

-        def console = new Console(Console.class.classLoader?.getRootLoader())
+        def console = new Console(Thread.currentThread().contextClassLoader)
         console.useScriptClassLoaderForScriptExecution = true
         console.run()
         if (args.length == 1) console.loadScriptFile(args[0] as File)


Re: [groovy] branch GROOVY_2_4_X updated: Console, GroovyMain and Groovysh use context class loader

Posted by Paul King <pa...@asert.com.au>.
Hi Eric, was there an issue associated with this change for the other
branches? If not, we should add one. If so, we should update the fix
version appropriately.

Cheers, Paul.


On Sat, Sep 14, 2019 at 3:03 AM <em...@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> emilles pushed a commit to branch GROOVY_2_4_X
> in repository https://gitbox.apache.org/repos/asf/groovy.git
>
>
> The following commit(s) were added to refs/heads/GROOVY_2_4_X by this push:
>      new 6aed91b  Console, GroovyMain and Groovysh use context class loader
> 6aed91b is described below
>
> commit 6aed91bed106dcc5ac749a49413d14d6c6da054a
> Author: Eric Milles <er...@thomsonreuters.com>
> AuthorDate: Fri Sep 13 12:02:58 2019 -0500
>
>     Console, GroovyMain and Groovysh use context class loader
> ---
>  src/main/groovy/ui/GroovyMain.java                                  | 4
> ++--
>  subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/main/groovy/ui/GroovyMain.java
> b/src/main/groovy/ui/GroovyMain.java
> index 77df5fe..3df7f4a 100644
> --- a/src/main/groovy/ui/GroovyMain.java
> +++ b/src/main/groovy/ui/GroovyMain.java
> @@ -472,7 +472,7 @@ public class GroovyMain {
>       * Process the input files.
>       */
>      private void processFiles() throws CompilationFailedException,
> IOException, URISyntaxException {
> -        GroovyShell groovy = new GroovyShell(conf);
> +        GroovyShell groovy = new
> GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
>          setupContextClassLoader(groovy);
>
>          Script s = groovy.parse(getScriptSource(isScriptFile, script));
> @@ -592,7 +592,7 @@ public class GroovyMain {
>       * Process the standard, single script with args.
>       */
>      private void processOnce() throws CompilationFailedException,
> IOException, URISyntaxException {
> -        GroovyShell groovy = new GroovyShell(conf);
> +        GroovyShell groovy = new
> GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
>          setupContextClassLoader(groovy);
>          groovy.run(getScriptSource(isScriptFile, script), args);
>      }
> diff --git
> a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
> b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
> index a37dc76..88e721d 100644
> --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
> +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
> @@ -200,7 +200,7 @@ options:
>          //when starting via main set the look and feel to system
>
>  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
>
> -        def console = new
> Console(Console.class.classLoader?.getRootLoader())
> +        def console = new
> Console(Thread.currentThread().contextClassLoader)
>          console.useScriptClassLoaderForScriptExecution = true
>          console.run()
>          if (args.length == 1) console.loadScriptFile(args[0] as File)
>
>