Re: Avoiding sun.misc.Unsafe and embracing modules in Java libraries: missing links

2018-04-03 Thread Russell Gold
is getting harder. > On Apr 3, 2018, at 3:48 PM, Russell Gold <russell.g...@oracle.com> wrote: > > Hi Rafael, > > This is the point of multi-release jars. There is a new supported way of > creating classes. As of Java 9, you are supposed to do: > >> r

Easy multirelease jars

2018-04-03 Thread Russell Gold
have just developed a new and easier way for building MR Jars , while waiting for the capability to be built into Maven. This approach is not only simple to set up (just use the designated parent POM, if you can), it lets you unit test for

Re: Avoiding sun.misc.Unsafe and embracing modules in Java libraries: missing links

2018-04-03 Thread Russell Gold
Hi Rafael, This is the point of multi-release jars. There is a new supported way of creating classes. As of Java 9, you are supposed to do: > return MethodHandles.privateLookupIn(anchorClass, MethodHandles.lookup()) > .dropLookupMode(MethodHandles.Lookup.PRIVATE); >

Re: trySetAccessible​

2017-08-28 Thread Russell Gold
> On Aug 27, 2017, at 4:07 PM, Alan Bateman <alan.bate...@oracle.com> wrote: > > On 27/08/2017 05:00, Russell Gold wrote: >> >> When you say it is open to all unnamed modules, do you mean open with >> warnings? How do you declare a module open? I don’t s

Re: trySetAccessible​

2017-08-26 Thread Russell Gold
> On Aug 23, 2017, at 1:49 AM, Alan Bateman <alan.bate...@oracle.com> wrote: > > On 16/08/2017 02:09, Russell Gold wrote: >> : >> >> but: >> >> method.getDeclaringClass().getModule().isOpen("java.io", >> callingClass.getModule()) &

Re: trySetAccessible​

2017-08-15 Thread Russell Gold
I am clearly missing something, here. Using build 180, I have variables: Method method, Class callingClass. I evaluate: callingClass.getModule() - -> java.lang.Module@2940 “unnamed module @f973499” method.getDeclaringClass() -> java.lang.Class “class

Re: Proposal: Allow illegal reflective access by default in JDK 9

2017-05-19 Thread Russell Gold
There are two separate issues, here: 1) Access to internal APIs. Yes, we have been warned of these for two decades; it shouldn’t actually be a shock that they have been banned. It shouldn’t, but in some cases, people didn’t really believe that they would go away. Still, it seems reasonable to

Re: Evidence of incompatibility (was Some suggested patches and improvements)

2017-05-18 Thread Russell Gold
fragile if you don’t always > do a clean or explicitly include a clean step that runs to clean up those > items even if you didn’t specify it. > > Ralph > >> On May 18, 2017, at 7:20 AM, Russell Gold <russell.g...@oracle.com >> <mailto:russell.g...@oracle.co

Re: Evidence of incompatibility (was Some suggested patches and improvements)

2017-05-18 Thread Russell Gold
Maven support and tool support in general for MR Jars is very poor at the moment - including the bundle plugin. I do have a working example you could look at that includes OSGi support. The key here is that I delete the java9

Re: SecurityManager environments

2017-04-28 Thread Russell Gold
> On Apr 6, 2017, at 3:50 AM, Alan Bateman wrote: > The Add-Exports and Add-Opens attributes are the executable JAR equivalent of > the --add-exports and --add-opens command line options. So if an application > is hacking into say sun.awt then the maintainer of the

Re: Lookup.defineClass

2017-03-14 Thread Russell Gold
Hi Alan, I am trying this in SimpleStub, and it seems to work for my current test cases if I do this: > MethodHandles.Lookup in = MethodHandles.privateLookupIn( baseClass, > MethodHandles.lookup() ).dropLookupMode( MethodHandles.Lookup.PRIVATE ); > return in.defineClass(classBytes); My tests

A broken setAccessible use case: enhanced diagnostics

2017-01-26 Thread Russell Gold
The Glassfish Primitive Function Library (PFL) contains an interesting use case for setAccessible: an enhanced object-to-string capability. Now, in an ideal world, this shouldn’t be needed, as each object provides an adequate toString() method; however, it is not uncommon while trying to

