[foreign-preview] RFR: 8280527: Move jdk.incubator.foreign to java.lang.foreign
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon Jan 24 21:54:23 UTC 2022
On Mon, 24 Jan 2022 19:47:07 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.
>
> make/test/BuildMicrobenchmark.gmk line 97:
>
>> 95: SRC := $(MICROBENCHMARK_SRC), \
>> 96: BIN := $(MICROBENCHMARK_CLASSES), \
>> 97: JAVAC_FLAGS := --add-exports java.base/sun.security.util=ALL-UNNAMED --enable-preview, \
>
> AFAIK adding --enable-preview to JAVAC_FLAGS like this would result in the class file version being poisoned for all the benchmark classes. I.e. it would require running all benchmarks with `--enable-preview` (not just the foreign ones).
>
> This was an issue in the past as well (see https://bugs.openjdk.java.net/browse/JDK-8250669 and related).
>
> I think at the minimum, `--enable-preview` should also be added to the default VM args when running benchmarks if we go with a javac flag. But, even that might not be good enough for mainline. I don't remember the exact details, but it was hard to have benchmarks that used preview features without effecting all benchmarks.
>
> @cl4es Do you remember the outcome of this? I remember it was not as simple a fix as just adding `--enable-preview` to the VM args... (but I'm having trouble finding the email thread now).
I think this is something we'd need to address before we integrate into mainline - but for now I think it's tolerable to run benchmarks by passing the extra `--enable-preview`. I'd suggest to file a follow-up issue and fix that there, to keep this review simple.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/633
More information about the panama-dev
mailing list