Re: Discussion: Prefer passing MethodHandles.Lookup over @CallerSensitive

2023-04-22 Thread Alan Bateman
On 21/04/2023 22:37, mandy.ch...@oracle.com wrote: : On 4/21/23 1:58 PM, Johannes Kuhn wrote: This line works with Java 7 - 16:     MethodHandles.publicLookup().findStatic(System.class, "setSecurityManager", MethodType.methodType(void.class, SecurityManager.class)); In Java 17 System:

Re: Discussion: Prefer passing MethodHandles.Lookup over @CallerSensitive

2023-04-21 Thread mandy . chung
On 4/21/23 1:58 PM, Johannes Kuhn wrote: 5. Making existing methods @CallerSensitive can lead to small backwards compatibility issues - as the public lookup can't lookup those methods anymore. Can you explain what you observe about this?   Public lookup has access to public members of public

Re: Discussion: Prefer passing MethodHandles.Lookup over @CallerSensitive

2023-04-21 Thread Johannes Kuhn
Hi, to reiterate: I do not want to change existing APIs. Instead having a discussion that can guide the introduction of new APIs that may want to be @CS (but don't need to be). On 21-Apr-23 21:30, mandy.ch...@oracle.com wrote: On 4/21/23 6:44 AM, Johannes Kuhn wrote: Hi, Instead of making

Re: Discussion: Prefer passing MethodHandles.Lookup over @CallerSensitive

2023-04-21 Thread mandy . chung
On 4/21/23 6:44 AM, Johannes Kuhn wrote: Hi, Instead of making new and existing methods @CallerSensitive, such methods could instead take a MethodHandles.Lookup as method argument. Library authors are often told that they could ask their users to pass a MethodHandles.Lookup to obtain inter

Discussion: Prefer passing MethodHandles.Lookup over @CallerSensitive

2023-04-21 Thread Johannes Kuhn
Hi, Instead of making new and existing methods @CallerSensitive, such methods could instead take a MethodHandles.Lookup as method argument. Library authors are often told that they could ask their users to pass a MethodHandles.Lookup to obtain internal access instead of using things like Acc