[lworld] RFR: Fix issues in javac combo tests
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Aug 29 13:38:47 UTC 2025
A [change](https://bugs.openjdk.org/browse/JDK-8334294) made last year added `@enablePreview` to some tests using the combinatorial javac testing framework.
I believe the issue was that back then we had no way to load different version of a class (e.g. `Optional`) based on whether we were running on preview vs. non-preview so. Since the framework uses `Optional` it was treated as having an hard dependency on a preview feature, and compilation failed.
To fix this, we added `@enablePreview` in the tests that depend on that framework -- this meant the framework was now compiled with `--enable-preview` which solved the issue.
But this workaround is no longer needed today. And, worse, as we keep getting new tests from mainline, such tests will fail if they depend on the combinatorial framework, as they will depend on a "preview" classfile (as of today we have 4 such errors). So this means that to keep test working we will have to add `@enablePreview` to an increasing number of tests. This doesn't scale and since we no longer need it, it seems better to just just drop the `@enablePreview` directives that were added, effectively reverting the code to what is there in mainline/master.
-------------
Commit messages:
- Fix issues in combo tests
Changes: https://git.openjdk.org/valhalla/pull/1538/files
Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1538&range=00
Stats: 30 lines in 30 files changed: 0 ins; 30 del; 0 mod
Patch: https://git.openjdk.org/valhalla/pull/1538.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1538/head:pull/1538
PR: https://git.openjdk.org/valhalla/pull/1538
More information about the valhalla-dev
mailing list