Is there an end-user accessible way of defining anonymous classes
(by
which I mean classes which are kept alive only by explicit
references or
their instances, and not their class loader)?
Searching for the term "anonymous classes" isn't particularly
revealing
due to the Java-level language construct of the same name.
Look into sun.Misc.Unsafe
public native Class defineAnonymousClass(Class hostClass,
byte[] data,
Object[] cpPatches)
Define a class but do not make it known to the class loader or system
dictionary.
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
_______________________________________________
mlvm-dev mailing list
[email protected]
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev