Revising interfaces

Mark Reinhold mr at sun.com
Wed Dec 16 08:54:24 PST 2009


> Date: Fri, 11 Dec 2009 10:16:17 +0000
> From: Mark Thornton <mthornton at optrak.co.uk>

> There are some interfaces (e.g. java.sql.ResultSet)  that have been
> changed many times. Presumably the theory is that not too many implement
> those interfaces and thus not too many will be annoyed by the changes.

Exactly.

> Could we consider annotating interface methods (@since("1.1") perhaps)
> and providing a default implementation for those methods. Then require
> the JVM to insert the default implementation when loading
> implementations of the interface (and where the method is not already
> implemented).
> 
> This would preserve all the existing character of interfaces. The down
> side is potential collision with existing methods having the same
> signature, but that is something of a hazard with extension methods as well.

I think this boils down to essentially the same thing as traits,
with all of the same issues.

- Mark


More information about the lambda-dev mailing list