Issue1145

classification
Title: Jython 2.5 compatibility problem with JSR 223
Type: Severity: major
Components: Core Versions: 2.5alpha3, 2.5.1
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nriley Nosy List: fkorling, fwierzbicki, jsamsa, leosoto, nriley, robheittman, thijs, tuska, zyasoft
Priority: normal Keywords: ipv6

Created on 2008-10-07.16:00:07 by jsamsa, last changed 2009-07-23.05:21:46 by nriley.

Messages
msg3645 (view) Author: Jason Samsa (jsamsa) Date: 2008-10-07.16:00:27
package jython;

import java.util.Arrays;
import java.util.List;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

class Foo {
	private int amount;

	public Foo(int amount) {
		this.amount = amount;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}
}

public class JythonExpression {
	public static void main(String[] args) {

		final List<Foo> foos = Arrays.asList(new Foo(200), new 
Foo(10), new Foo(5000));
		ScriptEngine engine = new ScriptEngineManager()
				.getEngineByName("python");

		engine.put("foos", foos);
		engine.put("afoo", new Foo(12));
		try {
			Boolean result = 
(Boolean)engine.eval("foo.amount > 1");
			System.out.println(result);
		} catch (ScriptException e) {
			e.printStackTrace();
		}
	}

}


results in :
Exception in thread "main" java.lang.VerifyError: class 
com.sun.script.jython.JythonScope overrides final method 
__findattr__.(Ljava/lang/String;)Lorg/python/core/PyObject;
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
	at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
	at 
com.sun.script.jython.JythonScriptEngineFactory.getScriptEngine(JythonSc
riptEngineFactory.java:132)
	at 
javax.script.ScriptEngineManager.getEngineByName(ScriptEngineManager.jav
a:225)
	at jython.JythonExpression.main(JythonExpression.java:31)
msg3646 (view) Author: Leonardo Soto (leosoto) Date: 2008-10-07.16:07:45
The breakage is obviously related to the PyObject API change I made on
r5155 (__findattr__ refactor). Looks like we will have to submit an
alternative engine ("python25?"). Which makes me wonder if JSR 223
contains any provision to support different versions of the same
language. In such case, we may want to exploit that.
msg3890 (view) Author: Thijs Triemstra (thijs) Date: 2008-12-08.20:23:45
I also encountered this while trying to get Jython 2.5 working with Ant's 
script task. Only managed to get Jython 2.2.1 working.
msg4419 (view) Author: Jim Baker (zyasoft) Date: 2009-04-04.01:12:14
Need by GA. We will see if we can use the discovery protocol to mask the
prior version.
msg4632 (view) Author: Jim Baker (zyasoft) Date: 2009-05-04.17:45:45
Deferred to 2.5.1
Jsr223 branch tracks this work
msg4773 (view) Author: Thomas Mortagne (tuska) Date: 2009-05-31.17:17:05
Would be great to bundle JSR 223 implementation like Groovy did. See
http://jira.codehaus.org/browse/GROOVY-1594.
msg4778 (view) Author: Jim Baker (zyasoft) Date: 2009-05-31.23:34:04
The jsr223 branch has the outline of support for jsr223 within Jython, 
just like Groovy 1.6. However, this development missed the beta cutoff 
period, so it had to be deferred to 2.5.1.

In addition, we should be able to support a more comprehensive 
integration, again like Groovy.
msg4783 (view) Author: Thomas Mortagne (tuska) Date: 2009-06-02.14:58:45
Ok great. Sorry i did not understood what "Jsr223 branch tracks this
work" meant in your previous comment.
msg4906 (view) Author: Thijs Triemstra (thijs) Date: 2009-07-15.20:14:52
I would say it's critical but raised the severity of the ticket since it's 
a goal for 2.5.1 afaik, and I'd love to use this.
msg4936 (view) Author: Nicholas Riley (nriley) Date: 2009-07-23.05:21:45
The JSR 223 branch has been merged into trunk.  Please test it and file 
(additional) bugs if you run into any issues.

Thanks.
History
Date User Action Args
2009-07-23 05:21:47nrileysetstatus: open -> closed
assignee: zyasoft -> nriley
resolution: fixed
messages: + msg4936
nosy: + nriley
2009-07-15 20:14:52thijssetmessages: + msg4906
severity: normal -> major
2009-06-02 14:58:46tuskasetmessages: + msg4783
2009-05-31 23:34:05zyasoftsetmessages: + msg4778
2009-05-31 17:17:06tuskasetmessages: + msg4773
2009-05-04 17:45:47zyasoftsetpriority: high -> normal
keywords: + ipv6
messages: + msg4632
versions: + 2.5.1
2009-04-28 19:23:12robheittmansetnosy: + robheittman
2009-04-04 01:12:15zyasoftsetassignee: leosoto -> zyasoft
messages: + msg4419
nosy: + zyasoft
2009-03-14 02:39:39fwierzbickisetpriority: high
2008-12-08 20:23:45thijssetnosy: + thijs
messages: + msg3890
2008-11-17 14:13:16tuskasetnosy: + tuska
2008-11-11 08:25:01fkorlingsetnosy: + fkorling
2008-11-01 13:58:20fwierzbickisetcomponents: + Core
2008-10-07 16:07:48leosotosetmessages: + msg3646
2008-10-07 16:02:24fwierzbickisetassignee: leosoto
nosy: + fwierzbicki, leosoto
2008-10-07 16:00:55jsamsasettitle: Jython 2.5 compatibility with JSR 223 -> Jython 2.5 compatibility problem with JSR 223
2008-10-07 16:00:30jsamsasetmessages: + msg3645
2008-10-07 16:00:08jsamsacreate