Skip to content

Commit

Permalink
Stephan's review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jarthana committed Sep 30, 2024
1 parent d7262c8 commit d716f1e
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,9 @@ protected boolean commentParse() {
int lastStarPosition = -1;

// Init scanner position
this.markdown = this.source[this.javadocStart + 1] == '/';
this.linePtr = getLineNumber(this.firstTagPosition);
int realStart = this.javadocStart;
if (!this.markdown) {
realStart = this.linePtr==1 ? this.javadocStart : this.scanner.getLineEnd(this.linePtr-1)+1;
if (realStart < this.javadocStart) realStart = this.javadocStart;
}
int realStart = this.linePtr==1 ? this.javadocStart : this.scanner.getLineEnd(this.linePtr-1)+1;
if (realStart < this.javadocStart) realStart = this.javadocStart;
this.scanner.resetTo(realStart, this.javadocEnd);
this.index = realStart;
if (realStart == this.javadocStart) {
Expand All @@ -195,6 +191,7 @@ protected boolean commentParse() {
}
int previousPosition = this.index;
char nextCharacter = 0;
this.markdown = this.source[this.javadocStart + 1] == '/';
this.markdownHelper = IMarkdownCommentHelper.create(this);
if (realStart == this.javadocStart) {
nextCharacter = readChar(); // second '*' or '/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected Map getCompilerOptions() {
options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
options.put(CompilerOptions.OPTION_DocCommentSupport, this.docCommentSupport);
options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, this.reportInvalidJavadoc);
options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
if (!CompilerOptions.IGNORE.equals(this.reportInvalidJavadoc)) {
options.put(CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility, this.reportInvalidJavadocVisibility);
}
Expand Down Expand Up @@ -612,4 +613,100 @@ public static void main(String[] args) {
this.reportMissingJavadocTags = bkup;
}
}
public void test022() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runConformTest(new String[] {
"X.java",
"""
import java.lang.annotation.Documented;
/**
* Reference type {@link Documented}:
*/
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"Hello");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
public void test023() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runNegativeTest(new String[] {
"X.java",
"""
import java.lang.annotation.Documented;
/**
* Reference type but no reference here - :
*/
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"----------\n" +
"1. ERROR in X.java (at line 1)\n" +
" import java.lang.annotation.Documented;\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The import java.lang.annotation.Documented is never used\n" +
"----------\n");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
public void test024() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runConformTest(new String[] { "X.java",
"""
import java.lang.annotation.Documented;
///
/// Reference type {@link Documented}:
///
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"Hello");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
public void test025() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runNegativeTest(new String[] { "X.java",
"""
import java.lang.annotation.Documented;
///
/// Reference type but no reference here:
///
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"----------\n" +
"1. ERROR in X.java (at line 1)\n" +
" import java.lang.annotation.Documented;\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The import java.lang.annotation.Documented is never used\n" +
"----------\n");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
}

0 comments on commit d716f1e

Please sign in to comment.