Issue Details (XML | Word | Printable)

Key: GROOVY-2006
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Jochen Theodorou
Reporter: Mark Menard
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

JDK Dynamic Proxies Broken

Created: 26/Jul/07 05:27 PM   Updated: 28/Oct/07 04:57 PM
Component/s: None
Affects Version/s: 1.1-beta-1, 1.1-beta-2
Fix Version/s: 1.1-rc-2

Time Tracking:
Not Specified

File Attachments: 1. File GroovyJdkDynamicProxyPatch.diff (12 kB)
2. File JdkDynamicProxyTest.diff (5 kB)


Testcase included: yes
Patch Submitted: Yes


 Description  « Hide
Groovy beans wrapped in JDK style proxies throw an "IllegalArgumentException: object is not an instance of declaring class" when a method is called on them from a Groovy object.

Thread on subject from the dev list: http://www.nabble.com/JDK-Style-Proxy-Issue-tf4137792.html

Diagnosis from Jochen Theodorou: http://www.nabble.com/Re%3A-JDK-Style-Proxy-Issue-p11815320.html



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Mark Menard added a comment - 28/Jul/07 12:38 PM
This is a patch from groovy-core/src.

This patch includes all of the test cases from the previous patch and a fix for the issue.

I have added an interfaceMetaMethod property to MetaMethod. This allows MetaMethod to know if the method it is invoking was declared on an interface. Then the logic to invoke the method checks to see if the type of MetaMethod.method implementing class == the type of the target object. If it does not and there is an interfaceMetaMethod it delegates the invocation to the interfaceMetaMethod.

In MetaClass I've added a new method that wires a newly create MetaMethod to its implementing MetaMethod if one exists. This is called from createMetaMethod().

All existing tests in the current trunk pass with this patch applied.


Mark Menard added a comment - 28/Jul/07 12:39 PM
This is a patch from groovy-core/src.

This patch includes all of the test cases from the previous patch and a fix for the issue.

I have added an interfaceMetaMethod property to MetaMethod. This allows MetaMethod to know if the method it is invoking was declared on an interface. Then the logic to invoke the method checks to see if the type of MetaMethod.method implementing class == the type of the target object. If it does not and there is an interfaceMetaMethod it delegates the invocation to the interfaceMetaMethod.

In MetaClass I've added a new method that wires a newly create MetaMethod to its implementing MetaMethod if one exists. This is called from createMetaMethod().

All existing tests in the current trunk pass with this patch applied.


Guillaume Laforge added a comment - 06/Oct/07 09:56 AM
Hi Mark,
I had a quick look at this issue, and the Groovy code base has changed a little since.
Do you still encounter the same problem?
If yes, could I ask you to update your patch, please?

Mark Menard added a comment - 11/Oct/07 09:59 AM
Hi Guillaume,

I've tried out the 1.1-beta-3 from http://repo1.maven.org/maven2/groovy/groovy-all/1.1-beta-3/. If that is the released version of 1.1-beta-3 then it has not fixed the issue.

If I have time I will check out the SVN and take a look at this again. (I'm a bit buried on a project right now.) What is the time to the first RC? And does this need to be fixed before then to make it into 1.1?

Mark


Guillaume Laforge added a comment - 11/Oct/07 10:33 AM
We plan to release RC-1 tomorrow evening (ie in 24 hours or so).
And 1.1 mid-November.
As it's a "bug fix" and not a "feature", we can include the fix in after tomorrow if you don't have time to look till tomorrow.