[foreign-preview] RFR: 8280527: Move jdk.incubator.foreign to java.lang.foreign

Julia Boes jboes at openjdk.java.net
Tue Jan 25 16:31:48 UTC 2022


On Mon, 24 Jan 2022 19:18:54 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> To prepare for preview, this change removes the jdk.incubator.foreign module and moves the public classes to java.base/java.lang.foreign, implementation classes to java.base/jdk.internal.foreign respectively. 
>> 
>> While here, `SystemLookup` is replaced with the method `ClassLoader::findNative` and the methods in `MemoryHandles` are moved to `MethodHandles`. The `@PreviewFeature(feature=PreviewFeature.Feature.FOREIGN)` annotation and the `--enable-preview` flag are added were needed.
>
> test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java line 52:
> 
>> 50:     }
>> 51: 
>> 52:     final static CLinker abi = CLinker.getInstance();
> 
> This looks incorrect. This method was renamed to `systemCLinker`. Note that this test doesn't run as part of run-test-jdk_foreign.

Yepp, fixing to 
```    
final static CLinker abi = CLinker.systemCLinker();
final static MethodHandle foo = abi.downcallHandle(TestLinkToNativeRBP.class.getClassLoader().findNative("foo").get(),
            FunctionDescriptor.of(ValueLayout.JAVA_INT));

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/633


More information about the panama-dev mailing list