Nashorn--Only one class is used to get its bytecode

41 Views Asked by At

Nashorn,"Java.extend function returns a type object for a subclass of the specified Java class (or implementation of the specified interface) that acts as a script-to-Java adapter for it." I passed Java.extend(xxx,{xxx: function(){}}).class get a class object,and I want to write its bytecode on a file. What should I do?

1

There are 1 best solutions below

0
Attila Szegedi On

Nashorn doesn't support this directly, however you can do something yourself using the Java instrumentation API, and implementing a ClassFileTransformer.