On Tue, 24 May 2022 04:58:44 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> Commit 
>> https://github.com/openjdk/jdk/commit/655500a4f5e3abcff176599604deceefb6ca6640
>>  for issue [JDK-8286654](https://bugs.openjdk.java.net/browse/JDK-8286654) 
>> added an optional description accessor on the `ToolProvider` interface. It 
>> included a typo in` jlink`'s description resource key lookup: 
>> `"jlink.desciption"`
>> 
>> This follow-up commit fixes the typo by adding the missing `r` character: 
>> `"jlink.description"`.
>> 
>> This commit also also adds an automated check that ensures all current and 
>> future tool provider implementations within the JDK don't throw an exception 
>> when invoking their name and description accessor methods. Specific tool 
>> names and descriptions are not expected by this general test.
>
> test/jdk/java/util/spi/ToolProviderDescriptionTest.java line 40:
> 
>> 38:     public static void main(String... args) throws Exception {
>> 39:         List<String> descriptions = listToolDescriptions();
>> 40:         if (descriptions.isEmpty()) {
> 
> Hello @sormuras,
> Won't this condition always be "false", because from what I see in this test 
> code, the `descriptions` list will never be empty since in the `describeTool` 
> method of this test we always return a `String` instance to be added to the 
> `List`, even if there's no `description` for the `ToolProvider` instance.

The list will be empty, if no `ToolProvider` service is observable at all. For 
example, when running `java` with `--limit-module java.base` - which doesn't 
provide an implemention of `ToolProvider` as of today.

This test checks that all observable tools don't throw on calling their 
`name()` and `description()` accessors.

This test does not care for proper results being returned.

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

PR: https://git.openjdk.java.net/jdk/pull/8825

Reply via email to