Open GoogleCodeExporter opened 9 years ago
Actually, the problem is in Java itself. The Object#clone() method declared as
protected, and this causes "&" operator to fail. The easiest (but not the most
elegant solution) is to have some T cloneMe() method in the interfaces. If
Cloneable is also desirable, it's fine. The implementing class then supposed to
implement both methods, clone() and cloneMe(). Also, in this case clone()
method might be declared protected to avoid the confusing of having both public
methods doing essentially the same.
Original comment by dav.co...@gmail.com
on 9 Feb 2013 at 6:39
The MessageLite.Builder already implements Cloneable, so only the removal of
clone() method from all Builder interfaces is required.
Original comment by dav.co...@gmail.com
on 13 Feb 2013 at 3:10
Also, this AbstractMessage.Builder snippet:
// The compiler produces an error if this is not declared explicitly.
@Override
public abstract BuilderType clone();
by removing the clone() method from the Builder interfaces, the code above
should be sufficient and without any compilation errors. Thus, all
AbstractMessage.Builder subclasses, including DynamicMessage.Builder and
GeneratedMessage.Builder ones, will work with clone() as-is; problem solved!
Original comment by dav.co...@gmail.com
on 13 Feb 2013 at 3:55
Original issue reported on code.google.com by
dav.co...@gmail.com
on 23 Jan 2013 at 11:26