Stateless traits & default interface methods question
paul.sandoz at oracle.com
Mon Nov 18 01:23:51 PST 2013
You can think of a default method as "just another virtual method" i.e. there is no fundamental difference, from the perspective of the VM, between a default method on an interface and a non-abstract (or concrete) method on a class. The VM wires up method invocation at runtime and there are a few tweaks to the virtual machine specification.
On Nov 13, 2013, at 5:49 PM, Matthew Adams <matthew at matthewadams.me> wrote:
> _Note: This may be a FAQ. RTFMs are fine._
> I have a question about default interface methods, thinking in terms of
> stateless traits.
> Assume at time t0 I define an interface I with a given default method
> implementation and class C implements I. Later, at time t1, I modify the
> implementations of I's default methods _without_ recompiling C. The next
> time that I execute a method on C that came from a default method on I, do
> I get I's implementation as it was at t0 or t1?
> In other words, are default method implementations woven into classes at
> compile time, do classes delegate to the interface's default method
> implementation at runtime, or is it via some other mechanism?
> mailto:matthew at matthewadams.me <matthew at matthewadams.me>
> googletalk:matthew at matthewadams.me
More information about the lambda-dev