vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

java_comments_markdown.java (5365B)


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