Retrieving the bytes of platform classes
Mark Raynsford
org.openjdk at io7m.com
Mon Oct 23 17:48:26 UTC 2017
Hello.
I'm writing a small tool to analyze the APIs of Java 9 modules. I'm
analyzing the bytecode statically with ASM and have run into a slight
problem: In order to properly analyze a class, I also need to analyze
the superclasses and, in some cases, the superclasses can be platform
classes.
Given a platform class name such as "java/io/InputStream", is it
possible to retrieve the raw bytes for the named class in a portable
(read: non-platform-specific, non-JVM-specific) manner?
In the olden days, we'd probably have gone rummaging in rt.jar, but
that was obviously a hack and wasn't future-proof. My tool is only
designed to work with JDK 9 and up.
Note that I'm *not* asking to get from loaded Class<?> instances to
bytes: I'm analyzing classes statically and none of the analyzed
classes will actually be loaded by any ClassLoader.
--
Mark Raynsford | http://www.io7m.com
More information about the jigsaw-dev
mailing list