You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "David Maciver (JIRA)" <ji...@apache.org> on 2016/10/10 17:07:21 UTC
[jira] [Created] (GROOVY-7965) Old method called after class is
redefined
David Maciver created GROOVY-7965:
-------------------------------------
Summary: Old method called after class is redefined
Key: GROOVY-7965
URL: https://issues.apache.org/jira/browse/GROOVY-7965
Project: Groovy
Issue Type: Bug
Affects Versions: 2.4.7
Reporter: David Maciver
Priority: Minor
The following prints 1 and 1 but it should print 1 and 2. Adding whitespace into the last eval statement gives the correct result, so it's probably caching based on the input string.
{code}
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class Main {
public static void main(String[] args) throws Exception {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("groovy");
engine.eval("class A { public int f() { return 1 } }");
engine.eval("println new A().f()");
engine.eval("class A { public int f() { return 2 } }");
engine.eval("println new A().f()");
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)