You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/06/10 00:24:29 UTC

[groovy] 01/02: We got a GROOVY-3456 zoombie here.

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

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

commit 7dbac09db98257aa76acdde6e5da27a94e054be4
Author: Urs Keller <ur...@lightspeedhq.com>
AuthorDate: Tue Jun 9 17:48:26 2020 +0200

    We got a GROOVY-3456 zoombie here.
---
 .../main/groovy/org/apache/groovy/groovysh/Interpreter.groovy  |  2 +-
 .../test/groovy/org/apache/groovy/groovysh/GroovyshTest.groovy | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Interpreter.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Interpreter.groovy
index 5299657..905d5c0 100644
--- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Interpreter.groovy
+++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Interpreter.groovy
@@ -51,7 +51,7 @@ class Interpreter implements Evaluator
     }
 
     Binding getContext() {
-        return shell.context
+        return shell.getContext()
     }
 
     GroovyClassLoader getClassLoader() {
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/GroovyshTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/GroovyshTest.groovy
index 614c13a..05075e0 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/GroovyshTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/GroovyshTest.groovy
@@ -61,6 +61,16 @@ class GroovyshTest extends GroovyTestCase {
         }
     }
 
+    void testBindingContext() {
+        Binding binding = new Binding()
+        binding.setVariable("context", "bla")
+
+        Groovysh groovysh = new Groovysh(binding, testio)
+        groovysh.run('')
+        System.out.println(mockErr.toString())
+        assertTrue(mockErr.toString(), !mockErr.toString().contains("CastException"))
+    }
+
     void testClassDef() {
         Groovysh groovysh = createGroovysh()
         groovysh.execute('class MyFooTestClass{ String foo }')