Issue1610
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 parameter.py
Traceback (most recent call last):
File "parameter.py", line 3, in <module>
xxx = ParameterImpl(valueType = String)
AttributeError: read-only attr: valueType
---
$ cat parameter.py
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/Parameter.java ***
package foo;
public interface Parameter {
public Class<?> getValueType();
}
// *** src/foo/BareBase.java ***
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/ParameterImpl.java ***
package foo;
public class ParameterImpl extends BareBase implements Parameter {
}
---
workaround:
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:39 | fwierzbicki | set | priority: normal nosy:
+ fwierzbicki versions:
+ Jython 2.5, - 2.5.1 |
2010-05-11 15:57:34 | babelmania | create | |
|