If I do an override of a clone method the compiler create a bridge method to guarantee a correct polymorphism (THIS IS THE CLASS DECOMPILED)
class Point
{
Point()
{
}
protected Point clone()
throws CloneNotSupportedException
{
return this; // not good only for example!!!
}
protected volatile Object clone()
throws CloneNotSupportedException
{
return clone();
}
}
so when is invoked the clone method the bridge method is invoked and inside it is invoked the correct clone method. But my question is when into the bridge method is called return clone()
how do the VM to say that it must invoke Point clone()
and not itself again???