On Aug 11, 2006, at 2:04 AM, ant elder wrote:

Ok I've added a TargetInvokerExtension. The clone method doesn't seem
perfect yet as subclasses now aren't forced to implement clone by the
compiler.

I've not had coffee yet but AIUI you don't need to override clone in subclasses unless you need a deep copy. The way it is implemented at the moment does an unnecessary copy of the cacheable field (as that member will be cloned by the implementation in Object.clone()).

Something like this should work:
Index: spi/src/main/java/org/apache/tuscany/spi/extension/ TargetInvokerExtension.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/extension/ TargetInvokerExtension.java (revision 430795) +++ spi/src/main/java/org/apache/tuscany/spi/extension/ TargetInvokerExtension.java (working copy)
@@ -54,10 +54,13 @@
         return isCacheable();
     }

-    public Object clone() throws CloneNotSupportedException {
- TargetInvokerExtension clonedInvoker = (TargetInvokerExtension) super.clone();
-        clonedInvoker.cacheable = this.cacheable;
-        return clonedInvoker;
+    public Object clone() {
+        try {
+            return super.clone();
+        } catch (CloneNotSupportedException e) {
+ // TargetInvoker extends Cloneable so this should not have been thrown
+            throw new AssertionError(e);
+        }
     }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to