Issue1271

classification
Title: Bean property accessors in derived class overide methods in base class
Type: behaviour Severity: normal
Components: Core Versions: 2.5b1
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: MrMeanie, fwierzbicki
Priority: high Keywords: patch

Created on 2009-03-14.09:25:20 by MrMeanie, last changed 2009-04-14.21:42:29 by fwierzbicki.

Files
File name Uploaded Description Edit Remove
Bug1271_test_20090314.zip MrMeanie, 2009-03-14.09:32:57 Unit test and support file
Issue1271_beanaccessor_fix_v1_20090314.patch MrMeanie, 2009-03-14.13:06:47 Patch to latest SVN
Issue1271_beanaccessor_fix_v2_20090413.patch MrMeanie, 2009-04-13.18:02:24 Patch to latest SVN (rev 6223)
Messages
msg4290 (view) Author: Geoffrey French (MrMeanie) Date: 2009-03-14.09:25:16
Given:
- Two Java classes, 'Base' and 'Derived', where 'Derived' extends 'Base'
- Where 'Base' implements the method 'foo()'
- Where 'Derived' implements the method 'getFoo()'

The bean property accessor that is generated for 'Derived.getFoo()'
which allows it to be called by using the expression 'derived.foo'.
Unfortunately, this covers the 'Base.foo()' method, making 'Base.foo()'
unaccessable for instances of 'Derived'.
msg4291 (view) Author: Geoffrey French (MrMeanie) Date: 2009-03-14.09:32:56
Please find attached a unit test that will test for this bug.
msg4292 (view) Author: Geoffrey French (MrMeanie) Date: 2009-03-14.13:06:47
Please find attached a patch which fixes this issue. The patch affects
the init() method of org.python.core.PyJavaType.
msg4406 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-03-31.19:41:20
Hi Geoffrey, I finally got a chance to apply and test this, but it
causes test_java_integration.py to fail.  If you can get that working I
could apply this.  I pulled your tests into a (somewhat lame) test for
the tests/ directory.  We don't have a good way to compile Java in the
regrtest, so it's easier (if ugly) to put the tests in a Java unit test.
 I commented them out but checked them in here:

tests/java/org/python/tests/props/PropShadow.java
tests/java/org/python/tests/props/BeanPropertyTest.java
msg4504 (view) Author: Geoffrey French (MrMeanie) Date: 2009-04-13.18:02:24
Please find attached a patch which fixes the issue without breaking the
tests you mentioned.

Cause: PyJavaType.init() refusing to overwrite any 'dict' entry with the
same name, with a bean property, that was not already a bean property or
bean event.

The desired behavior (of my original patch) was to prevent methods in
superclasses being overridden, *but*, the behavior that resulted
prevented bean properties from being registered when anything was
registered under that name, including class properties.

The new patch ensures that overriding is only prevented when the
definition being overridden comes from a superclass, by calling
lookup_where() instead of lookup(), and checking that the original
definition is NOT from the current class.
msg4508 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-04-14.21:42:29
Applied in r6224, thanks!
History
Date User Action Args
2009-04-14 21:42:29fwierzbickisetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg4508
2009-04-13 18:02:26MrMeaniesetfiles: + Issue1271_beanaccessor_fix_v2_20090413.patch
messages: + msg4504
2009-03-31 19:41:21fwierzbickisetmessages: + msg4406
2009-03-14 13:56:26fwierzbickisetpriority: high
assignee: fwierzbicki
resolution: accepted
nosy: + fwierzbicki
2009-03-14 13:06:48MrMeaniesetfiles: + Issue1271_beanaccessor_fix_v1_20090314.patch
keywords: + patch
messages: + msg4292
2009-03-14 09:32:57MrMeaniesetfiles: + Bug1271_test_20090314.zip
messages: + msg4291
2009-03-14 09:25:20MrMeaniecreate