> - Add exception type as an additional generic parameter to all `Throwing...`
> interfaces
> - Add unit tests for "jdk.jpackage.internal.util.function" package
> - Add `ExceptionBox.toUnchecked()`. It is equivalent to
> `ExceptionBox.rethrowUnchecked()`, but doesn't throw
> - Replace `ExceptionBox.rethrowUnchecked(...)` with
> `ExceptionBox.toUnchecked(...)`; this increased test coverage of
> "jdk.jpackage.internal.util.function" package from 86% to 97%
> - Change exception handling in `ExceptionBox.toUnchecked()` (former
> `ExceptionBox.rethrowUnchecked()`):
> - `InterruptedException`: instead of rethrowing an exception of this type,
> it calls `Thread.currentThread().interrupt()` and then rethrows it
> - Add `ExceptionBox.unbox()` (former `TKit.unbox()`). It is complementary to
> `ExceptionBox.toUnchecked()`
> - Catch `Exception` instead of `Throwable` where appropriate to avoid
> catching `Error`-s. The idea is not to handle fatal errors
> - Replace vague `throws Throwable` exception specifications with more
> specific ones where appropriate
> - Add `ExceptionBox.reachedUnreachable()` for use in locations that control
> flow is not expected to reach
>
> Supplementary changes:
> - Take advantage of the updated `Throwing...` interfaces in the `Result`
> class.
> - Add unit tests for the `Result` class and fix uncovered minor issues.
Alexey Semenyuk has updated the pull request with a new target base due to a
merge or a rebase. The pull request now contains seven commits:
- Result: add unit tests, remove unused mapErrors(UnaryOperator<Collection<?
extends Exception>>) function; better and more consistent error reporting based
on testing
- Result: replace create(Supplier<T>) with of(ThrowingSupplier<T, E>)
- CustomInfoPListTest: fix local test failure:
[22:38:21.786] TRACE: assertStringListEquals(): Check contents of
[CustomInfoPListTest/testPackage.571a7829/vanilla/PackageCustomInfoPListTest.app/Contents/runtime/Contents/Info.plist]
and
[CustomInfoPListTest/testPackage.571a7829/unpacked-pkg/unpacked/Applications/PackageCustomInfoPListTest.app/Contents/runtime/Contents/Info.plist]
plist files are the same
[22:38:21.786] TRACE: assertStringListEquals( 1, /CFBundleDevelopmentRegion:
en-US)
[22:38:21.786] TRACE: assertStringListEquals( 2, /CFBundleExecutable:
libjli.dylib)
[22:38:21.786] TRACE: assertStringListEquals( 3, /CFBundleIdentifier: Hello)
[22:38:21.787] TRACE: assertStringListEquals( 4,
/CFBundleInfoDictionaryVersion: 7.0)
[22:38:21.787] TRACE: assertStringListEquals( 5, /CFBundleName:
PackageCustomInfoPListTest)
[22:38:21.787] TRACE: assertStringListEquals( 6, /CFBundlePackageType: BNDL)
[22:38:21.787] TRACE: assertStringListEquals( 7,
/CFBundleShortVersionString: 1.0)
[22:38:21.787] TRACE: assertStringListEquals( 8, /CFBundleSignature: ????)
[22:38:21.787] TRACE: assertStringListEquals( 9, /CFBundleVersion: 1.0)
[22:38:21.787] ERROR: Actual list is shorter than expected by 5 elements:
Check contents of
[CustomInfoPListTest/testPackage.571a7829/vanilla/PackageCustomInfoPListTest.app/Contents/runtime/Contents/Info.plist]
and
[CustomInfoPListTest/testPackage.571a7829/unpacked-pkg/unpacked/Applications/PackageCustomInfoPListTest.app/Contents/runtime/Contents/Info.plist]
plist files are the same
[22:38:21.787] [ FAILED ] CustomInfoPListTest.testPackage(APP); checks=54
Exception in thread "main" java.lang.AssertionError: Actual list is shorter
than expected by 5 elements: Check contents of
[CustomInfoPListTest/testPackage.571a7829/vanilla/PackageCustomInfoPListTest.app/Contents/runtime/Contents/Info.plist]
and
[CustomInfoPListTest/testPackage.571a7829/unpacked-pkg/unpacked/Applications/PackageCustomInfoPListTest.app/Contents/runtime/Contents/Info.plist]
plist files are the same
at jdk.jpackage.test.TKit.error(TKit.java:360)
at jdk.jpackage.test.TKit.assertStringListEquals(TKit.java:1068)
at
CustomInfoPListTest$TestConfig.lambda$createPListFilesVerifier$1(CustomInfoPListTest.java:274)
at CustomInfoPListTest.lambda$testApp$9(CustomInfoPListTest.java:182)
Caused by not getting the default plist file from the vanilla app image
runtime directory when the external runtime with the "bin" subdirectory is used
with the tests.
Test log without the predefined runtime:
========================================
[22:35:26.310] Creating app package: PackageCustomInfoPListTest.app in
jpackage-tests/CustomInfoPListTest/testPackage.571a7829/vanilla
[22:35:26.318] Running jlink
...
[22:35:29.430] Using default package resource
ApplicationRuntime-Info.plist.template [Embedded Java Runtime Info.plist] (add
Runtime-Info.plist to the resource-dir to customize).
Test log with the predefined runtime:
=====================================
[22:38:17.465] Creating app package: PackageCustomInfoPListTest.app in
jpackage-tests/CustomInfoPListTest/testPackage.571a7829/vanilla
[22:38:17.605] Using default package resource Runtime-Info.plist.template
[Embedded Java Runtime Info.plist] (add Runtime-Info.plist to the resource-dir
to customize).
- TKit: fix missing test execution summary if some tests fail
- Replace `ExceptionBox.rethrowUnchecked()` with `throw
ExceptionBox.toUnchecked()`; remove ExceptionBox.rethrowUnchecked().
- ExceptionBox: add toUnchecked() and use it in all Throwing<Name> classes
instead of ExceptionBox.rethrowUnchecked(). This change results in 100%
coverage for these classes in the unit tests. Add unit tests. Add
ExceptionBox.reachedUnreachable().
- Throwing<NAME>: make these classes generic; don't catch Throwable-s, catch
Exception-s instead and let Error-s out.
-------------
Changes: https://git.openjdk.org/jdk/pull/28731/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28731&range=03
Stats: 1374 lines in 55 files changed: 1116 ins; 38 del; 220 mod
Patch: https://git.openjdk.org/jdk/pull/28731.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28731/head:pull/28731
PR: https://git.openjdk.org/jdk/pull/28731