Re: Automatic module names

2017-01-31 Thread Stephane Epardaud
FTR, about mapping the module name to Maven group/artifact, Ceylon modules are getting optional group/artifact descriptors in their module descriptors too, because keeping a sane mapping between Maven and Ceylon modules was too hard otherwise. Similarly we now store the group/artifact IDs in JBoss

Re: Exporting - the wrong default?

2016-08-01 Thread Stephane Epardaud
I don't think public ever meant "public to the world". In Java 1->8 it means "visible to those who can see the containing scope". If you declare a public inner class in a private (or package-private) class, then those who cannot access the outer type also cannot access the public inner class.

Re: Feedback on proposal for #ReflectiveAccessToNonExportedTypes

2016-07-14 Thread Stephane Epardaud
So how about a Java Language annotation (say, @RequiresExport) that we could place on IoC framework annotation definitions (say, @Entity, from JPA) that would tell the compiler that any type annotated with @Entity must be exported? That would solve the issue of making sure that users would not

Re: module-info.java just causes problems

2016-05-11 Thread Stephane Epardaud
Agreed, and this is the conclusion we came to in Ceylon wrt modules too. But that's orthogonal to the format of the module descriptor. I think the Java Modules already have a lot of overriding capabilities in the form of command-line flags (-addExports and friends), but ultimately an external

Re: module-info.java just causes problems

