RFR: 8293051: Further refactor javac after removal of -source/-target/--release 7 [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Sep 8 13:04:49 UTC 2022
On Mon, 5 Sep 2022 18:19:35 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> test/jdk/java/lang/invoke/defineHiddenClass/src/HiddenInterface.java line 31:
>>
>>> 29: public interface HiddenInterface {
>>> 30: default void test() {
>>> 31: record R() {}
>>
>> surprised to see this change
>
> this is was done because test: `test/jdk/java/lang/invoke/defineHiddenClass/PreviewHiddenClass.java` is compiling this code with options `--enable-preview -source [latestSource] -XDforcePreview` and then checking that the obtained class file has 65535 as its minor version. This was working so far as `DEFAULT_METHODS` was one member of `com.sun.tools.javac.code.Source.Feature` but as this PR is removing `DEFAULT_METHODS` we are obtaining the same effect defining a record as `RECORDS` are still defined in `com.sun.tools.javac.code.Source.Feature`
I see. I understand what the fix does then.
I wonder if, moving forward, it wouldn't be better to tweak the semantics of forcePreview so that it always pollutes the classfile not matter what (which seems to be what some of the tests want). Otherwise we're stuck with these fragile tricks of using this or that feature to force javac's preview system into submission.
-------------
PR: https://git.openjdk.org/jdk/pull/10150
More information about the compiler-dev
mailing list