tag:blogger.com,1999:blog-10039526.post110534838040064243..comments2007-04-16T14:27:43.403+10:00Comments on David Kemp's Blog: Default method implementations aren't so bad!David Kemphttp://www.blogger.com/profile/12250289605528269244noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-10039526.post-1105649664395442502005-01-14T07:54:00.000+11:002005-01-14T07:54:00.000+11:00This is why in C# (and other .NET languages), you ...This is why in C# (and other .NET languages), you have to tell explicitly that methods are "virtual" (the CAN be overriden) and them in subclasses you have to say that a method with the same signature as the virtual superclass method have to is either an "override" or a "new" implementation. The default is to be "new", but warns are issued by the compiler, so that you can figure your real intention. <br /><br />The Metadata idea, from another comment, can be taylored to give such behaviour with Java 5 and up...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-10039526.post-1105529375280867092005-01-12T22:29:00.000+11:002005-01-12T22:29:00.000+11:00I like the idea of using annotations, but I would ...I like the idea of using annotations, but I would instead use them to warn of non-final methods that are not annotated with something like "@nonfinal". I wonder if check-style (http://checkstyle.sourceforge.net/) can complain of non-final methods that have no Javadoc?David Kemphttp://www.blogger.com/profile/16030549619131752898noreply@blogger.comtag:blogger.com,1999:blog-10039526.post-1105459100462617132005-01-12T02:58:00.000+11:002005-01-12T02:58:00.000+11:00You might investigate if annotations can help out ...You might investigate if annotations can help out in this situation. I'm exploring them, and keep thinking of new and surprising ways having build-time and run-time metadata can help. For example, you can write an annotation processor and build your classes with JDK 5's apt. You could then issue a warning for classes which fail to override the default implementation when the user adds the switch to the command-line for the extra checking.binkleyhttp://www.blogger.com/profile/06617364377560752378noreply@blogger.com