#ReflectiveAccessToNonExportedTypes

Shigeru Chiba chiba at chibas.net
Tue Dec 20 09:49:48 UTC 2016


Dear JSR 376 EG members,

I’m maintaining a bytecode engineering library named Javassist and, like others, got surprised when I know ClassLoader#define() is not accessible through reflection API.

Although I understand that a module system wants to encapsulate as many methods as possible, I wonder that protected methods and files are anyway visible from subclasses contained in outside modules and thus those protected methods could be accessible through reflection API as public methods.

Calling ClassLoader#define() is a well-known technique (although it’s a hack) and many tools and libraries depend on its use.  If you google it, you will see many blog entries to explain how to access it.  So I want to see only minimum changes due to jigsaw.

Best regards,

Shigeru Chiba



More information about the jpms-spec-comments mailing list