[lworld] Integrated: Fix issues in javac combo tests

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Aug 29 17:11:57 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.

This pull request has now been integrated.

Changeset: 4a8a6150
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/4a8a6150e8959d46c75f7ef73414fe1b82328d1e
Stats:     30 lines in 30 files changed: 0 ins; 30 del; 0 mod

Fix issues in javac combo tests

Reviewed-by: vromero

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

PR: https://git.openjdk.org/valhalla/pull/1538


More information about the valhalla-dev mailing list