[jdk11u-dev] RFR: 8253700: spurious "extends Throwable" at end of Optional.orElseThrow method declaration [v2]

Amos Shi ashi at openjdk.org
Tue Jun 18 19:24:22 UTC 2024


On Tue, 18 Jun 2024 05:57:25 GMT, Amos Shi <ashi at openjdk.org> wrote:

>> Backport of [JDK-8253700](https://bugs.openjdk.org/browse/JDK-8253700)
>> - This is an unclean backport, contains two commits
>> - Commit 1. is generated by `git patch` command, is a clean apply of the original commit
>> - Commit 2. contains
>>   - a, Manual merge of the following `.rej` files
>>   - b. Manually fixed the `TestThrows.java` on Java 11 compile error, and fixed the test case to match the `javadoc` 11 output
>> 
>> `.rej` files
>> - `src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java.rej`
>>   - This file has been manually merged into the `commit 2`
>> 
>> 
>> @@ -51,6 +51,7 @@
>>  import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.MEMBER;
>>  import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS;
>>  import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.RECEIVER_TYPE;
>> +import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.THROWS_TYPE;
>>  
>>  /**
>>   * Print method and constructor info.
>> @@ -254,19 +255,16 @@
>>       */
>>      protected Content getExceptions(ExecutableElement member) {
>>          List<? extends TypeMirror> exceptions = utils.asInstantiatedMethodType(typeElement, member).getThrownTypes();
>> -        Content htmltree = new ContentBuilder();
>> -        if (!exceptions.isEmpty()) {
>> -            Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
>> -            htmltree.add(link);
>> -            for (int i = 1; i < exceptions.size(); i++) {
>> -                htmltree.add(",");
>> -                htmltree.add(DocletConstants.NL);
>> -                Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
>> -                        exceptions.get(i)));
>> -                htmltree.add(exceptionLink);
>> +        Content htmlTree = new ContentBuilder();
>> +        for (TypeMirror t : exceptions) {
>> +            if (!htmlTree.isEmpty()) {
>> +                htmlTree.add(",");
>> +                htmlTree.add(DocletConstants.NL);
>>              }
>> +            Content link = writer.getLink(new LinkInfoImpl(configuration, THROWS_TYPE, t));
>> +            htmlTree.add(link);
>>          }
>> -        return htmltree;
>> +        return htmlTree;
>>      }
>>  
>>      protected TypeElement implementsMethodInIntfac(ExecutableElement method,
>> 
>> 
>> - `src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkInfoImpl.ja...
>
> Amos Shi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Backport 8cf8e463c623b3908befb0af289749b47a793267 lineSeparator mis match

### Pre-submit tests failure Analysis

The error message
- `testng-7.3.0.jar(/Version.java):12: error: unmappable character (0xC3) for encoding US-ASCII`


Running test testThrowsWithBound
Running javadoc...
args: [-d, testThrowsWithBound/out, testThrowsWithBound/src/C.java]
javadoc OUT:
Loading source file testThrowsWithBound/src/C.java...
Constructing Javadoc information...
Creating destination directory: "testThrowsWithBound/out/"
Standard Doclet version 11.0.25-internal
Building tree for all the packages and classes...
Generating testThrowsWithBound/out/C.html...
/Users/runner/work/jdk11u-dev-amos/jdk11u-dev-amos/jtreg/installed/lib/testng-7.3.0.jar(/Version.java):12: error: unmappable character (0xC3) for encoding US-ASCII
        System.out.println("...\\\\n... TestNG " + getVersionString() + " by C??dric Beust (cedric at beust.com)\\\\n...\\\\n");
                                                                            ^
/Users/runner/work/jdk11u-dev-amos/jdk11u-dev-amos/jtreg/installed/lib/testng-7.3.0.jar(/Version.java):12: error: unmappable character (0xA9) for encoding US-ASCII
        System.out.println("...\\\\n... TestNG " + getVersionString() + " by C??dric Beust (cedric at beust.com)\\\\n...\\\\n");
                                                                             ^


Reason
- The is a special character `é` in the source code bellow
- https://github.com/testng-team/testng/blob/7.3.0/src/main/resources/Version.java#L12

    public static void displayBanner() {
        System.out.println("...\\n... TestNG " + getVersionString() + " by Cédric Beust (cedric at beust.com)\\n...\\n");
    }

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

PR Comment: https://git.openjdk.org/jdk11u-dev/pull/2772#issuecomment-2176799501


More information about the jdk-updates-dev mailing list