Questions about jigsaw API

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about jigsaw API

Mike Ershov
Hello,

I'm adapting sigtest tool ( sigtest.java.net ) to jigsaw and have some
questions about jigsaw API:

1) I need to read class bytes for any particular class and all its
dependencies. In other words for module com.acme.mod@3.1 I have to
analyze com.acme.mod@3.1's classes, their superclasses from other
com.acme.* modules recursively and their platform superclasses including
java.lang.Object. Maybe I missed something but I can't find easy way to
do it. So I resolve all dependencies manually. This is my the main
question. I very appreciate any recommendations.

2) org.openjdk.jigsaw.Library  byte[] readClass(ModuleId mid,
java.lang.String className) according to the javadoc "reads the class
bytes of the given class within the given module, in this library or in
a parent library." But actually it doesn't read a parent library. Please
correct the description or, better, add this functionality.

3) I expected that
SimpleLibrary.openSystemLibrary().readClass(Platform.bootModule(),
"java.lang.Object") returns Object's bytes. It returns null because
Platform.bootModule() is "jdk.base@8-ea" instead of "jdk.boot@8-ea".

4) I noticed that public org.openjdk.jigsaw.LoaderPool has no public
constructors. If there is no reasons for such design it's better to do
it not public ( like LibraryPool ) or make them all public.

Thanks in advance,

Mike

Reply | Threaded
Open this post in threaded view
|

Re: Questions about jigsaw API

Alan Bateman
On 24/01/2012 13:37, Mike Ershov wrote:

> Hello,
>
> I'm adapting sigtest tool ( sigtest.java.net ) to jigsaw and have some
> questions about jigsaw API:
>
> 1) I need to read class bytes for any particular class and all its
> dependencies. In other words for module com.acme.mod@3.1 I have to
> analyze com.acme.mod@3.1's classes, their superclasses from other
> com.acme.* modules recursively and their platform superclasses including
> java.lang.Object. Maybe I missed something but I can't find easy way to
> do it. So I resolve all dependencies manually. This is my the main
> question. I very appreciate any recommendations.
Does com.acme.mod@3.1 have an entry point? -- just asking that as maybe
all you need to do is read its configuration and that will give you the
set of contexts and in turn the set of modules. Alternatively you can
run the resolver and generate the configuration (which may be what you
are doing now?).

>
> 2) org.openjdk.jigsaw.Library  byte[] readClass(ModuleId mid,
> java.lang.String className) according to the javadoc "reads the class
> bytes of the given class within the given module, in this library or in
> a parent library." But actually it doesn't read a parent library. Please
> correct the description or, better, add this functionality.
This should work.

>
> 3) I expected that
> SimpleLibrary.openSystemLibrary().readClass(Platform.bootModule(),
> "java.lang.Object") returns Object's bytes. It returns null because
> Platform.bootModule() is "jdk.base@8-ea" instead of "jdk.boot@8-ea".
The jdk.boot/jdk.base issue will go away once the views/exports work is
pushed.

>
> 4) I noticed that public org.openjdk.jigsaw.LoaderPool has no public
> constructors. If there is no reasons for such design it's better to do
> it not public ( like LibraryPool ) or make them all public.
Can you explain what you are looking to do?

-Alan.


Reply | Threaded
Open this post in threaded view
|

Re: Questions about jigsaw API

Mike Ershov
Alan Bateman wrote:

> On 24/01/2012 13:37, Mike Ershov wrote:
>> Hello,
>>
>> I'm adapting sigtest tool ( sigtest.java.net ) to jigsaw and have
>> some questions about jigsaw API:
>>
>> 1) I need to read class bytes for any particular class and all its
>> dependencies. In other words for module com.acme.mod@3.1 I have to
>> analyze com.acme.mod@3.1's classes, their superclasses from other
>> com.acme.* modules recursively and their platform superclasses including
>> java.lang.Object. Maybe I missed something but I can't find easy way to
>> do it. So I resolve all dependencies manually. This is my the main
>> question. I very appreciate any recommendations.
> Does com.acme.mod@3.1 have an entry point? -- just asking that as
> maybe all you need to do is read its configuration and that will give
> you the set of contexts and in turn the set of modules. Alternatively
> you can run the resolver and generate the configuration (which may be
> what you are doing now?).
Thanks Alan, this is the answer I was looking for!
>
>>
>> 4) I noticed that public org.openjdk.jigsaw.LoaderPool has no public
>> constructors. If there is no reasons for such design it's better to do
>> it not public ( like LibraryPool ) or make them all public.
> Can you explain what you are looking to do?
I was exploring org.openjdk.jigsaw API and noticed that two public
classes, LoaderPool and Loader (because its constructor accepts
LoaderPool as parameter) can not be used as public.