[jdk21u-dev] RFR: 8352419: Test tools/jpackage/share/ErrorTest.java#id0 and #id1 fail
Min Choi
duke at openjdk.org
Mon Feb 23 21:02:37 UTC 2026
In order to fix https://github.com/openjdk/jdk21u-dev/pull/2606, consensus was reached to pull the SkippedException hardcode change from tip to fix.
The other parts of the backport require additional backports that are not trivial.
The upstream commit [JDK-8352419](https://bugs.openjdk.org/browse/JDK-8352419) https://github.com/openjdk/jdk/commit/70e325004536eb9b79f4943f27eed4ac6cec8bd5 contains changes to 4 files:
- `TKit.java` - Embeds `jtreg.SkippedException` bytecode (**included in this backport**)
- `PackageType.java` - Adds new methods used by refactored ErrorTest
- `PackageTest.java` - Adds filtering logic for new ErrorTest infrastructure
- `ErrorTest.java` - Uses new `PackageTypeSpec` record and test infrastructure
Only the `TKit.java` change is self-contained. The other changes depend on [JDK-8351372](https://bugs.openjdk.org/browse/JDK-8351372) ("Improve negative tests coverage of jpackage"), which is a big refactoring that completely rewrote `ErrorTest.java` (~700 lines changed).
#### Required Prerequisites for Full Backport
| JBS ID | Description | Impact |
|--------|-------------|--------|
| [JDK-8351372](https://bugs.openjdk.org/browse/JDK-8351372) | Improve negative tests coverage of jpackage | Complete `ErrorTest.java` rewrite (581 insertions, 78 deletions) |
| [JDK-8352293](https://bugs.openjdk.org/browse/JDK-8352293) | Fix rpm packages on Ubuntu after 8351372 | Follow-up fix (1 line in `PackageType.java`) |
These backports are unnecessary for JDK 21 - they are test infrastructure improvements for jdk-tip that don't exist in 21.
This PR backports only the `JtregSkippedExceptionClass` inner class from `TKit.java`, which embeds the `jtreg.SkippedException` bytecode via Base64 and dynamically defines the class at runtime. This eliminates the need for `@library /test/lib` and `@build jtreg.SkippedException` in jpackage tests and fixes all jpackage tests that call SkippedException through reflection.
Tested all tools/jpackage tests and also ran a simple test and it skips correctly now.
import jdk.jpackage.test.Annotations.Test;
import jdk.jpackage.test.TKit;
/*
* @test
* @summary Test TKit.throwSkippedException() without @library /test/lib
* @library /test/jdk/tools/jpackage/helpers
* @build jdk.jpackage.test.*
* @build TKitSkipTest
* @run main/othervm -Xmx512m jdk.jpackage.test.Main
* --jpt-run=TKitSkipTest
*/
public class TKitSkipTest {
@Test
public void test() {
TKit.throwSkippedException("Testing TKit.throwSkippedException()");
}
}
-------------
Commit messages:
- Merge branch 'openjdk:master' into JDK-8352419-SkippedException
- 8352419: Partial backport - Embed jtreg.SkippedException in TKit
Changes: https://git.openjdk.org/jdk21u-dev/pull/2633/files
Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=2633&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8352419
Stats: 29 lines in 1 file changed: 26 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk21u-dev/pull/2633.diff
Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/2633/head:pull/2633
PR: https://git.openjdk.org/jdk21u-dev/pull/2633
More information about the jdk-updates-dev
mailing list