Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1DDE4200C7C for ; Mon, 22 May 2017 06:53:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1C4BE160BCF; Mon, 22 May 2017 04:53:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3C69B160BC5 for ; Mon, 22 May 2017 06:53:30 +0200 (CEST) Received: (qmail 62517 invoked by uid 500); 22 May 2017 04:53:29 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 62506 invoked by uid 99); 22 May 2017 04:53:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 May 2017 04:53:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D255C1A0240 for ; Mon, 22 May 2017 04:53:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id IPilDfPNaib4 for ; Mon, 22 May 2017 04:53:27 +0000 (UTC) Received: from mail-vk0-f68.google.com (mail-vk0-f68.google.com [209.85.213.68]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 743105F249 for ; Mon, 22 May 2017 04:53:27 +0000 (UTC) Received: by mail-vk0-f68.google.com with SMTP id x71so4646396vkd.2 for ; Sun, 21 May 2017 21:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=FLES3Q2zyRaGF2ZApaJRvVwDR1sTUsumFqQgghvU/CU=; b=n149ujoGBonLzx/HvC7UVE9SGFURrDvB468pzpus2UFfTnAOlPJBqbZ543uaeKd/yn 6th8wiOnMXCSfJ4dMiisscQm9B10AVN/JVGsyH2+BPz6vyu7GkjlNqnP9Emhb+scWbK6 nwRJpxTkN4lH+fXJNhc+z4ZebBoAUSlw1/UieZ92ia8475AFjLD5FlzxQb+O9YepHBUV nerQv4sY7I6RUn50nlQhpwCFhZPjopcRBzcIszXbNHjQBAvdB8HAHm9vsqLHhhoMle8U aHb8p6BIl2SMkd2uPKOtSodZNR9tjNzXtHjSjH8G3XKQ1jZ9EeNh1YSPmKzdMdC2KexC JRzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FLES3Q2zyRaGF2ZApaJRvVwDR1sTUsumFqQgghvU/CU=; b=AdQXJaEjI8ExDvTiwMr4jHVAtaqMi5dXuF+r61pNmJS9pQ+R0VDypyQwNx1emPwXk3 dUfPcdYWKhxKG4KMv0rZgG3G8jDBlOgvm8KBug18vZKCgsvntOrCKw/MASvh/dIBD720 CjhlIIy0W2iWAahegnxnGhmDkSn22OUrH0PjLL1qyBj8z6qNhncrUpJhAebuI15KTDrL y1hg8gYnME9sF4rLT0nSjJdPXB8xYoIo4Y1YPx+gyTPUXQLmI3g5FLi96/Qye8cZAxr1 kBSdqCyM2ooBuw30cMsYQxwS62SUJPwhOYgUwHIxKCyPgW581wfyS1G0tXKwLy8l1rUk ZFaQ== X-Gm-Message-State: AODbwcADehPFcPtIXoLXaLcO7qSeeomeBh/TXx5maTfmS43hhCsjKOI7 oFClExt0w0w6riHk/6vnl1FxnnAeRgQ5O9U= X-Received: by 10.31.180.81 with SMTP id d78mr7214687vkf.44.1495428800775; Sun, 21 May 2017 21:53:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.65.68 with HTTP; Sun, 21 May 2017 21:53:20 -0700 (PDT) From: Assia Alexandrova Date: Mon, 22 May 2017 00:53:20 -0400 Message-ID: Subject: JSR 223 support behavior To: users@groovy.apache.org Content-Type: multipart/alternative; boundary="001a113e00cc750cdd055015a6a7" archived-at: Mon, 22 May 2017 04:53:31 -0000 --001a113e00cc750cdd055015a6a7 Content-Type: text/plain; charset="UTF-8" Hi all, My first time here. I wasn't sure weather to post this to dev list, so please let me know if I should! I'm trying to hook the latest Groovy interpreter to a JVM scripting notebook environment (https://github.com/bolerio/seco). At a minimum I need good JSR 223 support so that symbols/variables can be shared between scripting languages. With Groovy and its built-in JSR 223 support, it seems like an assignment: something = 10 is placed into the common scripting context, but not a definition like this: def something = 10 Here is a sample program reproducing the issue: import javax.script.*; import org.codehaus.groovy.jsr223.*; public class TestMe { public static void main(String[] args) { ScriptEngine engine = (ScriptEngine) new GroovyScriptEngineFactory().getScriptEngine(); try { String decl = "def something = 10"; String stmt = "println something"; engine.eval(decl); engine.eval(stmt); } catch (Exception e) { e.printStackTrace(); } } } This yields an error: Caused by: groovy.lang.MissingPropertyException: No such property: something for class: Script2 I played with GroovyShell a bit, passing in my own groovy.lang.Binding implementation and indeed whenever there is a "def name = value", the binding setVariable or setProperty are not called. Is this a bug? If not, is there a way to get access to those symbols introduced via 'def'. Disclaimer: I'm not a Groovy programmer, just trying to learn enough to make this work. Regards --001a113e00cc750cdd055015a6a7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

My first time here. I wasn'= t sure weather to post this to dev list, so please let me know if I should!=

I'm trying to hook the latest Groovy interpre= ter to a JVM scripting notebook environment (https://github.com/bolerio/seco). At a minimum I need goo= d JSR 223 support so that symbols/variables can be shared between scripting= languages. With Groovy and its built-in JSR 223 support, it seems like an = assignment:

something =3D 10

<= div>is placed into the common scripting context, but not a definition like = this:

def something =3D 10

Here is a sample program reproducing the issue:

=
import javax.script.*;
import org.codehaus.groovy.jsr223.*;<= /div>

public class TestMe
{

=C2=A0 public static void main(String[] args)
=C2=A0 {
=C2=A0 =C2=A0 ScriptEngine engine =3D (ScriptEngine) new GroovyScrip= tEngineFactory().getScriptEngine();
=C2=A0 =C2=A0=C2=A0
=C2=A0 =C2=A0 try
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0= String decl =3D "def something =3D 10";
=C2=A0 =C2=A0 = =C2=A0 String stmt =3D "println something";
=C2=A0 =C2= =A0 =C2=A0 engine.eval(decl);
=C2=A0 =C2=A0 =C2=A0 engine.eval(st= mt);
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 catch (Exception e)<= /div>
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 e.printStackTrace(= );
=C2=A0 =C2=A0 }
=C2=A0 }
}

This yields an error: Caused by: g= roovy.lang.MissingPropertyException: No such property: something for= class: Script2

I played with GroovyShell a bit, p= assing in my own=C2=A0gro= ovy.lang.Binding implementation and indeed whenever there is a "def na= me =3D value", the binding setVariable or setProperty are not called.= =C2=A0
<= br>
I= s this a bug? If not, is there a way to get access to those symbols introdu= ced via 'def'. Disclaimer: I'm not a Groovy programmer, just tr= ying to learn enough to make this work.

Regards
--001a113e00cc750cdd055015a6a7--