Title: Wrong impl of Java attribute lookup
Type: Severity: normal
Components: Core Versions: Jython 2.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: babelmania, fwierzbicki
Priority: normal Keywords:

Created on 2010-05-11.15:57:34 by babelmania, last changed 2013-02-20.03:18:39 by fwierzbicki.

msg5766 (view) Author: Jorgo Bakker (babelmania) Date: 2010-05-11.15:57:33
Tested with 2.5.1.  See also issue 1467.

bash$ CLASSPATH=bin jython 
Traceback (most recent call last):
  File "", line 3, in <module>
    xxx = ParameterImpl(valueType = String)
AttributeError: read-only attr: valueType
$ cat 
from foo import ParameterImpl
from java.lang import String
xxx = ParameterImpl(valueType = String)

This is a result of a base class implementing methods which a derived class inherits at the same time that the derived class implements an interface which has a method with exactly the same name.

// *** src/foo/ ***
package foo;
public interface Parameter {
    public Class<?> getValueType();
// *** src/foo/ ***
package foo;

 * This is a baseclass which does NOT implement Parameter
 * @author jbakker
public class BareBase  {

    private Class<?> _valueType;

    public void setValueType(Class<?> type) throws NullPointerException {
        _valueType = type;

    public Class<?> getValueType() {
        return _valueType;

}// *** src/foo/ ***
package foo;
public class ParameterImpl extends BareBase implements Parameter {

public abstract class BareBase implements Parameter

(but this is not always possible and I believe the original construct is correct. Also note that it worked under Jython 2.1 and we are not always allowed to change the code)


workaround: making the baseclass abstract and  'implements interface'
Date User Action Args
2013-02-20 03:18:39fwierzbickisetpriority: normal
nosy: + fwierzbicki
versions: + Jython 2.5, - 2.5.1
2010-05-11 15:57:34babelmaniacreate