Default method survey results

Brian Goetz brian.goetz at oracle.com
Thu Aug 16 10:47:26 PDT 2012


>> Pushing the problem to runtime is not a good solution; a program that
>> compiles should not throw linkage errors.
>
> I am not saying make this a linkage error -- something that would
> prevent the class from loading.

You forget that method invocations in the JVM are dynamically linked. 
Loading an implementation of an interface that doesn't implement all the 
interface methods does not prevent the class from loading; the linkage 
error happens when someone tries to call the missing method.  (This is 
why adding a method to an interface today is binary compatible, but not 
source compatible; it doesn't prevent existing working programs from 
continuing to run.)

> Make this a runtime exception when you
> call a method that has no implementation. I think this is perfectly
> reasonable

This is perfectly reasonable as a fallback, such as we currently do when 
the VM is presented with a set of classes that have been separately 
compiled but wouldn't compile together as a whole.  (Such as, 
recompiling a superclass to add a new abstract method.)  But its a dumb 
idea to not give the programmer any feedback at compile time of the form 
"this program would probably crash if you ran it."

So, while you're technically correct that this is a direction we could 
have gone, its not a very compelling "alternate reality."



More information about the lambda-dev mailing list