Re: replacements for Unsafe

2020-04-29 Thread Kasper Nielsen
Hi Jochen, Is there anything stopping you for doing something like: try { Class.forName(innerClassName, true, initalizeClass.getClassLoader()); } catch (ClassNotFoundException e) { throw new ExceptionInInitializerError(e); // Should never happen } I know it is not pretty. /Kasper On

Re: Lookup objects and setAccessible

2020-01-08 Thread Kasper Nielsen
Hi Mandy, Yes, but they create a member which is not accessible. As far as I can see, all places where AccessibleObject.override is ever set there is a check of the current caller with Reflection.getCallerClass(). /Kasper On Wed, 8 Jan 2020 at 19:25, Mandy Chung wrote: > > Have you looked at

Re: Lookup objects and setAccessible

2020-01-08 Thread Kasper Nielsen
; - Mail original - > > De: "Kasper Nielsen" > > À: "jigsaw-dev" > > Envoyé: Mercredi 8 Janvier 2020 12:14:30 > > Objet: Lookup objects and setAccessible > > > Hi, > > > > I'm trying to bridge some old code using java.lang.reflect

Lookup objects and setAccessible

2020-01-08 Thread Kasper Nielsen
Hi, I'm trying to bridge some old code using java.lang.reflect and some new code that uses Lookup objects. And I'm wondering if there is some way to make a member accessible using a Lookup object? Or if open packages/modules via module-info.java + member.setAccessible(true) is the only way?

Re: Missing a wildcard open statement

2019-01-16 Thread Kasper Nielsen
On Tue, 15 Jan 2019 at 07:48, Alan Bateman wrote: > Which library or framework is this and is there a write-up of the issues > encountered when migrating it to use Lookup objects? > > -Alan > It is a small dependency injection/application I am trying to built on top of the module system. It is

Re: Missing a wildcard open statement

2019-01-14 Thread Kasper Nielsen
> > This is the type of use-case where using Lookup objects might be a > better choice. If you can coerce the user module to pass a suitably > privileged Lookup to the framework then the framework will be able to > inject classes without needing to open packages to the framework. I > think this is

Missing a wildcard open statement

2019-01-14 Thread Kasper Nielsen
Hi, Having worked with the module system for some time now. There is one situation I've started coming across a number of times now, that requires a lot of boiler plate. Opening every package of a module to another module. For example, for dependency injection, code analysis, ect. Basically you

Re: Testing whether or not a Lookup object has access to members

2018-10-26 Thread Kasper Nielsen
Hi Mandy, I don't have access to JBS unfortunately. Cheers Kasper On Wed, 24 Oct 2018 at 16:50, Mandy Chung wrote: > Can you file a JBS issue? > > Mandy > > On 10/23/18 12:15 PM, Kasper Nielsen wrote: > > Hi Mandy, > > Yes, that it was my code is doin

Re: Testing whether or not a Lookup object has access to members

2018-10-23 Thread Kasper Nielsen
I think unreflecting a member > will do what you are looking for to check if the lookup object has access > to the member. What does the code do if the Lookup object has access > vs has no access? > > Mandy > > On 10/22/18 1:17 PM, Kasper Nielsen wrote: > > Hi, &

Testing whether or not a Lookup object has access to members

2018-10-22 Thread Kasper Nielsen
Hi, Are there any elegant way to test if a Lookup object has access to a member (field, constructor, method). Right now I'm using the following code public static boolean hasAccess(MethodHandles.Lookup lookup, Member member) { if (member instanceof Constructor) { try {

Class names in java.lang.Module

2016-09-21 Thread Kasper Nielsen
Hi, I was wondering if there are any reasons for why these 3 classes in java.lang.Module Configuration FindException ResolutionException Does not include the name Module? I especially am not to fond of the very generic Configuration name in my source code would much prefer something like