Request for review (S): 6953246: JSR 292 should support SAM conversion

Rémi Forax forax at univ-mlv.fr
Sun Sep 5 06:37:51 PDT 2010


Le 05/09/2010 09:04, John Rose a écrit :
> One important API point in MethodHandles:  A SAM constructor for method handles.
>
> http://cr.openjdk.java.net/~jrose/6953246/webrev.00/
>
>    
The answer to the question "Should we delegate equals/hashCode to the 
targets?"
The answer is no !

hashcode should be System.identityHashCode(proxy)
equals should be proxy == args[0]
and toString() should returns getClass().getName() + '@' + 
Integer.toHexString(hashCode()).

i.e the proxy must simulate the fact that the SAM inherits from 
java.lang.Object.

Rémi



More information about the mlvm-dev mailing list