Re: modules and tests

2016-11-25 Thread Russell Gold
Hi Russel, > part of the code i test use Layers and annotations on Modules, it just > doesn't work with in a non module environment :( > > regards, > Rémi > > De: "Russell Gold" <russell.g...@oracle.com> > À: "jigsaw-dev" <jigsaw-dev@openjdk.java.n

Re: modules and tests

2016-11-25 Thread Russell Gold
If you are doing unit testing, all you presumably care about is the classes themselves; not the configuration. I would think that tests which care about configuration - including what classes are accessible - is properly a functional test. So, why not simply handle unit tests, as you say, with

Re: Exporting - the wrong default?

2016-07-28 Thread Russell Gold
> On Jul 28, 2016, at 9:09 AM, Stephen Colebourne wrote: > > As I have shown, in most libraries, > 90%+ of the packages need to be exposed - hiding packages is the > minority/specialist use case (the JDK is unusual in the packages it > wants to hide). Did you show this in

Re: It's not too late for access control

2016-07-14 Thread Russell Gold
> On Jul 12, 2016, at 1:31 PM, Eric Johnson wrote: > > What infuriates me is that in all this discussion, I don't see anyone talking > about a threat analysis. What are we trying to protect, from whom, and why? I > see comments about how implementation details of the JRE (such

Re: modulepath and classpath mixture

2016-03-31 Thread Russell Gold
hy the boundaries shouldn't be there. > > Cheers, > Paul > > On Wed, Mar 30, 2016 at 2:07 PM, Russell Gold <russell.g...@oracle.com > <mailto:russell.g...@oracle.com>> wrote: > Hi Paul, > > Why would you put your main code on the module path during a unit te

Re: modulepath and classpath mixture

2016-03-30 Thread Russell Gold
> In the last several posts, there's been discussion on putting tests on the > classpath; keeping the "main" code in the module. So given what I stated > above, that's what I've been referring to. > > Cheers, > Paul > > On Wed, Mar 30, 2016 at 7:28 AM, Rus

Re: modulepath and classpath mixture

2016-03-30 Thread Russell Gold
3/03/2016 14:15, Russell Gold wrote: >> Here are my assumptions, which you can correct. >> >> 1. A jar or classes directory placed on a class path are treated as part of >> the unnamed module > Yes So if the tests and main code are both in directories, which the

Re: modulepath and classpath mixture

2016-03-29 Thread Russell Gold
Hi Stephen, Why do you need any kind of friend access? It seems to me that this is making things harder than they need to be. The tests can simply run with the production code on the class path, and then there are no module issues at all. I think a larger problem is that you can do what I

Re: modulepath and classpath mixture

2016-03-23 Thread Russell Gold
> On Mar 23, 2016, at 11:42 AM, Alan Bateman <alan.bate...@oracle.com> wrote: > > > > On 23/03/2016 14:15, Russell Gold wrote: >> Here are my assumptions, which you can correct. >> >> 1. A jar or classes directory placed on a class path are treated

Re: modulepath and classpath mixture

2016-03-23 Thread Russell Gold
> On Mar 23, 2016, at 3:21 AM, Alan Bateman <alan.bate...@oracle.com> wrote: > > On 22/03/2016 22:20, Russell Gold wrote: >> I’d like to take a step back here. It may be that I have completely >> misunderstood what is going on, but this all seems to have gotten wa

Re: Unnamed module and duplicate package

2016-03-09 Thread Russell Gold
Doesn’t this kind of error only happen when a second module exports the same _class_? What is the problem with another class being defined in the same package, given that package B isn’t going to access that new class at all? - Russ > On Mar 9, 2016, at 4:37 PM, Alex Buckley

Re: Need help testing the EA builds

2016-03-02 Thread Russell Gold
Simplestub, at least, should no longer be a problem. The issue there was Javassist, but the ASM implementation works on Jigsaw. > On Mar 2, 2016, at 11:29 AM, Stephen Felts wrote: > > Yes, you are correct. The rt.jar change and the classloading changes have >