Re: RFR: 8330196: Make java/lang/invoke/defineHiddenClass/BasicTest release agnostic

2024-04-14 Thread Johannes Kuhn
On Fri, 12 Apr 2024 23:55:01 GMT, Joe Darcy wrote: > Straightforward test update so it doesn't have to be trivially updated for > each JDK version. Marked as reviewed by jkuhn (Author). - PR Review: https://git.openjdk.org/jdk/pull/18769#pullrequestreview-1999661348

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v16]

2023-05-31 Thread Johannes Kuhn
On Wed, 31 May 2023 00:49:22 GMT, Mandy Chung wrote: >>> Apparently, calling utility methods from sun.invoke, like the >>> ensureOriginalLookup in this patch, also triggers this check. >> >> It should not trigger `checkPackageAccess` if it does not implement the >> interface AFAICT. >> >> It

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread Johannes Kuhn
On Mon, 1 May 2023 22:11:58 GMT, John R Rose wrote: > JDK platform code Yes. This works if the class is in a non-user module. Otherwise exporting an internal package would expose that to user-code as well. `java.lang.reflect.Proxy` does need to inject the proxy class into user-packages if on

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread Johannes Kuhn
On Mon, 1 May 2023 21:00:40 GMT, John R Rose wrote: >> Chen Liang has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 24 additional >> commits since

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 m

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

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v9]

2023-04-07 Thread Johannes Kuhn
On Fri, 7 Apr 2023 11:20:12 GMT, ExE Boss wrote: > that can’t refer to hidden classes No, that is exactly the **one and only thing** that can refer to the hidden class: > * On any attempt to resolve the entry in the run-time constant pool indicated > by `this_class`, the symbolic reference is

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 19:22:56 GMT, Mandy Chung wrote: > This seems a concern if the target method handle should not have access to > the class in that module. MethodHandle access is checked when the MethodHandle is created. For `@CallerSensitive` methods, the MethodHandle is additionally bound

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 16:58:43 GMT, Jorn Vernee wrote: >> Guess I will just nuke the annotation and check for its implemented clause >> instead. > > I don't think that's good enough. If an instance implements an interface that > just happens to also have an entry in the INTERFACE_INFOS cache, then

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 16:13:38 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 284: >> >>> 282: return >>> type.getDeclaredAnnotation(WrapperInstance.class); >>> 283: } >>> 284: }) : type.getD

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]

2023-04-06 Thread Johannes Kuhn
On Thu, 6 Apr 2023 03:44:07 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-04-05 Thread Johannes Kuhn
On Tue, 28 Mar 2023 14:34:19 GMT, Chen Liang wrote: > The interface access may be problematic: A non-exported interface Class > object can be obtained via Reflection inspection on exported types, such as > java packages and jdk.internal packages. > > * In that case, it might not be of best

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Johannes Kuhn
On Wed, 29 Mar 2023 00:25:09 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 338: >> >>> 336: .aload(1) >>> 337: .ifThenElse(Opcode.IF_ACMPEQ, >>> CodeBuilder::iconst_1, CodeBuilder::iconst_0) >>> 3

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Johannes Kuhn
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Unsigned long to double and back

2022-11-05 Thread Johannes Kuhn
When I tried to implement an WASM transpiler, I noticed some missing conversion methods from unsigned types to floating point, for example from unsigned long to a double. For the meaning of unsigned long, see Long.toUnsignedString(long i). Converting between unsigned long and floating point is

Re: RFR: JDK-8288475: Initializing RandomGeneratorFactory.FactoryMapHolder fails if a SecurityManager is installed

2022-06-17 Thread Johannes Kuhn
On Fri, 17 Jun 2022 07:04:47 GMT, Jaikiran Pai wrote: >> * This adds additional permissions to the jdk.random module >> (`RuntimePermission "accessClassInPackage.jdk.internal.util.random"`) >> * The annotations of the provider classes are now parsed early. >> This avoids putting the parts th

Re: RFR: JDK-8288475: Initializing RandomGeneratorFactory.FactoryMapHolder fails if a SecurityManager is installed

2022-06-16 Thread Johannes Kuhn
On Fri, 17 Jun 2022 06:47:59 GMT, Jaikiran Pai wrote: >> * This adds additional permissions to the jdk.random module >> (`RuntimePermission "accessClassInPackage.jdk.internal.util.random"`) >> * The annotations of the provider classes are now parsed early. >> This avoids putting the parts th

Re: RFR: JDK-8288475: Initializing RandomGeneratorFactory.FactoryMapHolder fails if a SecurityManager is installed

2022-06-16 Thread Johannes Kuhn
On Thu, 16 Jun 2022 17:43:19 GMT, Sean Mullan wrote: >> * This adds additional permissions to the jdk.random module >> (`RuntimePermission "accessClassInPackage.jdk.internal.util.random"`) >> * The annotations of the provider classes are now parsed early. >> This avoids putting the parts tha

RFR: JDK-8288475: Initializing RandomGeneratorFactory.FactoryMapHolder fails if a SecurityManager is installed

2022-06-16 Thread Johannes Kuhn
* This adds additional permissions to the jdk.random module (`RuntimePermission "accessClassInPackage.jdk.internal.util.random"`) * The annotations of the provider classes are now parsed early. This avoids putting the parts that can trigger the parsing into an `AccessController.doPrivileged()