Lambdas not integrated with annotations
Jochen Theodorou
blackdrag at gmx.org
Wed Jul 30 17:47:41 UTC 2014
Am 30.07.2014 16:09, schrieb Brian Goetz:
>> why has it not been made possible to supply lambdas as annotation parameters? Would it have required too many changes to the language spec? Not deemed worthwhile?
>
> One significant impediment was: Annotation parameters are restricted to the set of values that can be represented in classifies as constants: integers, strings, classes, etc. This would have required significant changes to the JVM spec.
MethodHandles can be constant pool elements too - afaik.
The spec problem is more I think that you normally don't do that
directly in Java. Actually for Java as language a MethodHandle as such
does not really exist besides in the API and what the compiler emits.
But they are no constants in the sense of the Java language, since they
can't even exist without making some kind of proxy out of them to obey
the rules of a functional interface
bye Jochen
More information about the lambda-dev
mailing list