Looks good to me.
I thought it could be taken further and turned into a static util
method that it's even easier to maintain. However, after writing it
out, I saw that this could create a problem when the parent clone
method is the default one, which has protected access. So your
approach seems best :-).
On 24 Aug 2007, at 20:52, Tim Eck wrote:
> I'm probably missing something, but why can't we just put our
> processing
> in a separate method and avoid any complications with existing
> exception
> handlers? The code end up looking something like this then:
>
> public Object clone() {
> try {
> return __tc_clone();
> } catch (CloneNotSupportedException cnse) {
> Throw new RuntimeException(cnse);
> }
> }
>
> private Object __tc_clone() throws CloneNotSupportedException {
> TCObject tco = (this instanceof Manageable) ?
> ((Manageable) this).__tc_managed() :
> null;
> if (tco != null) {
> synchronized (tco.getResolveLock()) {
> tco.resolveAllRefs();
> return Util.fixTC(this, super.clone());
> }
> }
>
> return super.clone();
> }
>
> The only real difference is that our special logic is self contained.
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:tc-dev-
>> [EMAIL PROTECTED] On Behalf Of Alex Miller
>> Sent: Thursday, August 23, 2007 3:40 PM
>> To: tc-dev
>> Subject: Re: [tc-dev] [JIRA] Commented: (DEV-865)
>> CloneNotSupportedException got swallowed and replaced by
>> IllegalMonitorStateException
>>
>> Anyone have any thoughts on this?
>>
>>
>
>
> _______________________________________________
> tc-dev mailing list
> [email protected]
> http://lists.terracotta.org/mailman/listinfo/tc-dev
--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev