java_comments_html.java (4775B)
1 // VIM_TEST_SETUP unlet! g:java_no_tab_space_error g:java_ignore_javadoc 2 // VIM_TEST_SETUP unlet! g:java_no_trail_space_error 3 // VIM_TEST_SETUP unlet! g:java_consent_to_html_syntax_folding 4 // VIM_TEST_SETUP let[g:java_space_errors,g:java_comment_strings]=[1,1] 5 // VIM_TEST_SETUP let[g:java_ignore_markdown,g:html_syntax_folding]=[1,1] 6 // VIM_TEST_SETUP let g:markdown_fenced_languages = ["java"] 7 8 9 10 11 // VIM_TEST_SETUP setlocal spell fdc=2 fdl=64 fdm=syntax fen 12 // VIM_TEST_SETUP highlight link javaCommentStart Todo 13 // VIM_TEST_SETUP highlight link javaCommentTitle Underlined 14 15 16 17 18 19 20 21 /**/ /*/ */ /* /*/ /*/*/ /*//*/ /** HTML comment tests. 22 * <p>There is no entry point method {@code main}: 23 * {@snippet file = HTMLSnippets.java region = main id = _01} 24 * <p>There is no textual representation: 25 * {@snippet class = HTMLSnippets region = toString id = _02} */ 26 class HTMLCommentsTests implements Comparable<HTMLCommentsTests> 27 { // JDK 21+. 28 private HTMLCommentsTests() { } 29 30 /** No-op, i. e. no operation. 31 * ({@literal@literal} may be used with {@code .} for contraction.) 32 * @return {@code null} */ 33 Void noOp1() { return null; } 34 35 /** No-op, i.e. no operation. 36 * ({@literal<!-- -->} may be used after {@code .} for contraction.) 37 * @return {@code null} */ 38 Void noOp2() { return null; } 39 40 /** No-op, i.e\u002e no operation. 41 * ({@literal\u005cu002e} is processed early, use alternatives.) 42 * @return {@code null} */ 43 Void noOp3() { return null; } 44 45 /** No-op, i.e{@literal .} no operation. 46 * @return {@code null} */ 47 Void noOp4() { return null; } 48 49 /** No-op, i.e.<!-- --> no operation. 50 * @return {@code null} */ 51 Void noOp5() { return null; } 52 53 /** No-op, i.e. no operation. 54 * @return {@code null} */ 55 Void noOp6() { return null; } 56 57 /** {@return {@code null}, with no-op, i.e. no operation} */ 58 Void noOp7() { return null; } 59 60 /** {@return {@code null}, with no-op, i.e. no operation}.. */ 61 Void noOp8() { return null; } 62 63 /** {@return {@code null}, with no-op, i.e. no operation} . . */ 64 Void noOp9() { return null; } 65 66 /** {@return the major Java version} 67 * @hidden */ 68 protected int majorVersion() { return 21; } 69 70 /** {@summary Compares this instance with the passed {@code that} 71 * instance for order by invoking {@link Integer#compare(int, int) 72 * compare} and passing it {@code this.majorVersion()} and 73 * {@code that.majorVersion()} as respective @arguments.} 74 * {@inheritDoc} */ 75 @Override public int compareTo(HTMLCommentsTests that) 76 { 77 java.util.Objects.requireNonNull(that, "that"); 78 return Integer.compare(this.majorVersion(), 79 that.majorVersion()); 80 } 81 82 /// Returns an empty string for an @Override annotated method 83 /// (see Chapter 9.6.4.4 {@literal @Override} in a Java Language 84 /// Specification) overridden from `java.lang.Object` 85 /// 86 /// @return an empty string /// No period for the above summary! 87 private String asString() { return ""; } 88 89 /** Returns an empty string for an @Override annotated method 90 * (see Chapter 9.6.4.4 {@literal @Override} in a Java Language 91 * Specification) overridden from <code>java.lang.Object</code> 92 * 93 * @return an empty string */// No period for the above summary! 94 @Override public String toString() { return asString(); } 95 } 96 97 // javadoc --snippet-path . --source-path . -d /tmp/html_docs/ -package \ 98 // -tag 'jls:a:See Java Language Specification:' HTMLSnippets.java 99 /** Snippets for HTML comment tests. */ 100 class HTMLSnippets 101 { /* TRAILING BLANKS AND MESSPILLINGS ARE SIGNIFICANT! */ 102 private HTMLSnippets() { } 103 104 /** The method {@code main} must be declared {@code public}, {@code 105 * static}, and {@code void}. It must specify a formal parameter 106 * whose declared type is array of {@link String}. Therefore, 107 * <em>either</em> of the following declarations is acceptable: 108 * {@snippet lang="java": 109 * // @highlight substring="main" type="italic": 110 * public static void main(String[] args) { } 111 * }<br /><pre class="snippet"> 112 *{@code public static void main(String... args) { }}</pre> 113 * 114 * @param args optional commande-line arguments 115 * @jls 12.1.4 Invoke {@code Test.main} */ 116 // @start region = main 117 // @link substring = 'String' target = 'java.lang.String' : 118 public static void main(String[] args) { } 119 // @end 120 121 /** {@return an empty string} 122 * @see <a href="https://docs.oracle.com/javase/specs/jls/se21/html/jls-3.html#jls-3.10.5">3.10.5 String Literals</a> 123 * @see 124 * <a href="https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.3.2">4.3.2 The Class Object</a> 125 * @see java.base/java.lang.Object#toString() */ 126 // @start region = toString 127 // @replace substring = '""' replacement = "\u0022\u0022" 128 // @link regex = '\bString' target = java.lang.String type = linkplain : 129 @Override public String toString() { return ""; } 130 // @end 131 }