2016-05-11 Thread Stephane Epardaud
or hard. I don't think module-info.class changes that much. On 11/05/16 16:44, David M. Lloyd wrote: On 05/11/2016 09:21 AM, Stephane Epardaud wrote: I don't understand the problem with the module-info.java class. We also repackage jars to add module descriptors (for OSGi, Maven and JBoss

Re: module-info.java just causes problems

2016-05-11 Thread Stephane Epardaud
I don't understand the problem with the module-info.java class. We also repackage jars to add module descriptors (for OSGi, Maven and JBoss Modules) and for Jigsaw we generate the `module-info.class` file when we need to repackage them. Between this binary format and XML or MANIFEST.MF, I don't

Re: Proxy classes and reflection (IllegalAccessException)

2016-04-07 Thread Stephane Epardaud
oxy2 does not export com.sun.proxy.jdk.proxy2”. Regards, Neil On 7 Apr 2016, at 13:13, Stephane Epardaud wrote: IIRC RestEasy needs to add a module read to that Class's module it wants to create a Proxy of. On 07/04/16 14:05, Alan Bateman wrote: On 07/04/2016 12:39, Dawid Weiss wrote: I don't w

Re: Proxy classes and reflection (IllegalAccessException)

2016-04-07 Thread Stephane Epardaud
IIRC RestEasy needs to add a module read to that Class's module it wants to create a Proxy of. On 07/04/16 14:05, Alan Bateman wrote: On 07/04/2016 12:39, Dawid Weiss wrote: I don't want to hijack the other thread, so here's a new one I'm stuck with. I get this exception (simplified stack trac

Re: Intersection of Modules and Multi-Release JARs

2016-01-19 Thread Stephane Epardaud
On 18/01/16 17:28, Paul Sandoz wrote: > Assuming the JodaTime library is not publicly exported (types in the > dependent API) and used in a manner that is amenable to maintaining > separate classes then i guess it (and it’s dependencies) would have > tag along with a "one unit, one set of depende

Re: Intersection of Modules and Multi-Release JARs

2016-01-18 Thread Stephane Epardaud
Hi, Well, I can think of at least one use-case where a JDK10 version of a module would have different dependencies than JDK9: if the module used an external lib for X in JDK9, and then JDK10 incorporated that functionality X so that import would no longer be required but the module would then impo

Wrap-up on Ceylon and Java 9

2015-12-17 Thread Stephane Epardaud
Hi, I've summed up the work I did on making Ceylon modules compile and run on Java 9 here: http://ceylon-lang.org/blog/2015/12/17/java9-jigsaw/ Feel free to give it a try :) Cheers and thanks for the help!

Re: Spring's need for optional dependencies

2015-12-17 Thread Stephane Epardaud
As I already mentioned, we also have the need for this in Ceylon, for the same reasons. Dependencies are required at compile-time but optional at run-time, based on detection: if it's there fine, if not then no problem.

Re: Is there really a jdk.proxy1 module?

2015-12-09 Thread Stephane Epardaud
On 08/12/15 23:32, Mandy Chung wrote: > Good point. Existing code should use Annotation.annotationType() > instead of Annotation.getClass(). Annotation is an interface. Calling > annotation.getClass() will only return the implementation class that > may be encapsulated and not exported to the cal

Re: HAHA! It runs!

2015-12-08 Thread Stephane Epardaud
I suspect a more common approach will be to generate module-info.class directly, skipping the Java source file, since module-info.class is extensible whereas module-info.java is not. That's what I do ATM, but if we could add annotations to module-info.java, it could become extensible. I could even

Re: HAHA! It runs!

2015-12-08 Thread Stephane Epardaud
On 08/12/15 19:39, Paul Benedict wrote: > On Tue, Dec 8, 2015 at 12:00 PM, Stephane Epardaud <mailto:s...@epardaud.fr>> wrote: > > Finally I was able to run my Ceylon modules in Java9!! > > > Congrats Stephane! > > > [1] ATM I can compile them w

HAHA! It runs!

2015-12-08 Thread Stephane Epardaud
Finally I was able to run my Ceylon modules in Java9!! So what I have is that I generate module-info.class for every Ceylon distrib module (the bootstrap modules written in Java[1]), I made the Ceylon JVM compiler generate module-info.class for every Ceylon module, and with a few tweaks here and t

Re: Is there really a jdk.proxy1 module?

2015-12-08 Thread Stephane Epardaud
On 08/12/15 17:20, Mandy Chung wrote: > I believe your code is calling Class::getMethod on proxy class something like: > > Method m = proxy.getClass().getMethod(“Y”); > m.invoke(proxy,….); Right, it has to use reflection because it doesn't "read" the application. > The above reflects

Re: Running module jar programatically

2015-12-08 Thread Stephane Epardaud
Oh, OK thanks a lot. Will try that and let you know. I feel I'm really close now :) On 08/12/15 17:26, Alan Bateman wrote: > Layer.boot().modules() will give you the set of jlr.Module objects for > the module in the boot layer but that is probably not what you want. > > From your mail then it sou

Re: Running module jar programatically

2015-12-08 Thread Stephane Epardaud
OK, so now I have Java 9 + Jigsaw load my module's main method, and in there I need to call a class from another module by reflection. That other module is in the module path, and I know its name and version. I can't use the boot class loader because it's not on the class path (it's on the module p

Re: Is there really a jdk.proxy1 module?

2015-12-08 Thread Stephane Epardaud
On 08/12/15 16:47, Peter Levart wrote: > I have a scanner that can scan annotations of type X (by name) and >> member Y (by name) so it must use reflection to load the annotation and >> member. > > You can do that without readability of the target module. Apparently not, see my exception. > >> I

Re: Is there really a jdk.proxy1 module?

2015-12-08 Thread Stephane Epardaud
Thanks, that helps, and that does describe what happened to me. On 08/12/15 16:17, Alan Bateman wrote: > The accessibility of the proxy class will be determined based on the > accessibility of the proxy interfaces. If there are proxy interfaces > is non-exported packages then the proxy will get ge

Re: Is there really a jdk.proxy1 module?

2015-12-08 Thread Stephane Epardaud
On 08/12/15 16:07, Peter Levart wrote: > >> Except now I have to add a read to scan annotations of another module, > > Do you really have to addRead() ? Visibility of of classes > (Class.forName()) should only depend on class loader delegation. > Enumerating members, when you already have a java.

Re: Is there really a jdk.proxy1 module?

2015-12-08 Thread Stephane Epardaud
Actually no, I've found that insted of accessing the proxy class directly I should just access the proxied annotation class and it works. Thanks anyway. Except now I have to add a read to scan annotations of another module, which naturally introduces a cycle. This can't be right. Suppose I've a F

Re: Is there really a jdk.proxy1 module?

2015-12-08 Thread Stephane Epardaud
hough, otherwise I can't use reflection to read annotations… On 08/12/15 15:32, Remi Forax wrote: > No, > jdk.proxy1 is a module created dynamically by the class > java.lang.reflect.Proxy. > > Rémi > > ----- Mail original - >> De: "Stephane Epardaud" >

Is there really a jdk.proxy1 module?

2015-12-08 Thread Stephane Epardaud
I'm getting: java.lang.IllegalAccessException: class com.redhat.ceylon.model.loader.impl.reflect.mirror.ReflectionAnnotation (in module com.redhat.ceylon.model) cannot access class com.sun.proxy.jdk.proxy1.$Proxy3 (in module jdk.proxy1) because module com.redhat.ceylon.model does not read module j

Re: is ClassLoader.loadClass() supposed to work on module-info classes?

2015-12-07 Thread Stephane Epardaud
FTR I have nothing against it being module-info.class. As far as Ceylon is concerned, that or MANIFEST.MF are both fine. What concerns me far more is that it's not self-sufficient since I have to recombine it with another source (OSGi or Maven metadata) to get version numbers and optional imports.

modulepath spec

2015-12-07 Thread Stephane Epardaud
Hi, When there is a -modulepath argument, is it a path in the Unix sense? With a list of File.pathSeparator-separated folders? Ceylon produces `.car` files instead of `.jar` files, but they're really zip files like jars. Will Java examine the file type to determine that it's a zip file, or will i

Re: the acyclic module graph

2015-12-07 Thread Stephane Epardaud
I was THIS close to running Ceylon modules with Java 9: atlantis stephane 18:04 compiler-java $ $HOME/no-backup/src/jdk1.9.0-jigsaw/bin/java -modulepath mlib -m com.redhat.ceylon.compiler.java.test.interop.java9.user Error occurred during initialization of VM java.lang.module.ResolutionException:

Re: Optional dependencies

2015-12-04 Thread Stephane Epardaud
Syntactic detail, but if you use "import" instead of "requires" then "import optional" or "import public" both make sense ;)

Re: is ClassLoader.loadClass() supposed to work on module-info classes?

2015-12-04 Thread Stephane Epardaud
On 04/12/2015 15:21, David M. Lloyd wrote: IIRC there is *already* within Java 9 an option to compile against previous JDK ABIs (which are bundled with JDK 9), isn't there? Ah that's interesting, I got hit by calls to byteBuffer(int) which compiled in JDK9 to ByteBuffer.position(int) which

Re: Running module jar programatically

2015-12-02 Thread Stephane Epardaud
9 yet :( [not interested in IDE suggestions or any IDE flame war]. On 02/12/15 16:24, Stephane Epardaud wrote: > Hi, > > I have a modular jar produced by Java 9 EA + Jigsaw, I can run it with > "java -mp mlib -m my.module", but how can I run it programmatically in Java? > >

Re: Running module jar programatically

2015-12-02 Thread Stephane Epardaud
A bit off-topic, but I wanted to clarify something, in case my many questions sound negative: I think you guys have done a tremendous job with Jigsaw, and IMO the hardest is behind you, I can see there was a huge amount of work (well, you started it in Java 7…) to get to his point, and I feel that

Running module jar programatically

2015-12-02 Thread Stephane Epardaud
Hi, I have a modular jar produced by Java 9 EA + Jigsaw, I can run it with "java -mp mlib -m my.module", but how can I run it programmatically in Java? ATM I'm using URLClassLoader to load it and run it, but I _think_ it does not make it "modular" and the module package visibility checks are turn

Re: is ClassLoader.loadClass() supposed to work on module-info classes?

2015-12-02 Thread Stephane Epardaud
On 02/12/15 14:56, Alan Bateman wrote: > The this_class should be /module-info but in any case, The funny thing is that this module-info.class was created by the Java 9+Jigsaw EA "stock" javac. How it got the ".Test" class mixed up in there is not clear to me. Perhaps as a result of me specifyi

is ClassLoader.loadClass() supposed to work on module-info classes?

2015-12-02 Thread Stephane Epardaud
Just tried it and got: Exception in thread "main" java.lang.ClassFormatError: Illegal class name "com.ceylon.java9.Test" in class file module-info at java.lang.ClassLoader.defineClass1(java.base@9.0/Native Method) at java.lang.ClassLoader.defineClass(java.base@9.0/ClassLoader.java:854)

Re: Question about jdk.internal.HotSpotIntrinsicCandidate

2015-12-02 Thread Stephane Epardaud
On 01/12/15 22:04, Alex Buckley wrote: > There shouldn't be any surprise here. In Java SE 8, you can declare a > package-private annotation type and use it to write annotations on > public classes of that package. Going up a level in Java SE 9, you can > declare a module-private annotation type (

Re: So long bootclasspath!

2015-12-01 Thread Stephane Epardaud
On 30/11/15 17:14, Alan Bateman wrote: > I assume you mean it can't access the types in > sun.reflection.annotation rather than can't see them. In any case, it > is a shame that there are types here that are used in annotation > serialization. You can workaround it by using -XaddExports, document

Question about jdk.internal.HotSpotIntrinsicCandidate

2015-12-01 Thread Stephane Epardaud
Hi, I'm using reflection to walk classes and methods, and walking java.lang.Object.hashCode() I get an annotation of type jdk.internal.HotSpotIntrinsicCandidate, which does not appear to be exported by java.base (it exports jdk but not jdk.internal). Is that intentional? I would have thought that

So long bootclasspath!

2015-11-30 Thread Stephane Epardaud
Well… turns out we were using it :( We have a weird situation with Ceylon which is that we include a forked javac (based on 1.7 with backports from 1.8), along with javax.lang.model, which allow us to both compile and run in Java 7 and Java 8. And we use the bootclasspath to tell the JVM to use ou

Re: Questions about the Jigsaw EA builds

2015-11-27 Thread Stephane Epardaud
OK thanks a lot for all these answers, it's much clearer for me now :)

Questions about the Jigsaw EA builds

2015-11-27 Thread Stephane Epardaud
Hi, I work on Ceylon, a JVM language, using a fork of javac 7 with backports from javac 8, and currently trying to see how to make it work with Java 9, which is interesting in our case as Ceylon already has modularity and adopted the JDK modularisation (as it was planned in Jigsaw) since Java 7.