Method Pointers

Sam Pullara sam at sampullara.com
Sun Feb 26 16:27:22 PST 2012


Why would they have to be changed? A SerializableRunnable is still a Runnable... If you cast it to a SerializableRunnable at the submit()/execute() site, that should work, no?

Sam

On Feb 26, 2012, at 3:53 PM, Rémi Forax wrote:

> On 02/27/2012 12:43 AM, Sam Pullara wrote:
>> Since we are going to support it when the interface is Serializable, why not just require that you do something like:
>> 
>> interface SerializableRunnable extends Runnable, Serializable {}
>> 
>> and then cast it to that at the call site. Is this an option that sucks?
> 
> yes, because you also have to change the API, by example
> Executor should have also a new submit()/execute() that takes a 
> SerializableRunnable.
> 
> Serializable is a runtime flag, it's ortogonal to the type system.
> If annotations were present in the jdk 1.1, Serializable would be an 
> annotation.
> 
>> 
>> Sam
> 
> Rémi
> 
> 



More information about the lambda-dev mailing list