RFR: 8247957: remove doclint support for HTML 4 [v5]

Jonathan Gibbons jjg at openjdk.java.net
Wed Dec 23 17:15:01 UTC 2020


On Wed, 23 Dec 2020 17:08:55 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> \s was introduced as a valid escape character in JDK 15 as part of the 
>> support for Text Blocks.
>> 
>> https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-EscapeSequence
>> https://docs.oracle.com/javase/specs/jls/se14/preview/specs/text-blocks-jls.html#jls-3.10.7
>> 
>> FWIW, the escape sequence showed up with red squiggly lines in my IDE.
>> 
>> -- Jon
>> 
>> On 12/22/20 9:38 PM, Yoshiki SATO wrote:
>>>
>>> *@satoyoshiki* commented on this pull request.
>>>
>>> ------------------------------------------------------------------------
>>>
>>> In 
>>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java 
>>> <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/893*discussion_r547668049__;Iw!!GqivPVa7Brio!OUEFldgNdIV8aqoReM0lNXfIYO3IoXGR1RUbcYmVdEHRRdA3oy1Zaa3h2DevZiYojsWrqg$>:
>>>
>>> > @@ -765,8 +732,8 @@ private Element getEnclosingPackageOrClass(Element e) {
>>>           return e;
>>>       }
>>>   
>>> -    //http://www.w3.org/TR/html401/types.html#type-name  <https://urldefense.com/v3/__http://www.w3.org/TR/html401/types.html*type-name__;Iw!!GqivPVa7Brio!OUEFldgNdIV8aqoReM0lNXfIYO3IoXGR1RUbcYmVdEHRRdA3oy1Zaa3h2DevZibVYnjqnQ$>
>>> -    private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
>>> +    //https://html.spec.whatwg.org/#the-id-attribute  <https://urldefense.com/v3/__https://html.spec.whatwg.org/*the-id-attribute__;Iw!!GqivPVa7Brio!OUEFldgNdIV8aqoReM0lNXfIYO3IoXGR1RUbcYmVdEHRRdA3oy1Zaa3h2DevZib5vw0eRg$>
>>> +    private static final Pattern validId = Pattern.compile("[^\s]+");
>>>
>>> Correct. Thanks a lot for finding this error.
>>> Now that I have doubts why this line could have been compiled without 
>>> error. This line should cause a compiler error.
>>>
>>> Let me review all anchor tests again because the logic should be 
>>> checked there.
>>>
>>>>>> You are receiving this because you were mentioned.
>>> Reply to this email directly, view it on GitHub 
>>> <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/893*discussion_r547668049__;Iw!!GqivPVa7Brio!OUEFldgNdIV8aqoReM0lNXfIYO3IoXGR1RUbcYmVdEHRRdA3oy1Zaa3h2DevZiYojsWrqg$>, 
>>> or unsubscribe 
>>> <https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AOUXBRXCJBCNZR4ZUBZCEBTSWF66TANCNFSM4TBXTH2Q__;!!GqivPVa7Brio!OUEFldgNdIV8aqoReM0lNXfIYO3IoXGR1RUbcYmVdEHRRdA3oy1Zaa3h2DevZia6kQL08w$>.
>>>
>
> On 12/22/20 10:42 PM, Yoshiki SATO wrote:
>>
>> *@satoyoshiki* commented on this pull request.
>>
>> ------------------------------------------------------------------------
>>
>> In 
>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java 
>> <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/893*discussion_r547716025__;Iw!!GqivPVa7Brio!Oae1uD8yALBU6ReCJTwKccZjdEsGyXddDLOOeF2SJLi8x7SoU5jr-Jr0KVl2EVajBRHM-g$>:
>>
>> > -    }
>> -
>> -    private void validateHtml5Attrs(AttributeTree tree, Name name, AttrKind k) {
>> -        switch (k) {
>> -            case ALL:
>> -            case HTML5:
>> -                break;
>> -
>> -            case INVALID:
>> -            case OBSOLETE:
>> -            case USE_CSS:
>> -            case HTML4:
>> -                env.messages.error(HTML, tree, "dc.attr.not.supported.html5", name);
>> -                break;
>> -        }
>> -    }
>>   
>>       private boolean checkAnchor(String name) {
>>
>> I understand. But is it really no problem to be done in part of the 
>> cleanup of doclint?
>> Looking at the classes in jdk/javadoc/internal/doclint, the term 
>> |(anchor|Anchor)| looks like only used in Checker.java and resource 
>> files. But a lot of other files, for instance in 
>> jdk/javadoc/internal/doclets, use this term to refer to the |id| or 
>> |name| attribute. I would be fine if it is supposed to be done in each 
>> cleanup in the future.
>>
>>>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub 
>> <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/893*discussion_r547716025__;Iw!!GqivPVa7Brio!Oae1uD8yALBU6ReCJTwKccZjdEsGyXddDLOOeF2SJLi8x7SoU5jr-Jr0KVl2EVajBRHM-g$>, 
>> or unsubscribe 
>> <https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AOUXBRQS4FULCERHKMAZ5OLSWGGNVANCNFSM4TBXTH2Q__;!!GqivPVa7Brio!Oae1uD8yALBU6ReCJTwKccZjdEsGyXddDLOOeF2SJLi8x7SoU5jr-Jr0KVl2EVYEkdTG2A$>.
>>
> 
> If you were to cleanup the "anchor" terminology, it should only be done 
> in doclint, meaning Checker.java and resource files. Cleaning up 
> terminology in the rest of javadoc is another project for another day. 
> But, it's OK to skip this terminology cleanup in doclint at this time, 
> since it is only peripherally related to the primary goal to remove 
> HTML4 support.
> 
> -- Jon
> 
>>

Although `\s` was introduced as part of the work for text blocks, it was 
added to the set of escape characters accepted in string and character 
literals. So, no, that constant is not being treated as a text block, 
because text blocks only begin and end with triple-quotes: `"""`

See the JLS links I gave in my previous response.

-- Jon

On 12/22/20 11:50 PM, Yoshiki SATO wrote:
>
> *@satoyoshiki* commented on this pull request.
>
> ------------------------------------------------------------------------
>
> In 
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java 
> <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/893*discussion_r547768833__;Iw!!GqivPVa7Brio!JzRqq_cZpzUEFer1m5NX92ABR7tcna9povirJpPwfSxuO4EFI0tRAmRLw80UwpJdsJ1BgQ$>:
>
> > @@ -765,8 +732,8 @@ private Element getEnclosingPackageOrClass(Element e) {
>           return e;
>       }
>   
> -    //http://www.w3.org/TR/html401/types.html#type-name  <https://urldefense.com/v3/__http://www.w3.org/TR/html401/types.html*type-name__;Iw!!GqivPVa7Brio!JzRqq_cZpzUEFer1m5NX92ABR7tcna9povirJpPwfSxuO4EFI0tRAmRLw80UwpJRSKFcFA$>
> -    private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
> +    //https://html.spec.whatwg.org/#the-id-attribute  <https://urldefense.com/v3/__https://html.spec.whatwg.org/*the-id-attribute__;Iw!!GqivPVa7Brio!JzRqq_cZpzUEFer1m5NX92ABR7tcna9povirJpPwfSxuO4EFI0tRAmRLw80UwpLwqIk5gQ$>
> +    private static final Pattern validId = Pattern.compile("[^\s]+");
>
> For some reason, |"[^\s]+"| might have been dealt with as a text 
> block, thus |\s| was regarded as a whitespace...
> I believe a text block is defined with triple double quotes, but javac 
> seems to accept |"[^\s]+"| as a text block.
>
> That aside, all anchor tests look fine. This is because there is no 
> specific test to use whitespace characters such as |\n|, |\t|, |\r| 
> and |\f| in an anchor name. Also I confirmed the discrepancy of the 
> results for |"[^\s]+"| and |"[^\\s]+"|. It shows that the former is 
> not exactly what we want to do.
>
> /var/tmp/jib-yoshiki/install/jdk/15/36/bundles/osx-x64/jdk-15_osx-x64_bin.tar.gz/jdk-15.jdk/Contents/Home/bin/jshell 
> -J-Duser.language=en -J--show-version
> java 15 2020-09-15
> Java(TM) SE Runtime Environment (build 15+36-1562)
> Java HotSpot(TM) 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)
> | Welcome to JShell -- Version 15
> | For an introduction type: /help intro
>
> jshell> Pattern validId1 = Pattern.compile("[^\s]+")
> validId1 ==> [^ ]+
>
> jshell> Pattern validId2 = Pattern.compile("[^\s]+")
> validId2 ==> [^\s]+
>
> jshell> validId1.matcher("aaa").matches()
> $3 ==> true
>
> jshell> validId1.matcher("aaa ").matches()
> $4 ==> false
>
> jshell> validId1.matcher("aaa\n").matches()
> $5 ==> true
>
> jshell> validId2.matcher("aaa").matches()
> $6 ==> true
>
> jshell> validId2.matcher("aaa ").matches()
> $7 ==> false
>
> jshell> validId2.matcher("aaa\n").matches()
> $8 ==> false
>
>> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub 
> <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/893*discussion_r547768833__;Iw!!GqivPVa7Brio!JzRqq_cZpzUEFer1m5NX92ABR7tcna9povirJpPwfSxuO4EFI0tRAmRLw80UwpJdsJ1BgQ$>, 
> or unsubscribe 
> <https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AOUXBRQZVY3MLTBJ7SZR7ETSWGONXANCNFSM4TBXTH2Q__;!!GqivPVa7Brio!JzRqq_cZpzUEFer1m5NX92ABR7tcna9povirJpPwfSxuO4EFI0tRAmRLw80UwpK72GWUdA$>.
>

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

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



More information about the build-dev mailing list