Provide api for accessing bytecode from java.lang.reflect.Method. (original) (raw)

Сергей Чаулин cossack5 at mail.ru
Fri Aug 31 17:16:53 UTC 2018


Hi,

In .NET we can retrieve bytecode array from reflected class, e.g.:

MethodInfo mi = typeof (Example).GetMethod( "MethodBodyExample" ); MethodBody mb = mi.GetMethodBody(); var bytes= mb.GetILAsByteArray();

How about having something like this in java ? Leveraging this, it would be possible to get bytecode of currently loaded classes (including lambdas), killing the need to load class as a resource. 

С уважением, Сергей Чаулин



More information about the jdk-dev mailing list