[lworld] RFR: Fix issues in javac combo tests

Vicente Romero vromero at openjdk.org
Fri Aug 29 14:19:50 UTC 2025


On Fri, 29 Aug 2025 13:33:14 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> 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.

looks good, thanks for fixing this

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

Marked as reviewed by vromero (Committer).

PR Review: https://git.openjdk.org/valhalla/pull/1538#pullrequestreview-3168921354


More information about the valhalla-dev mailing list