Issue2403

classification
Title: VerifyError when implementing Interface containing default methods (Java 8)
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7, Jython 2.5
Milestone: Jython 2.7.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alexgobbo, amoebam, darjus, hendrik, zyasoft
Priority: Keywords:

Created on 2015-09-23.15:07:19 by alexgobbo, last changed 2016-09-06.05:18:32 by zyasoft.

Messages
msg10283 (view) Author: A. Gobbo (alexgobbo) Date: 2015-09-23.15:07:19
Systematically an exception pops up when declaring a Python class implementing a Java interface containing default methods, even if all methods are overriden:
-  java.lang.VerifyError... Illegal use of nonvirtual function call in listener.py at line number ...

Workaround: start JVM with option Xverify:none
msg10312 (view) Author: Darjus Loktevic (darjus) Date: 2015-10-07.09:35:17
Can you provide more details? Java version, code you're executing, ideally repro example.

Thanks!
msg10352 (view) Author: A. Gobbo (alexgobbo) Date: 2015-10-12.08:32:52
Below an example - I use Jython 2.7.0. Java 1.8.0_11 and Java 1.8.0_51. The exception throws a VerifyError when declaring the class "MyClass" overriding get().


package test;

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

public class Test {

    public static interface TestInterface {

        default String get() {
            return "Unknown";
        }
    }

    public static class TestClass implements TestInterface {

        public String get() {
            return "Value";
        }
    }

    public static void main(String[] args) throws Exception {
        ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");

        engine.eval("import test.Test.TestClass");
        engine.eval("o = test.Test.TestClass()");
        engine.eval("print o.get()"); //This is ok

        engine.eval("import test.Test.TestInterface");
        engine.eval("class MyClass(test.Test.TestInterface):\n"
                + "   def get(self):\n"
                + "       return 'value'");
        engine.eval("o = MyClass()");
        engine.eval("print o.get()");

    }
}
History
Date User Action Args
2016-09-06 05:18:32zyasoftsetmilestone: Jython 2.7.2
2016-07-29 20:49:14amoebamsetnosy: + amoebam
2016-05-11 11:17:50hendriksetnosy: + hendrik
2015-10-12 08:32:53alexgobbosetmessages: + msg10352
2015-10-07 09:35:17darjussetnosy: + darjus
messages: + msg10312
2015-09-23 21:24:54zyasoftsetnosy: + zyasoft
2015-09-23 15:07:19alexgobbocreate