Currently, any keyword arguments passed to a constructor of a Java class
are used to set bean properties of the specified names.
Unfortunately, this is not consistent with the way that keyword arguments
are handled by Java methods. Having a method of the form
MyClass#myMethod(PyObject values, String names) will cause Jython
to pass the keyword arguments to the Java method, so that it can explicitly
handle them. This functionality is missing from Java constructors.
I would like to propose that it would be beneficial to permit both uses
of keyword arguments for constructors where:
- If the constructor has arguments of the form
(PyObject values, String names), the kwargs will be passed to the
constructor, which will handle them
- Otherwise, any keyword arguments supplied are used as bean property
I have entered this into the bug tracker under issue #1503. I have also
attached a patch to this issue which introduces the behavior that I have
proposed, along with a new Java test.
I have tested the modifications using regrtest and javatest, and both pass.