Function Pointers

Conrad Winchester conrad at
Sun Feb 26 12:18:13 PST 2012

Hi all,

my name is Conrad Winchester and I am a long time developer. I am currently experimenting with the new lambdas and function pointers in the Java 8 developer preview. I have come across something that strikes me as a little inconsistent in the current way that they are handled and just wanted to see what other people think. I will try to be succinct:

I wish to add and remove function pointers to collections. I refer to the functions using a this reference. Essentially the issue is this. If I use


then I can not use


because the reference 'this#methodName' is different to the first one. I think this is due to the way that SAM interfaces are used to wrap the closures.

A side effect of this is that this will return false

public boolean checkConsistency()
	SomeSAMInterface m1 = this#methodName;
	SomeSAMInterface m2 = this#methodName;
	return m1==m2;

I personally think that every time I use 'this#methodName' it should return the same reference. Is this correct? 

Are there any plans to make method pointers always point to the same thing. If not it makes it much more awkward to use them


Conrad Winchester

More information about the closures-dev mailing list