GWT does not emulate the clone() method on Object, so when you compile
client-side code there is no method for your clone() to override.

Paul

mmoossen wrote:
> hi Sri!
>
> i thought it was something like that but:
> - i am using java 1.6
> - clone() is a method in Object and not in the interfac, and
> - as said, eclipse wants that annotation (if not i get a warning) and
> i get an error only when compiling client code.
>
> thanks anyhow
> Michael
>
> On May 25, 12:40 pm, Sripathi Krishnan <sripathi.krish...@gmail.com>
> wrote:
>   
>> I think it is the javac compiler failing, not GWTC. Also, I'd guess you are
>> using JDK 1.5.
>>
>> In JDK 1.5, @Override annotation cannot be applied to methods that implement
>> an interface; they can only be applied to a method that overrides a method
>> from a class. In your case, the clone method is defined in an interface, and
>> you are implementing it, not overriding it .. and hence the error.
>>
>> Java 6 onwards, you can apply the @Override annotation to methods that
>> implement an interface.. so you won't get this warning. Strangely, using
>> Java 6 compiler with source="1.5" does not trigger this error.
>>
>> Finally, eclipse is the third culprit. It automatically puts in those
>> annotations, and I haven't yet figured out a way to tell it "don't put those
>> annotations when I am implementing an interface"..
>>
>> --Sri
>>
>> On 25 May 2010 15:49, mmoossen <mmoos...@gmail.com> wrote:
>>
>>
>>
>>     
>>> Dear all,
>>>       
>>> I have a serializable object that overrides the Object.clone() method
>>> and implements the cloneable interface.
>>> and i have the problem that eclipse (and me too) wants to have the
>>> Override annotation but while compiling the GWT compiler fails with
>>> following error message
>>>       
>>> [java][ERROR] Line 175: The method clone() of type XXX must override
>>> or implement a supertype method
>>>       
>>> which sounds pretty much like a bug in the GWT compiler to me... i
>>> mean, why does the GWT compiler care about those annotations? and more
>>> over, why does it *FAIL*.
>>>       
>>> could somebody explain the issue to me?
>>>       
>>> thanks
>>> Michael
>
>   

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to