> > nope, see my previous mail to Ceki, the VM is cheating here if it can > inline the call to MethodHandles.lookup() >
Does how the VM cheats really matter? The fact is that the code in the JDK can get the calling class and implement something like MethodHandles.lookup() so it takes ~3 ns. If you implemented something like a lookup class as a normal user your best bet would be StackWalker.GetCallingClass() and you would end up with something that is at least 2 magnitudes slower. That is probably not an issue for most use cases. But for some, it might be a bit of a steep cost. /Kasper