Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2019-03-08 23:37:46 +0000
committerVikas Chandra2019-03-25 04:41:05 +0000
commit7dd8745650d01bdb6132484e7cee2c76fc35bea8 (patch)
tree2ae45580286fafd2c7c2c490d0c5a69c4d0a9af4 /org.eclipse.jdt.core.tests.compiler/src
parent24d47c292ed4bd8fdc28b3c2f9afdab1401d025c (diff)
downloadeclipse.jdt.core-7dd8745650d01bdb6132484e7cee2c76fc35bea8.tar.gz
eclipse.jdt.core-7dd8745650d01bdb6132484e7cee2c76fc35bea8.tar.xz
eclipse.jdt.core-7dd8745650d01bdb6132484e7cee2c76fc35bea8.zip
Bug 544362 - Add support for Java 9/10/11 Javadoc tagsI20190325-0105
- add new @hidden, @index, and @summary tag support to JavadocTagConstants, setting all for JDK 9 except for @summary which is JDK 10 - in IModuleDescription add new methods to get the provides and uses service names and implement these new methods in DocCommentParser and AbstractModule - in JavadocParser, add support @hidden, @index, and @summary - add support for the new tags in TagElement - modify JavadocCompletionParserTest Change-Id: Icd266865ff6fd3fdd1056d567c0e91de613eb300 Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java132
1 files changed, 117 insertions, 15 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
index 42fd9349dd..ba60e7de32 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
@@ -173,7 +173,7 @@ protected void verifyAllTagsCompletion() {
// Block tags
TAG_AUTHOR, TAG_DEPRECATED, TAG_EXCEPTION, TAG_PARAM, TAG_RETURN, TAG_SEE, TAG_VERSION, TAG_CATEGORY,
TAG_SINCE,
- TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD , TAG_THROWS, TAG_USES, TAG_PROVIDES,
+ TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD , TAG_THROWS, TAG_HIDDEN, TAG_USES, TAG_PROVIDES,
// Inline tags
TAG_LINK,
TAG_DOC_ROOT
@@ -183,15 +183,27 @@ protected void verifyAllTagsCompletion() {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE
};
- } else if(this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) {
+ } else if(this.complianceLevel > ClassFileConstants.JDK1_4
+ && this.complianceLevel < ClassFileConstants.JDK9) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL
};
+ } else if (this.complianceLevel == ClassFileConstants.JDK9) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL, TAG_INDEX
+ };
+ } else if (this.complianceLevel > ClassFileConstants.JDK9
+ && this.complianceLevel < ClassFileConstants.JDK12) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL, TAG_INDEX, TAG_SUMMARY
+ };
} else if(this.complianceLevel >= ClassFileConstants.JDK12) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
- TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY
+ TAG_CODE, TAG_LITERAL, TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
};
}
allTagsFinal = this.complianceLevel > ClassFileConstants.JDK1_8 ? allTagsJava9Plus : allTags;
@@ -284,15 +296,29 @@ public void test006() {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE
};
- } else if(this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) {
+ } else if (this.complianceLevel > ClassFileConstants.JDK1_4
+ && this.complianceLevel < ClassFileConstants.JDK9) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL
};
+ } else if (this.complianceLevel == ClassFileConstants.JDK9) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX
+ };
+ } else if (this.complianceLevel >= ClassFileConstants.JDK10
+ && this.complianceLevel < ClassFileConstants.JDK12) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX, TAG_SUMMARY
+ };
} else if(this.complianceLevel >= ClassFileConstants.JDK12) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
- TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY
+ TAG_CODE, TAG_LITERAL, TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
};
}
if (additionalTags != null) {
@@ -432,9 +458,20 @@ public void test020() {
" */\n" +
"public class Test {}\n";
verifyCompletionInJavadoc(source, "@s");
- char[][] expectedTags = {TAG_SEE, TAG_SINCE, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD};
- char[][] expectedTags12Plus = {TAG_SEE, TAG_SINCE, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD,TAG_SYSTEM_PROPERTY};
- verifyCompletionOnJavadocTag("s".toCharArray(),this.complianceLevel >= ClassFileConstants.JDK12 ? expectedTags12Plus : expectedTags, false);
+ char[][] expectedTags = new char[][] {
+ TAG_SEE, TAG_SINCE, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD
+ };
+ if (this.complianceLevel > ClassFileConstants.JDK9
+ && this.complianceLevel < ClassFileConstants.JDK12) {
+ expectedTags = new char[][] {
+ TAG_SEE, TAG_SINCE, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD, TAG_SUMMARY
+ };
+ } else if (this.complianceLevel >= ClassFileConstants.JDK12) {
+ expectedTags = new char[][] {
+ TAG_SEE, TAG_SINCE, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
+ };
+ }
+ verifyCompletionOnJavadocTag("s".toCharArray(), expectedTags, false);
CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode();
assertEquals("Invalid tag start position", 24, completionTag.tagSourceStart);
assertEquals("Invalid tag end position", 28, completionTag.tagSourceEnd+1);
@@ -512,15 +549,30 @@ public void test025() {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE
};
- }else if (this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) {
+ } else if (this.complianceLevel > ClassFileConstants.JDK1_4
+ && this.complianceLevel < ClassFileConstants.JDK9) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL
};
- }else if (this.complianceLevel >= ClassFileConstants.JDK12) {
+ } else if (this.complianceLevel == ClassFileConstants.JDK9) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX
+ };
+ } else if (this.complianceLevel > ClassFileConstants.JDK9
+ && this.complianceLevel < ClassFileConstants.JDK12) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
- TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX, TAG_SUMMARY
+ };
+ } else if (this.complianceLevel >= ClassFileConstants.JDK12) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
};
}
if (additionalTags != null) {
@@ -590,19 +642,32 @@ public void test028() {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE
};
- }
- else if(this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) {
+ } else if (this.complianceLevel > ClassFileConstants.JDK1_4
+ && this.complianceLevel < ClassFileConstants.JDK9) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL
};
+ } else if (this.complianceLevel == ClassFileConstants.JDK9) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX
+ };
+ } else if (this.complianceLevel > ClassFileConstants.JDK9
+ && this.complianceLevel < ClassFileConstants.JDK12) {
+ additionalTags = new char[][] {
+ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX, TAG_SUMMARY
+ };
} else if(this.complianceLevel >= ClassFileConstants.JDK12) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
- TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY
+ TAG_CODE, TAG_LITERAL,
+ TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
};
}
-
if (additionalTags != null) {
int length = allTags.length;
int add = additionalTags.length;
@@ -654,4 +719,41 @@ public void test030() {
int end = source.indexOf('+');
assertEquals("Invalid tag end position", end, completionTag.tagSourceEnd);
}
+
+public void test031() {
+ String source = "package javadoc;\n" +
+ "/**\n" +
+ " * @u+\n" +
+ " */\n" +
+ "module newproj {}\n";
+ verifyCompletionInJavadoc(source, "@u");
+ char[][] allTags = this.complianceLevel < ClassFileConstants.JDK9
+ ? null
+ : new char[][] { TAG_USES };
+ verifyCompletionOnJavadocTag("u".toCharArray(), allTags, false);
+ CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode();
+ int start = source.indexOf("@u");
+ assertEquals("Invalid tag start position", start, completionTag.tagSourceStart);
+ int end = source.indexOf('+');
+ assertEquals("Invalid tag end position", end, completionTag.tagSourceEnd);
+}
+
+public void test032() {
+ String source = "package javadoc;\n" +
+ "/**\n" +
+ " * @p+\n" +
+ " */\n" +
+ "module newproj {}\n";
+ verifyCompletionInJavadoc(source, "@p");
+ char[][] allTags = this.complianceLevel < ClassFileConstants.JDK9
+ ? new char[][] { TAG_PARAM }
+ : new char[][] { TAG_PARAM, TAG_PROVIDES };
+ verifyCompletionOnJavadocTag("p".toCharArray(), allTags, false);
+ CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode();
+ int start = source.indexOf("@p");
+ assertEquals("Invalid tag start position", start, completionTag.tagSourceStart);
+ int end = source.indexOf('+');
+ assertEquals("Invalid tag end position", end, completionTag.tagSourceEnd);
+}
+
}

Back to the top