MagicAccessorImpl

Alan Bateman Alan.Bateman at oracle.com
Fri Jun 9 13:48:48 UTC 2017


On 09/06/2017 13:32, Egor Ushakov wrote:
> Hi,
>
> we use MagicAccessorImpl in compiling evaluator of IDEA debugger (to 
> allow evaluation with anonymous classes, lambdas etc.), see
> https://github.com/JetBrains/intellij-community/blob/master/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java#L122 
>
> It is required to allow the generated class to access all fileds from 
> the base class.
> Of course this is a hack, but it worked well. Will there be a way to 
> emulate this in jdk 9?
If I understand correctly then you want to generate bytecode in the 
debugger with references to inaccessible types or members and load that 
code into the target VM. Have you looked at the generating the code to 
use the reflective APIs, maybe in conjunction with an agent that opens 
the packages to the debugger module if needed.

-Alan


More information about the jdk9-dev mailing list