Defining anonymous classes
mroos at roos.com
Thu Aug 14 20:15:24 UTC 2014
Is there an end-user accessible way of defining anonymous classes
which I mean classes which are kept alive only by explicit
their instances, and not their class loader)?
Searching for the term "anonymous classes" isn't particularly
due to the Java-level language construct of the same name.
Look into sun.Misc.Unsafe
public native Class defineAnonymousClass(Class hostClass,
Define a class but do not make it known to the class loader or system
For each CP entry, the corresponding CP patch must either be null or have
the a format that matches its tag:
◦ Integer, Long, Float, Double: the corresponding wrapper
object type from java.lang
◦ Utf8: a string (must have suitable syntax if used as
signature or name)
◦ Class: any java.lang.Class object
◦ String: any object (not just a java.lang.String)
◦ InterfaceMethodRef: (NYI) a method handle to invoke on
that call site's arguments
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mlvm-dev