Do we need all those @Override ?
i guys, while browsing MINA's code, I see @Override used everywhere. I know it can be helpful when overriding an existing method, but do you think we need to keep them ? wdyt ? -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org
Re: Do we need all those @Override ?
Emmanuel Lecharny wrote: i guys, while browsing MINA's code, I see @Override used everywhere. I know it can be helpful when overriding an existing method, but do you think we need to keep them ? wdyt ? Yes. They're very helpful when refactoring. -Mike
Re: Do we need all those @Override ?
I would keep them because they really help when there are changes in super classes during a compile. Jeff Emmanuel Lecharny wrote: i guys, while browsing MINA's code, I see @Override used everywhere. I know it can be helpful when overriding an existing method, but do you think we need to keep them ? wdyt ?
Re: Do we need all those @Override ?
Hey Mike, Jeff, Not denying these claims but just curious. Can you guys educate me as to how it works, or helps in these cases. I never bothered to investigate this @Override tag. Thanks, Alex On Thu, Jun 5, 2008 at 6:28 PM, Jeff Genender [EMAIL PROTECTED] wrote: I would keep them because they really help when there are changes in super classes during a compile. Jeff Emmanuel Lecharny wrote: i guys, while browsing MINA's code, I see @Override used everywhere. I know it can be helpful when overriding an existing method, but do you think we need to keep them ? wdyt ?
Re: Do we need all those @Override ?
Jeff Genender wrote: I would keep them because they really help when there are changes in super classes during a compile. Ok, pretty clear reasons why we should keep them. Thanks Mike and Jeff ! -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org
Re: Do we need all those @Override ?
Alex Karasulu wrote: Hey Mike, Jeff, Not denying these claims but just curious. Can you guys educate me as to how it works, or helps in these cases. I never bothered to investigate this @Override tag. Basically (and I'm not a user of this tag), it's helpfull when you want to override a method from an upper class and want to be sure that the API user won't call the wrong method by mistake. For instance, suppose you override the compareTo method because the super.compareTo is not ok, and now suppose you misnamed the method (compareto with a lower 't'). The API user will use compareTo, and will call the super method instead of the one you want him to use. With the @Override tag, this can't happen, because the compiler won't fine a compareto method, and will issue an error. So, yes, it may be useful. Thanks, Alex On Thu, Jun 5, 2008 at 6:28 PM, Jeff Genender [EMAIL PROTECTED] wrote: I would keep them because they really help when there are changes in super classes during a compile. Jeff Emmanuel Lecharny wrote: i guys, while browsing MINA's code, I see @Override used everywhere. I know it can be helpful when overriding an existing method, but do you think we need to keep them ? wdyt ? -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org
Re: Do we need all those @Override ?
Yep...thats basically correct. Its a protection for if you change a base method. Normally w/o the annotation, you would orphan any subclasses by changing a super class signature. With the @Override, the compiler throws an error and says you are overriding a function that doesn't exist. Its really good for orphan control. Its great because debugging these things can be awful which is why I typically like them. They have saved me many times ;-) Jeff Emmanuel Lecharny wrote: Alex Karasulu wrote: Hey Mike, Jeff, Not denying these claims but just curious. Can you guys educate me as to how it works, or helps in these cases. I never bothered to investigate this @Override tag. Basically (and I'm not a user of this tag), it's helpfull when you want to override a method from an upper class and want to be sure that the API user won't call the wrong method by mistake. For instance, suppose you override the compareTo method because the super.compareTo is not ok, and now suppose you misnamed the method (compareto with a lower 't'). The API user will use compareTo, and will call the super method instead of the one you want him to use. With the @Override tag, this can't happen, because the compiler won't fine a compareto method, and will issue an error. So, yes, it may be useful. Thanks, Alex On Thu, Jun 5, 2008 at 6:28 PM, Jeff Genender [EMAIL PROTECTED] wrote: I would keep them because they really help when there are changes in super classes during a compile. Jeff Emmanuel Lecharny wrote: i guys, while browsing MINA's code, I see @Override used everywhere. I know it can be helpful when overriding an existing method, but do you think we need to keep them ? wdyt ?