Re: Accessing module internals from bytecode rewriting agent

2017-04-24 Thread Alan Bateman
On 25/04/2017 07:29, Jeremy Manson wrote: Ah, then it sounds as if I just don't know what I'm doing. Any pointers? This should help: http://download.java.net/java/jdk9/docs/api/java/lang/instrument/Instrumentation.html#redefineModule-java.lang.Module-java.util.Set-java.util.Map-java.util.Map

Re: Getting the automatic module name of non-modular JAR

2017-04-24 Thread Alan Bateman
On 24/04/2017 21:23, Gunnar Morling wrote: Hi, Given a non-modular JAR (e.g. represented as Path), what's the easiest way to obtain the automatic module name derived for this JAR? If you just want the name then it might be more efficient to do it with a regular expression. I found the foll

Re: Accessing module internals from bytecode rewriting agent

2017-04-24 Thread Alan Bateman
On 25/04/2017 07:22, Jeremy Manson wrote: : The instrument API specifically supports a Boot-Class-Path attribute in the MANIFEST, as well as Instrumentation.appendToBootStrapClassLoaderSearch. I had been using that as a way to make it possible to rewrite JDK internals (add allocation instrumen

Re: Accessing module internals from bytecode rewriting agent

2017-04-24 Thread Alan Bateman
On 25/04/2017 04:26, Martin Buchholz wrote: : java.lang.IllegalArgumentException: illegal lookupClass: class java.util.PriorityQueue Bytecode rewriting agents have the power to inject code into classes; they should somehow also be able to reflectively inspect those same classes! But how? We r

Re: Review Request: 8179025: Exclude deployment modules from FieldSetAccessibleTest.java and VerifyJimage.java

2017-04-24 Thread Alan Bateman
On 25/04/2017 02:58, Mandy Chung wrote: : Indeed looks a little odd. I prefer using isPresent since this method intends to return true if the target is not in the resolved graph. return !cf.findModule(target).isPresent(); Lots of ways to this, what you have looks okay to me. -Alan

Accessing module internals from bytecode rewriting agent

2017-04-24 Thread Martin Buchholz
We've been playing with byteman. If I have a simple rule that accesses a private field, RULE trace java.util.PriorityQueue_add CLASS java.util.PriorityQueue METHOD add AT EXIT IF true DO traceln(java.util.Arrays.toString($0.queue)) ENDRULE Then with jdk8 I get output like: [1, 2, 3] but in jd

Re: Review Request: 8179025: Exclude deployment modules from FieldSetAccessibleTest.java and VerifyJimage.java

2017-04-24 Thread Mandy Chung
> On Apr 23, 2017, at 4:09 AM, Alan Bateman wrote: > > On 22/04/2017 16:42, Mandy Chung wrote: > >> Have an explicit list is another alternative. OTOH I think only deployment >> modules will name with these words though which was what I initially want to >> cover. >> >> Since only 4 modules

Re: Java Platform Module System

2017-04-24 Thread Alex Buckley
On 4/24/2017 5:22 PM, Stephan Herrmann wrote: Obviously, defining JPMS is not done in index.html itself but delegated to individual documents. One of the linked documents is a version of JLS with changes on behalf of JSR 376. Jay's question was triggered by the observation that this exact versi

Re: Java Platform Module System

2017-04-24 Thread Stephan Herrmann
On 24.04.2017 18:18, mark.reinh...@oracle.com wrote: 2017/4/24 9:14:31 -0700, ja...@outlook.in: The JLS makes references to the "Java Platform Module System" in several places but we are not sure where this is specified. The Eclipse JDT team has been making do with whatever informal documents we

Getting the automatic module name of non-modular JAR

2017-04-24 Thread Gunnar Morling
Hi, Given a non-modular JAR (e.g. represented as Path), what's the easiest way to obtain the automatic module name derived for this JAR? I found the following: Path nonModularJar = ...; String automaticModuleName = ModuleFinder.of( nonModularJar ) .findAll() .iterator()

hg: jigsaw/jake/jdk: Make it easy to validate the modules on the module path

2017-04-24 Thread alan . bateman
Changeset: 12dd6436acea Author:alanb Date: 2017-04-24 20:05 +0100 URL: http://hg.openjdk.java.net/jigsaw/jake/jdk/rev/12dd6436acea Make it easy to validate the modules on the module path ! src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java ! src/java.base/share/cl

Re: Alternatives for naming automatic modules, and a proposal (#AutomaticModuleNames)

2017-04-24 Thread mark . reinhold
2017/4/24 10:39:25 -0700, Brian Fox : > On Mon, Apr 24, 2017 at 12:14 PM, mark.reinh...@oracle.com wrote: >> The problem with any approach that allows you to give a stable name to >> what is otherwise an automatic module is that the API of that module is >> inherently unstable. If and when the mod

Re: Alternatives for naming automatic modules, and a proposal (#AutomaticModuleNames)

2017-04-24 Thread Brian Fox
On Mon, Apr 24, 2017 at 12:14 PM, wrote: > The problem with any approach that allows you to give a stable name to > what is otherwise an automatic module is that the API of that module is > inherently unstable. If and when the module is completely modularized > then its API will almost certainly

Re: Java Platform Module System

2017-04-24 Thread mark . reinhold
2017/4/24 9:14:31 -0700, ja...@outlook.in: > The JLS makes references to the "Java Platform Module System" in > several places but we are not sure where this is specified. The > Eclipse JDT team has been making do with whatever informal documents > we can get our hands on such as "State of the Modu

Re: Alternatives for naming automatic modules, and a proposal (#AutomaticModuleNames)

2017-04-24 Thread mark . reinhold
2017/4/3 10:34:14 -0700, Stephen Colebourne : > On [1] the conclusion given the premise is not unreasonable. The file > name can be easily changed by a developer or build tool to match the > expected module name. However, it is the premise I strongly object to: > > "The fundamental problem here is

Java Platform Module System

2017-04-24 Thread Jayaprakash Artanareeswaran
Hello everyone, The JLS makes references to the "Java Platform Module System" in several places but we are not sure where this is specified. The Eclipse JDT team has been making do with whatever informal documents we can get our hands on such as "State of the Module System", Javac etc. It woul

Re: --permit-illegal-access and non-reflective access

2017-04-24 Thread Alan Bateman
On 24/04/2017 14:53, Sander Mak wrote: : What's the idea behind this distinction? The Test class fails just as well with an IllegalAccessException without the --permit-illegal-access flag. Only, I don't get to see the problem when running with --permit-illegal-access unless the access is don

--permit-illegal-access and non-reflective access

2017-04-24 Thread Sander Mak
I was trying out the --permit-illegal-access flag with a simple class that uses an encapsulated type from the JDK by (non-reflectively) instantiating it in the main method: $ java Test Exception in thread "main" java.lang.IllegalAccessError: class Test (in unnamed module @0x7b3300e5) cannot acc

Re: setAccessible() alternative with Jigsaw - feedback on Lookup

2017-04-24 Thread Remi Forax
- Mail original - > De: "Matej Novotny" > Hi, > > thanks for your time. Comments inline. > [...] >> >> If you are looking to define a class in a new runtime package and the >> class loader that is not your implementation then you are out of luck. >> Lookup is designed for doing com

Re: setAccessible() alternative with Jigsaw - feedback on Lookup

2017-04-24 Thread Alan Bateman
On 24/04/2017 12:41, Matej Novotny wrote: : Not really sure, but it is certainly not one under our control. I suppose these "basic" classes will be loaded by, say, Wildfly as soon as you bootstrap it, before any CDI-enabled deployment takes place. The reason I picked out java.lang.Integer from

Re: setAccessible() alternative with Jigsaw - feedback on Lookup

2017-04-24 Thread Matej Novotny
Hi, thanks for your time. Comments inline. - Original Message - > From: "Alan Bateman" > To: "Matej Novotny" > Cc: jigsaw-dev@openjdk.java.net, "Martin Kouba" , "Tomas > Remes" > Sent: Thursday, April 20, 2017 10:52:04 AM > Subject: Re: setAccessible() alternative with Jigsaw - feedba

hg: jigsaw/jake/jdk: Make module resolution diagnostic output easier to read and grep

2017-04-24 Thread alan . bateman
Changeset: e331594e4367 Author:alanb Date: 2017-04-24 11:33 +0100 URL: http://hg.openjdk.java.net/jigsaw/jake/jdk/rev/e331594e4367 Make module resolution diagnostic output easier to read and grep ! src/java.base/share/classes/java/lang/module/Resolver.java ! src/java.base/share/cla

hg: jigsaw/jake/hotspot: -verbose:module should imply -Xlog:module+unload

2017-04-24 Thread alan . bateman
Changeset: d0212a5d61a4 Author:alanb Date: 2017-04-24 09:13 +0100 URL: http://hg.openjdk.java.net/jigsaw/jake/hotspot/rev/d0212a5d61a4 -verbose:module should imply -Xlog:module+unload ! src/share/vm/classfile/moduleEntry.cpp ! src/share/vm/runtime/arguments.cpp ! test/runtime/loggi

Re: Changing the default file system provider is broken :(

2017-04-24 Thread Alan Bateman
On 23/04/2017 19:28, Remi Forax wrote: : This should be added to the compatibility list because mocking the FileSystem for testing purpose is common, at least in my own bubble. I would prefer not introduce compatibility issues in this area if possible. I think the best we can do is read the