What could I do instead? For one, annotations are frequently used for AOP (aspect-oriented programming)-style instrumentation at compile, classload, or runtime. You can use interfaces. Static imports were already added to Java, so why not imports of template methods (of sorts)? Would I really miss a superclass? I use it sometimes, but rarely is it something I absolutely couldn't live without. Its absence might actually do us some good. No one could ever create anything that even remotely looked like EJB 2 ever again. Strangely bad APIs would have to be rewritten.
Crazy? Consider the Java Servlet: Have you ever thought about why it is you override specific methods in one class rather than, say, MyServlet implements
HttpGet? Or better yet, use annotations -- none other than Oracle agreed with you. In Servlet 3.0 you don't need to extend anything and can just use said annotations. Where do we need extends really?
Chalk one up for the aging AOP fanboys. As it turns out, cross-cutting concerns are a more common case than actual lineage, à la inheritance. Frankly I'll do anything to not see code that has something like
AbstractSecureAndAsynchronousBlobbyThing next to its kin
Will Java 8 drop the extends keyword? Almost definitely not. That said, I stopped using it a while ago, except for workarounds or where required by legacy code.
This article, "What if Java 8 dropped 'extends'?," was originally published at InfoWorld.com. Keep up on the latest happenings in application development at InfoWorld.com. For the latest business technology news, follow InfoWorld.com on Twitter.