Re: Is it safe to update jar that are used for dynamic layers?

2022-05-06 Thread Alan Bateman
On 06/05/2022 12:26, Alex Orlov wrote: Hello. Please, consider the following situation. We have /home/user/temp/foo.jar that is used in dynamically created jpms layer bar. Could anyone say if it is safe to do the following: destroy layer bar, update /home/user/temp/foo.jar (modify some

Re: Current Project Status

2022-04-03 Thread Alan Bateman
On 03/04/2022 09:26, Julian Waters wrote: Out of curiosity, is the Jigsaw project still active in the background today, seeing that this mailing list is still up? The features developed by this project were integrated in JDK 9. The mailing list lives on, it is used periodically for questions,

Re: Is it better for JDK to distribute jmod files independently of JDK itself?

2022-02-08 Thread Alan Bateman
On 08/02/2022 14:17, Glavo wrote: : In addition, I think there are other better options for the out-of-the-box availability of jlink. I noticed that a copy of everything in jmod already exists in the JDK folder. In fact, jmod of JDK core module only needs to store a file list (List of paths of

Re: DFS vs BFS search of modules during resolution

2021-12-03 Thread Alan Bateman
On 03/12/2021 13:39, Michał Kłeczek wrote: Am I missing something? I think you understand it correctly. The notion of multi-parent configuration and layers is something that was added for those that were focused on interop with other class loader based systems. It was tracked as issue

Re: ModuleLayer.Controller strongly references Module

2021-11-29 Thread Alan Bateman
On 28/11/2021 22:29, Michał Kłeczek wrote: : It looks like ML.Controller.addExport(source, pn, target) does not update the target module ClassLoader view of exported packages in the default ClassLoader implementation (jdk.internal.loader.Loader). What is the reasoning behind such

Re: ModuleLayer.Controller strongly references Module

2021-11-24 Thread Alan Bateman
On 24/11/2021 18:14, Michał Kłeczek wrote: For sure it’s fun :) Regardless of “smart proxies” the lifetime of ML.Controller should be - if not fixed - at least be documented IMHO. Right now it’s a minefield. It's also somewhat unusual so I think we'll need to think if this is the right

Re: ModuleLayer.Controller strongly references Module

2021-11-24 Thread Alan Bateman
On 24/11/2021 12:19, Michał Kłeczek wrote: Hi Alan, (Disregard previous message - fat fingers) Attached is a first draft of the patch: 1. Controller is created upon ML construction and returned from static ML.defineModules methods. 2. Created two controller liveness tests (they rely on

Re: ModuleLayer.Controller strongly references Module

2021-11-22 Thread Alan Bateman
On 22/11/2021 07:23, Michał Kłeczek wrote: Would it be too much to ask for accepting a patch adding a reference to ML.Controller to ModuleLayer? It wouldn’t require changes to the spec I think as the lifetime of ML.Controller is unspecified. Assuming it's not exposed, and that there is no

Re: Alternative to fatJar - modular solution?

2021-10-11 Thread Alan Bateman
On 11/10/2021 15:09, Glavo wrote: I think this is a great prototype. Based on it, I think such requirements can also be realized by enhancing jar in these aspects: 1. Nested jar file system (The ujar file system seems unnecessary. I never understand why jar file systems cannot be

Re: Alternative to fatJar - modular solution?

2021-10-09 Thread Alan Bateman
On 06/10/2021 18:24, Glavo wrote: For a long time, unpacking and repackaging all dependencies into a file called fatJar was the first choice for single file distribution of Java programs. However, the compatibility of this solution with JPMS is very poor - it breaks up all the modules and works

Re: Alternative to fatJar - modular solution?

2021-10-09 Thread Alan Bateman
On 09/10/2021 05:34, Samuel Audet wrote: One problem is that frameworks like Spring Boot need to scan the classes that are available in a module, to get a list of the names of all the classes, among other things. The JDK provides no standard way to do that. For example, how would you implement a

Re: module resource loading - opens {package} when {package} only holds resources

2021-09-21 Thread Alan Bateman
On 20/09/2021 23:15, Rob Bygrave wrote: /:/ In case it's interesting, one thing that I hit when migrating to module-info was that a number of the modules are only used in maven test scope - as such they don't get a /requires/ clause in src/main/java/module-info. Currently when running tests

Re: jlink SystemModulesPlugin use of hashCode breaks reproducibility

2021-09-21 Thread Alan Bateman
On 20/09/2021 12:07, Craig Raw wrote: Sure - I'm using the Gradle badass-jlink-plugin. The command it is executing is: /Users/craigraw/.sdkman/candidates/java/16.0.1.hs-adpt/bin/jlink -v --strip-debug --compress 2 --no-header-files --no-man-pages --ignore-signing-information --exclude-files

Re: module resource loading - opens {package} when {package} only holds resources

2021-09-20 Thread Alan Bateman
On 20/09/2021 11:13, Rob Bygrave wrote: Well ok, silly me really because I think it is now clear that the "proper answer" is that the module really needs to open the subdirectories. opens dbmigration.postgres; opens dbmigration.mysql; So thanks and apologies Alan. It's all making sense to me

Re: jlink SystemModulesPlugin use of hashCode breaks reproducibility

2021-09-20 Thread Alan Bateman
On 20/09/2021 07:52, Craig Raw wrote: Hi, While I've noticed significant improvements in making reproducible builds with JDK 16, there is a remaining issue I'm stumped by. The issue is this: Using jlink invokes the SystemModulesPlugin, which creates .class files containing module descriptors

Re: module resource loading - opens {package} when {package} only holds resources

2021-09-20 Thread Alan Bateman
On 20/09/2021 09:55, Rob Bygrave wrote: Hi, I have a case where I believe I have a module where I would like to use: opens {package}; ... *where {package} only contains resources*, there are no .class files in {package}. Currently when {package} only contains resources, we get an

Re: Modules with platform specific parts

2021-09-15 Thread Alan Bateman
On 15/09/2021 09:45, Johan Vos wrote: Hi, There have been discussions in the past about how to deal with platform-specific parts (java code, native code, resources) in modules. There is no standard for this, and afaik no recommendation. In the OpenJFX project, we upload jars with module info to

Re: Portable retrieval of resource bundles across module path and class path

2021-07-23 Thread Alan Bateman
On 23/07/2021 18:23, Gunnar Morling wrote: : Yes, I'm quite sure, unless I'm doing something really stupid :) Here's the steps for reproducing: git clone g...@github.com:gunnarmorling/resource-bundle-test.git git checkout split-package cd resource-bundle-test mvn clean install jar -tf

Re: Portable retrieval of resource bundles across module path and class path

2021-07-23 Thread Alan Bateman
On 23/07/2021 16:58, Gunnar Morling wrote: : Yes, there is such resource which I had created for demo purposes (see the jar -tf  output above): dev/morling/greeter/fr/GreetingMessages_de.properties Here's the output you requested: jar --describe-module --file

Re: Portable retrieval of resource bundles across module path and class path

2021-07-23 Thread Alan Bateman
On 23/07/2021 12:17, Gunnar Morling wrote: : > For the migration scenario where the resources are in .properties format then the simplest may be to just deploy the JAR files on the module path where they will be treated as automatic modules. In the scenario I have in mind (for educational

Re: Portable retrieval of resource bundles across module path and class path

2021-07-23 Thread Alan Bateman
On 22/07/2021 23:30, Mandy Chung wrote: I assume the class path is running on JDK <= 8, right? Otherwise This is a reasonable approach for the resource bundles to load from both class path and module path when the resource bundles of a given name is packaged in multiple modules/JARs. We

Re: Requires runtime considered?

2021-06-28 Thread Alan Bateman
On 28/06/2021 09:49, Christian Beikov wrote: Hello experts, I am in the process of modularizing one of my projects and hit some rather annoying limitations that requires me to change parts of my build and dependencies due to the way the Java module system works. I usually have modules like

Re: Module resource loading

2021-06-09 Thread Alan Bateman
On 08/06/2021 20:20, Alexey Gavrilov wrote: Note that *Module 2* cannot contain its own resources under `dir1` and `dir2` directories because they are already encapsulated in *Module 1*. If you try adding `dir1` you will get the following error: Error occurred during initialization of boot

Re: Fwd: Add reads to open module

2021-05-17 Thread Alan Bateman
On 17/05/2021 16:43, Christian Beikov wrote: Hi, I have a use case where I generate some code and that code refers to classes of some module B. When the module A (an open module), into which I define that class, has no read-edges to the module B, this fails saying that A does not read B.

Re: Opening -javaagent classes to named modules

2021-05-11 Thread Alan Bateman
On 11/05/2021 16:10, Fabian Meumertzheim wrote: I am currently working on a JVM fuzzer ( https://github.com/CodeIntelligenceTesting/jazzer/) and would like to apply it also to classes delivered with the JDK, e.g. the image parsers in javax.imageio.* in the java.desktop module. The fuzzer uses a

Re: Difference of module jdk.xml.dom and module jdk.zipfs

2021-03-26 Thread Alan Bateman
On 26/03/2021 10:09, Christian Stein wrote: Thank you for the clarification, Alan. First, I fixed the problem as you suggested by adding --add-modules ALL-SYSTEM to the java command. It yielded warnings about incubator modules, though:   WARNING: Using incubator modules:  

Re: Difference of module jdk.xml.dom and module jdk.zipfs

2021-03-25 Thread Alan Bateman
On 25/03/2021 14:59, Christian Stein wrote: Hi, Besides their names, contents and purposes. (-: So, what's the difference of module jdk.xml.dom and module jdk.zipfs in respect to their visibility(?) at compile and run-time? Suppose, there's a module test.base declared as: module test.base

Re: Add information of which automatic module doesn't the

2021-03-25 Thread Alan Bateman
On 25/03/2021 14:11, Christian Stein wrote: On Wed, Mar 3, 2021 at 10:10 AM Alan Bateman <mailto:alan.bate...@oracle.com>> wrote: [...] Thanks, it should include the file path to the JAR file in the message to make it easy to find the JAR file that can'

Re: New candidate JEP: 403: Strongly Encapsulate JDK Internals

2021-03-25 Thread Alan Bateman
On 25/03/2021 10:54, Andrew Haley wrote: : Looking at the JEP, I don't immediately see anything about long-term use of illegal accesses in test code. There are a good many cases where we need to test private and protected classes and fields, for example. Is there a proposal to allow this? I

Re: Add information of which automatic module doesn't the

2021-03-03 Thread Alan Bateman
On 03/03/2021 01:32, Thiago Henrique Hupner wrote: When running some old applications in the module path, sometimes a jar provides a service that doesn't exist in it. So, the module system correctly informs about it, however, it doesn't specify which module has this issue, so the way of

Re: Is RuntimePermission.accessClassInPackage now redundant?

2021-02-16 Thread Alan Bateman
On 15/02/2021 19:45, Mike Hearn wrote: Hello, I was reviewing the default security policy and noticed quite a few modules are given accessClassInPackage permissions to e.g. packages in the sun.* hierarchy. Are the SecurityManager/ClassLoader based package control still needed now the module

Re: jlink images and module layers

2021-02-11 Thread Alan Bateman
On 10/02/2021 21:44, Gunnar Morling wrote: Hi Alan, Thanks for your thoughtful reply. The use case I'd see for layers within jlink images is isolation of different (transitive) dependency versions within an application. While this isn't present (and I understand it'd add a fair share of

Re: jlink images and module layers

2021-02-06 Thread Alan Bateman
On 05/02/2021 15:39, Gunnar Morling wrote: Hi all, While working on Layrry [1] [2] [3], a launcher and runtime for layered Java applications, I've come to wonder whether there's a way for sourcing multiple module layers from a custom runtime image created via jlink? I couldn't find a way so

Re: IllegalAccessError with --patch-module

2021-01-07 Thread Alan Bateman
On 07/01/2021 13:06, Johannes Kuhn wrote: : To be honest - I don't quite understand the bug - but I was able to reproduce it. So I did manually retrace the code to see where the difference was happening, and found the lines above - which was "good enough" for an explanation. Resolution

Re: IllegalAccessError with --patch-module

2021-01-07 Thread Alan Bateman
On 06/01/2021 23:49, Johannes Kuhn wrote: Indeed a bug. Happens under the following conditions: * Patched module is an automatic module * Patch adds one or more additional packages to the module. : Proposed fix: * Change requires to not check if it is an automatic module if the builder is

Re: IllegalAccessError with --patch-module

2021-01-06 Thread Alan Bateman
On 06/01/2021 19:57, Thiago Henrique Hupner wrote: Sorry, they are automatic modules. I'll create a test case. Also if you can include the output with --show-module-resolution then it might help track this down quickly (running without any explicit modules on the module path is, on the

Re: IllegalAccessError with --patch-module

2021-01-06 Thread Alan Bateman
On 06/01/2021 19:15, Thiago Henrique Hupner wrote: Hi! I've noticed something strange, but I don't know if it is a bug: If we have two jars: module.a with the class com.foo.Bar module.b with the classes com.foo.Bar and com.foo.Main. Running: java -p module-a.jar

Re: Should ClassLoader::getResouces return the same resource twice?

2021-01-04 Thread Alan Bateman
On 03/01/2021 13:10, Thiago Henrique Hupner wrote: : I hope made it a little more clear. By now it is clear that it is loading the same resource twice because the same jar is in the classloader and in the module layer classloader. If I read your mail correctly you've got a class path today and

Re: Making jlink Plug-in API public

2021-01-04 Thread Alan Bateman
On 29/12/2020 19:29, Gunnar Morling wrote: : That's interesting; what is missing from your PoV to make the API an incubating one? Getting consensus that it's the right thing to do, and then the commitment to doing it. The latter requires re-examining the internal plugin API, looking at the

Re: Should ClassLoader::getResouces return the same resource twice?

2021-01-02 Thread Alan Bateman
On 02/01/2021 12:59, Thiago Henrique Hupner wrote: I guess a little context can make more things clear: The servlet spec requires that all jars from WEB-INF/lib be available to the same classloader. The resource, in particular, is "META-INF/web-fragment.xml" Each jar can contain its own. So,

Re: Should ClassLoader::getResouces return the same resource twice?

2021-01-01 Thread Alan Bateman
On 02/01/2021 03:21, Thiago Henrique Hupner wrote: : I've created a simple example of what is occurring [1]. I know there are behavior specific for getting a class if it is in a module, but I don't know if this may be a bug in the resource loading mechanism. In the example, the returned values

Re: Why is it allowed to have several modules with the same name?

2020-12-28 Thread Alan Bateman
On 27/12/2020 09:50, Gunnar Morling wrote: Thanks for clarifying, Alan. So it is intended and well-documented, it's still not quite clear to me though *why* that is. Wouldn#t it be more in line with the module system's goal of reliability to reject such error-prone configuration? Reliable

Re: Making jlink Plug-in API public

2020-12-28 Thread Alan Bateman
On 25/12/2020 10:29, Gunnar Morling wrote: Hi all, Are there any plans for making the jlink Plug-in API public any time soon, perhaps for JDK 17? I think the ability to implement custom plug-ins that are run at linking time would open up quite a few interesting opportunities, e.g. - removing

Re: Why is it allowed to have several modules with the same name?

2020-12-26 Thread Alan Bateman
On 26/12/2020 16:26, Jonathan Gibbons wrote: If the two modules with the same name are in different positions on the module path, the first one will be seen and will completely hide any subsequent occurrences of modules with the same name. If two modules with the same name are found in the

Re: -Xdoclint unrecognized in JDK16 due to new module

2020-12-15 Thread Alan Bateman
On 15/12/2020 22:19, Jonathan Gibbons wrote: On 12/15/20 12:26 AM, Alan Bateman wrote: I think the Plexus Classworlds launcher sets a funky TCCL that impacts the ServiceLoader lookup of DocLint providers. Can the ServiceLoader usage in DocLint be changed to use the system class loader

Re: -Xdoclint unrecognized in JDK16 due to new module

2020-12-15 Thread Alan Bateman
On 14/12/2020 20:05, Benjamin Marwell wrote: Hello all, it caught my attention that doclint functionality was moved to the jdk.javadoc module [1]. Now, when calling ToolProvider.getSystemJavaCompiler().getTask(…), the presence of the option '-Xdoclint:-missing' and similar options will throw

Re: Cannot use a mapper function to get the Platform classloader

2020-12-13 Thread Alan Bateman
On 12/12/2020 15:05, Thiago Henrique Hupner wrote: Hi. I'm playing around with layers and I needed the following: Create a new layer where it doesn't have access to the boot layer using the ModuleLayer.empty(). However, I'm getting the exception that java.base is not found. So I used something

Re: Module.addOpens should log if the package has been opened for illegal access for the caller

2020-12-10 Thread Alan Bateman
On 10/12/2020 10:32, Johannes Kuhn wrote: : If a module has been reflectively opened, then no warning should emitted, right. But reflectively opening a package should emit such a warning if you can only do that because it has been opened to you for illegal access. If --add-opens is used to

Re: Module.addOpens should log if the package has been opened for illegal access for the caller

2020-12-10 Thread Alan Bateman
On 09/12/2020 22:45, Johannes Kuhn wrote: Hope I got the right mailing list, otherwise please direct me there. Module.addOpens currently doesn't produce an illegal access warning if the target package has only be opened for illegal access. The Module methods were not intended to emit

Re: Find service in a layer with multiple classloaders[2]

2020-12-04 Thread Alan Bateman
On 04/12/2020 14:25, Alex Orlov wrote: Sorry, there was a typo in the previous message. Correct > As I understand to find * FooService * in this layer we can use class loader of ANY module in this layer (any of a,b,c)... Yes, you can specify any of the class loaders to load(service,

Re: MethodHandles.publicLookup().in() returns Lookup with no permissions?

2020-11-24 Thread Alan Bateman
On 24/11/2020 18:21, Simone Bordet wrote: Hi, testing the Jetty MethodHandle usages we encountered this situation: .class org.openjdk.mh.Main Class klass = Main.class; MethodHandles.Lookup lookup = MethodHandles.publicLookup().in(klass); MethodHandle handle = lookup.findVirtual(klass,

Re: Why service provider method is called "provider", but not "provide"?

2020-11-24 Thread Alan Bateman
On 24/11/2020 06:46, Alex Orlov wrote: Could you then explain the difference between service and service provider? As I understand you’re saying they are the same. The second paragraph of the class description attempts to establish the terminology. The "service" is the well known interface,

Re: Why service provider method is called "provider", but not "provide"?

2020-11-23 Thread Alan Bateman
On 23/11/2020 08:28, Alex Orlov wrote: I don’t agree with that. It returns the object that is an instance of the service. The method returns an instance of the service provider. The enhancements to ServiceLoader in Java 9 were tracked as #ServiceLoaderEnhancements [1], the link to

Re: JPMS layer graph type

2020-11-20 Thread Alan Bateman
On 17/11/2020 19:44, Alex Orlov wrote: Hello all, I try to determine the type of JPMS layers graph and as I understand it is a directed acyclic graph. Could anyone say if this is right or wrong. Yes, the graph of module layers is a DAG. -Alan.

Re: add-opens for dynamically created layers

2020-11-17 Thread Alan Bateman
On 16/11/2020 21:07, Alex Orlov wrote: Hello Alan, Thank you very much for your help. With ModuleLayer.Controller I solved the problem. Do I understand it correctly — it is impossible to get reference to boot layer controller, isn’t it? Yes, that's right. -Alan

Re: add-opens for dynamically created layers

2020-11-16 Thread Alan Bateman
On 16/11/2020 18:35, Alex Orlov wrote: : When I start my application I get: java.lang.IllegalAccessError: class org.springframework.core.log.CompositeLog (in module spring.core) cannot access class org.apache.commons.logging.impl.NoOpLog (in module org.apache.commons.logging) because

Re: How to do “--add-modules” with dynamically created layer in JPMS?

2020-11-16 Thread Alan Bateman
On 16/11/2020 09:17, Alex Orlov wrote: Hello Alan, Thank you for such detailed answer. I read it with attention, but still don’t know how to solve my situation. Maybe may question didn’t provide all details, so here they are. I want to create the following layer structure: +++ + Boot

Re: How to do “--add-modules” with dynamically created layer in JPMS?

2020-11-16 Thread Alan Bateman
On 15/11/2020 19:16, Alex Orlov wrote: Hi all, I create JPMS layer this way: Configuration cf = parentLayer.configuration().resolveAndBind(moduleFinder, ModuleFinder.of(), moduleNames); ModuleLayer layer = parentLayer.defineModulesWithOneLoader(cf, parentClassLoader); And I have a

Re: @Generated requires java.compiler / what should my annotation processor do

2020-11-02 Thread Alan Bateman
On 02/11/2020 00:02, Rob Bygrave wrote: *> Since the type javax.annotation.processing.Generated has source * * retention only, there are no @javax.annotation.processing.Generated annotations in any class files compiled from source code emitted by your processor* The annotation processor

Re: Debugging while using the module system

2020-07-22 Thread Alan Bateman
On 21/07/2020 19:48, Mantas Gridinas wrote: Now that you mention it, this does occur while trying to use "Evaluate expression" which spins up bytecode and evaluates it at run time. I haven't contacted Jetbrains on this yet, but I'll open an issue on their tracker as well. This may be a good

Re: Debugging while using the module system

2020-07-21 Thread Alan Bateman
On 20/07/2020 21:25, Mantas Gridinas wrote: Hi! Recently I've moved my project to the module system from regular classpath jars. Currently I'm using Adopt OpenJDK11 builds and for debugging I provide the -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:5005 command line

Re: RFR JDK-8217527: jmod hash does not work if --hash-module does not include the target module

2020-07-18 Thread Alan Bateman
On 17/07/2020 19:45, Mandy Chung wrote: Webrev: http://cr.openjdk.java.net/~mchung/jdk16/webrevs/8217527/webrev.00/ The current implementation jmod hash ignores the target jmod file if specified. Therefore even B requires A: $ jmod hash --hash-module B --module-path jmods jmods/A.jmod This

Re: Force JPMS to add module to boot layer

2020-06-23 Thread Alan Bateman
On 22/06/2020 18:15, Alex Orlov wrote: Hi Alan, Thank you very much for your answer. In order to be concrete a test project was created and it is here https://github.com/PashaTurok/hibernate-h2-test4 Besides, if it is not very difficult for you, could you answer separately to each questions

Re: Force JPMS to add module to boot layer

2020-06-22 Thread Alan Bateman
On 21/06/2020 19:52, Alex Orlov wrote: Hi all, New version of maven-failsafe-plugin (3.0.0-M5) has been released and now it is possible to have two module-info in one project — one in src/main/java and one in src/test/java  and to test modules on module -path. Trying to use it I found the

Re: 8241770: Module xxxAnnotation() methods throw NCDFE if module-info.class found as resource in unnamed module

2020-06-11 Thread Alan Bateman
On 10/06/2020 22:22, Mandy Chung wrote: Nit: A typo in the test s/reflectingly/reflectively/ 102 * Test reflectingly reading annotations on a named module where the module That typo was in two places and I only spotted one of them when creating the webrev. I'll fix the second one before

8241770: Module xxxAnnotation() methods throw NCDFE if module-info.class found as resource in unnamed module

2020-06-10 Thread Alan Bateman
This is a bug in Module.getXXXAnnotation implementation where it accidentally locates a module-info.class on the class path (say if someone deploys a modular JAR on the class path). An oversight in the original implementation. Simple fix to override loadClass to do the right thing. I've

Re: Is it possible to add classes to JPMS module dynamically?

2020-06-04 Thread Alan Bateman
On 04/06/2020 13:34, Alex Orlov wrote: Hi all, Let's suppose we have a JPMS module moduleA with the following module-info : module moduleA { exports modulea.generated; } Now, using javassist/byte-buddy we generate new modulea.generated.Foo class. Could anyone say if we can add this

Re: jlink 14.0.1 with 100 modules fail

2020-05-31 Thread Alan Bateman
On 30/05/2020 17:40, Christian Stein wrote: Hi, the modular [bach-demo-99] I generated to check my build tool against, failed to create a custom runtime image using jlink via itsToolProvider-based service entry-point. The project consists of 100 module descriptors. No other Java source

Re: RFR 8246034: Remove java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js and java.base/share/classes/jdk/internal/jrtfs/jrtls.js

2020-05-28 Thread Alan Bateman
On 28/05/2020 07:14, sundararajan.athijegannat...@oracle.com wrote: Please review. Bug: https://bugs.openjdk.java.net/browse/JDK-8246034 Webrev: http://cr.openjdk.java.net/~sundar/8246034/webrev.00/ Have you checked if there are any make file configured to copy .js files? Otherwise looks

Re: JPMS module-path and layers

2020-05-19 Thread Alan Bateman
On 19/05/2020 09:00, Alex Orlov wrote: Hi all, I want to understand all details of module-path and layers in java9+ and I have two questions: * As I understand modules on module-path are added automatically only to boot layer and not added automatically to any other layers. I mean, if any

Re: JavaCompiler called from JPMS module

2020-05-16 Thread Alan Bateman
On 16/05/2020 17:53, Alex Sviridov wrote: : When H2 is on classpath I don't have any problems - trigger is compiled. However, when H2 is on module path (H2 has in manifest Automatic-Module-Name: com.h2database) on some of child layers (not boot layer) I get the following `output`:    

Re: Review Request 8240910: jmod rejects duplicate entries in --class-path jars

2020-05-07 Thread Alan Bateman
On 07/05/2020 19:39, Mandy Chung wrote: I have taken a further step to clean this up by recording the written entries such that it can filter out duplicated entries properly: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8240910/webrev.01/ This version looks okay to me as it cleans up the

Re: RFR: JDK-8241602 jlink does not produce reproducible jimage filesJ

2020-05-06 Thread Alan Bateman
On 06/05/2020 15:45, Jim Laskey wrote: http://cr.openjdk.java.net/~jlaskey/8241602/webrev-02 This version looks okay to me. -Alan.

Re: RFR: JDK-8241602 jlink does not produce reproducible jimage filesJ

2020-05-06 Thread Alan Bateman
On 06/05/2020 14:42, Jim Laskey wrote: : Aside: The order in the file is still somewhat scattered, based on archive and archive content.  We have the a pattern based sorting plugin which we don't use and we never did any locality vs performance testing. Not in the test but the JDK does use

Re: RFR: JDK-8241602 jlink does not produce reproducible jimage files

2020-05-06 Thread Alan Bateman
On 05/05/2020 20:56, Jim Laskey wrote: This fix addresses the inconsistent ordering by jimage content by jlink from run to run. Bottom line, the implementer was using HashSet without defining hashcode/equals for the Set entry classes. webrev:

8243596: ModuleLayer::parents should return an unmodifiable list

2020-05-05 Thread Alan Bateman
This is an small oversight and inconsistency that crept in when the ModuleLayer was updated to support multiple parents. The list of parent layers returned by the parents() method should be specified (and implemented) to return an unmodifiable list. It currently returns a modifiable list.

8243666: ModuleHashes attribute generated for JMOD and JAR files

2020-04-27 Thread Alan Bateman
This is build reproducibility issue with the module-info.class files in the packaged modules (JMOD files in the case of the JDK build). One part to this is the ModulePackages class file attribute that is added by the tools, including the jmod tool and the AddPackagesAttribute tool in the

Re: RFR (T): 8242846: removed an empty file test/jdk/tools/jlink/plugins/OrderResourcesPluginTest.java

2020-04-25 Thread Alan Bateman
On 21/04/2020 04:58, Ao Qi wrote: On 2020/4/20 下午9:27, Alan Bateman wrote: On 20/04/2020 11:32, sundararajan.athijegannat...@oracle.com wrote: Hi Alan, I don't remember it now. Likely a mistake. The changeset http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/a066fe7b1b42 has that file. Perhaps

Re: BackEnd Service Provider.

2020-04-22 Thread Alan Bateman
On 21/04/2020 14:01, Doug Simon wrote: Hi Gary, I cannot understand why --add-reads does not work and have reached out to Alan Bateman for more insight. I read through the thread [1] and I don't see an obvious solution to this. The main issue here is that org.grfstuff.compiler wants

Re: RFR (T): 8243117: Cleanups in Java code of module jdk.jlink

2020-04-20 Thread Alan Bateman
On 19/04/2020 20:08, Langer, Christoph wrote: Hi Alan, Looks okay to me too, except @SuppressWarnings("unused") looks strange, is that an Eclipse compiler warning name? Yes, it comes from Eclipse, probably only used by its compiler. The private field EXIT_SYSERR doesn't seem to be used.

Re: RFR (T): 8242846: removed an empty file test/jdk/tools/jlink/plugins/OrderResourcesPluginTest.java

2020-04-20 Thread Alan Bateman
On 20/04/2020 11:32, sundararajan.athijegannat...@oracle.com wrote: Hi Alan, I don't remember it now. Likely a mistake. The changeset http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/a066fe7b1b42 has that file. Perhaps it may be useful to restore & check if the test passes. Yes. I think it was

Re: RFR (T): 8243117: Cleanups in Java code of module jdk.jlink

2020-04-19 Thread Alan Bateman
On 19/04/2020 17:31, Claes Redestad wrote: Looks good to me, Christoph, JmodTask.java: Not sure what the consensus is about wildcard imports, but I'm fine with it here. Looks okay to me too, except @SuppressWarnings("unused") looks strange, is that an Eclipse compiler warning name? -Alan

Re: Cross module single ServiceProvider for JPMS services

2020-04-19 Thread Alan Bateman
On 19/04/2020 16:05, Uwe Schindler wrote: Hi Alan, from what I understood: He has some utility method in a shared class that wraps ServiceLoader to discover services and do something with it (the usual way to prevent code duplication). Problem is that ServiceLoade.load() is caller-sensitive,

Re: Cross module single ServiceProvider for JPMS services

2020-04-19 Thread Alan Bateman
On 19/04/2020 15:00, Alex Sviridov wrote: Hi all, Let's suppose we have modules (A, B, C..) and every module consumes and provides services. To find these services I want to create one util class, for example ServiceProvider that will be used by all modules to get necessary services. There

Re: Loading an automatic module from an exploded directory

2020-04-19 Thread Alan Bateman
On 18/04/2020 23:04, Eirik Bjørsnøs wrote: : Could we update ModulePath could to detect "automatic module directories"?. Any directory path name ending with ".jar" could be loaded as an automatic directory module, with the same semantics as if the directory was zipped into a JAR. This 

Re: Loading an automatic module from an exploded directory

2020-04-18 Thread Alan Bateman
On 10/04/2020 17:48, Eirik Bjørsnøs wrote: I once had the pleasure of debugging a system which after running in production for a few days would suddenly start returning 404 errors. Turned out someone (me) had forgotten to specify where Jetty should unpack its WAR files. So they ended up on

Re: RFR (T): 8242846: removed an empty file test/jdk/tools/jlink/plugins/OrderResourcesPluginTest.java

2020-04-18 Thread Alan Bateman
Sundar - do you recognize this? I assume truncating this test to 0 bytes was a mistake but I can't tell if the test should be brought back or not (to ensure that`jlink --order-resources` is tested). -Alan On 17/04/2020 11:34, Ao Qi wrote: Hi, The original email is waiting for moderator

Re: Classloading with multiple parent layers JDK11 vs JDK14

2020-04-18 Thread Alan Bateman
On 17/04/2020 21:11, Alex Sviridov wrote: Hi all, I have the following layers: LayerA (moduleA)                   LayerB (moduleB)              |_|                                  |                    LayerC(moduleC) LayerC has two parent layers layerA and

Re: RFR 8242860: test/jdk/tools/jlink/ModuleNamesOrderTest.java uses nashorn module

2020-04-17 Thread Alan Bateman
On 17/04/2020 07:21, sundararajan.athijegannat...@oracle.com wrote: Hi, nashorn modules were used only as an example in this test. Using jdk.jshell module instead to test known module dependencies in jlink produced images. Please review. Bug: https://bugs.openjdk.java.net/browse/JDK-8242860

Re: RFR: 8242452: During module definition, move conversion of packages from native to VM

2020-04-16 Thread Alan Bateman
On 16/04/2020 00:04, Ioi Lam wrote: Hi Claes, This is very good optimization. I have a few nit picks: [1] I think the following is unnecessary. The original Java_java_lang_Module_defineModule0 and GetInternalPackageName function did not perform null check or type check. I think this

Re: How does classloading work with multiple child layers?

2020-04-15 Thread Alan Bateman
On 15/04/2020 12:45, Alex Sviridov wrote: Hi Alan, Thank you very much for such detailed answer! Only one note — is the following paragraph right?   «When Child2 is created it will create L2 and map moduleC to L2. When code in moduleC tried to resolve a reference to a class in its own

Re: How does classloading work with multiple child layers?

2020-04-15 Thread Alan Bateman
On 14/04/2020 20:48, Alex Sviridov wrote: Hello everybody, I try to understand how classloading works when there are multiple child layers and have a problem. Let's consider the following situation. There are three layers. BootLayer (moduleA) | |___Child1(moduleB)    

Re: excluding transitive module

2020-04-14 Thread Alan Bateman
On 14/04/2020 09:24, Jochen Theodorou wrote: Hi all, I am wondering if there is a solution purely in the module-info for this: * Project requires Library1 and Library2 * SomeLibrary requires SharedApi * OtherLibrary requires SharedApiImpl The problem is, that it will not compile because

Re: Loading an automatic module from an exploded directory

2020-04-10 Thread Alan Bateman
On 10/04/2020 11:14, Eirik Bjørsnøs wrote: : Since ModuleReader already has the list() method, code in java.lang.module could use that to scan for packages and service names it needs to derive automatic ModuleDescriptors. Clients would now only need to pass the custom module reader and a

Re: Loading an automatic module from an exploded directory

2020-04-10 Thread Alan Bateman
On 10/04/2020 10:53, Eirik Bjørsnøs wrote: : Is it safe to assume that all access to content with a module happens through the ModuleReader? Yes, the ModuleReader is the only way to access the contents of a module so you'll see all class loading, finding resources, etc. all go through the

Re: Loading an automatic module from an exploded directory

2020-04-10 Thread Alan Bateman
On 09/04/2020 19:23, Eirik Bjørsnøs wrote: Alan, If I read your mail correctly, you are creating "multi-module JAR files" where the modules are "exploded" under /META-INF/modules in ${NAME}-${VERSION} directories. Correct. Do they need to be "exploded"? If the dependences are

Re: Loading an automatic module from an exploded directory

2020-04-09 Thread Alan Bateman
On 09/04/2020 16:42, Eirik Bjørsnøs wrote: The current implementation of automatic modules seems to assume that an automatic module is always packaged as a jar file. I'm working on a module runtime where this is not always the case, and the limitation has become a bit of a challenge. I want to

Re: missing resources when using --patch-module

2020-04-03 Thread Alan Bateman
On 03/04/2020 12:46, Tom De Wolf wrote: Hi, I understand that for individual classes and non-java resources a patch should replace them. However for directories which are actually java packages this seems to be odd. Does this not make it impossible to add a new class to an existing package

Re: missing resources when using --patch-module

2020-04-03 Thread Alan Bateman
On 03/04/2020 10:17, Robert Scholte wrote: This issue was registered as SUREFIRE-1768[1] It contains a very small Maven project to demonstrate the issue. That project contains one method executing the following: Demo.class.getClassLoader().getResources("demo").asIterator().forEachRemaining(url

Re: jlink fails with "Hash of java.xyz differs to expected hash recorded in java.base"

2020-03-31 Thread Alan Bateman
On 31/03/2020 08:50, Sebastian Stenzel wrote: : This was my bug report, that's why I'm investigating to give the Ubuntu guys some tips on how they can solve it (if they caused it in the first place). ;-) Ah, didn't see it was you :-) I've seen a few reports of issues on Ubuntu go by (like

  1   2   3   4   5   6   7   8   9   10   >