15 messages in org.codehaus.groovy.user[groovy-user] Setter overloading - sh...
FromSent OnAttachments
Marc PalmerJun 4, 2008 7:08 am 
Jochen TheodorouJun 4, 2008 9:01 am 
Luke DaleyJun 4, 2008 3:44 pm 
Marc PalmerJun 5, 2008 2:57 am 
Jochen TheodorouJun 5, 2008 3:32 am 
Jochen TheodorouJun 5, 2008 3:43 am 
Luke DaleyJun 5, 2008 4:51 pm 
Danno FerrinJun 5, 2008 6:24 pm 
Jochen TheodorouJun 5, 2008 7:12 pm 
Luke DaleyJun 5, 2008 7:52 pm 
Luke DaleyJun 5, 2008 8:48 pm 
Michael S. JessopJun 5, 2008 9:49 pm 
Jochen TheodorouJun 6, 2008 4:03 am 
Danno FerrinJun 6, 2008 5:25 am 
Danno FerrinJun 6, 2008 5:28 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[groovy-user] Setter overloading - should it work?Actions...
From:Marc Palmer (ma@anyware.co.uk)
Date:Jun 4, 2008 7:08:37 am
List:org.codehaus.groovy.user

Hi,

Should setter overloading work?

I'm extending a java class that provides:

void setDuration(Duration d) { .. }

...in my groovy class extending it:

class EnhancediTunesEntryInformationImpl extends EntryInformationImpl { void setDuration(String s) { super.setDuration(new Duration(s)) } }

...this fails with groovy complaining that it cannot cast the string to Duration. If I change my setter to:

void setDurationText(String s) { super.setDuration(new Duration(s)) }

it works fine.

So... should overloaded setters resolve with property access or not? I'm just trying to establish whether or not there is a bug to isolate here.

Marc