groovy

ProxyGenerator.instantiateDelegate fails when there are overridden protected methods

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.4
  • Fix Version/s: 1.5.5, 1.6-rc-2
  • Component/s: groovy-jdk
  • Labels:
    None
  • Testcase included:
    yes
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

When the delegate has inherited protected methods, the code gets generated more than once for them, resulting in a compilation error.

def proxy = ProxyGenerator.instantiateDelegate([], [1, 2, 3])
==>
groovy.lang.GroovyRuntimeException: Error creating proxy: startup failed, Script1.groovy: 109: Repetitive method name/signature for method 'void removeRange(int, int)' in class 'ArrayList_delegateProxy'.
 @ line 109, column 10.Script1.groovy: 113: Repetitive method name/signature for method 'void removeRange(int, int)' in class 'ArrayList_delegateProxy'.
 @ line 113, column 10.
2 errors

The trouble is in getInheritedMethods which makes a list of all of the protected methods, but it adds entries for overridden protected methods in the superclasses.

Activity

Hide
Jim White added a comment -

Patch with test case and a fix.

Since getInheritedMethods is also used by the aggregator generator, I assume there is a bug there too, but I don't have a test for that.

If this looks good (Paul?) then I'll commit this upon your approval.

Show
Jim White added a comment - Patch with test case and a fix. Since getInheritedMethods is also used by the aggregator generator, I assume there is a bug there too, but I don't have a test for that. If this looks good (Paul?) then I'll commit this upon your approval.
Hide
Paul King added a comment -

Patch looks good. Thanks. Please apply. If you don't have time, assign to me and I will apply.

Show
Paul King added a comment - Patch looks good. Thanks. Please apply. If you don't have time, assign to me and I will apply.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: