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

2018-10-26 Thread Mandy Chung
You can submit from https://bugreport.java.com/bugreport/ Mandy On 10/26/18 2:48 AM, Kasper Nielsen wrote: 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?

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 doing now, I unreflect a member and then test

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

2018-10-24 Thread Mandy Chung
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 doing now, I unreflect a member and then test if an exception is thrown. However, it is just a bit of an antipattern, catching exception to test a condition. I would prefer if

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

2018-10-23 Thread Kasper Nielsen
Hi Mandy, Yes, that it was my code is doing now, I unreflect a member and then test if an exception is thrown. However, it is just a bit of an antipattern, catching exception to test a condition. I would prefer if something like this was available: boolean Lookup.isAccessible(Member member) boole

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

2018-10-22 Thread Mandy Chung
Lookup.accessClass(member.getDeclaringClass()) can be used to test if the lookup class can access the declaring class of the given member. This only checks if a class is accessible.  I think unreflecting a member will do what you are looking for to check if the lookup object has access to the memb

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 {