Are classes generated by LambdaMetafactory special?
Mandy Chung
mandy.chung at oracle.com
Mon Aug 5 21:11:02 UTC 2019
This is intentional. The lambda proxy classes are defined as VM
anonymous classes through a JDK internal API
Unsafe::defineAnonymousClass. These generated classes are JDK
implementation details that are hidden for any class lookup and not
modifiable by JVM TI agent.
JDK-8171335 is the RFE to define a supported API to replace Unsafe VM
anonymous class. We have a prototype in the "nestmates" branch in
valhalla repo [1].
Mandy
[1] http://hg.openjdk.java.net/valhalla/valhalla/
On 8/5/19 2:02 PM, Raffaello Giulietti wrote:
> Hello,
>
> experiment suggests that classes generated by
> java.lang.invoke.LambdaMetafactory are somewhat special:
>
> (1) getName() on the class returns a string of the form
> Xxx$$Lambda$nn/0xhhh
> where Xxx is a fully qualified class name (with periods '.' as package
> separators), nn is a decimal integer and hhh is a hex integer. What's
> the role of the slash '/' in the name?
>
> (2) An invocation of Class.forName() with that name fails.
>
> (3) Invoking java.lang.instrument.Instrumentation.isModifiableClass()
> with that class as an argument returns false.
>
> Is this intentional or is it a bug?
>
>
> Greetings
> Raffaello
More information about the core-libs-dev
mailing list