Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Chandra2019-04-02 07:20:56 -0400
committerVikas Chandra2019-04-04 02:27:29 -0400
commit5a2f7b1345e0151a199710967fa8aed8be0438d3 (patch)
treeea7688496f7137c1a3b96cd63f686ec96c26cb2f
parent5a59c8f2ff4303a5f93a473e385611d1a8ce6073 (diff)
downloadeclipse.jdt.core-5a2f7b1345e0151a199710967fa8aed8be0438d3.tar.gz
eclipse.jdt.core-5a2f7b1345e0151a199710967fa8aed8be0438d3.tar.xz
eclipse.jdt.core-5a2f7b1345e0151a199710967fa8aed8be0438d3.zip
Bug 540485 - [1.8][content assist] Add autocomplete support for
Java 8 Javadoc tags such as @implSpec. Change-Id: Ie4573db49d6efbfbf336f8ef2e01db2dd2fba9de Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java13
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java9
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java34
3 files changed, 52 insertions, 4 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 ba60e7de32..9b78ee7553 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
@@ -169,11 +169,20 @@ protected void verifyAllTagsCompletion() {
TAG_LINK,
TAG_DOC_ROOT,
};
+ char[][] allTagsJava8 = {
+ // 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_API_NOTE, TAG_IMPL_SPEC, TAG_IMPL_NOTE,
+ // Inline tags
+ TAG_LINK,
+ TAG_DOC_ROOT
+ };
char[][] allTagsJava9Plus = {
// 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_HIDDEN, TAG_USES, TAG_PROVIDES,
+ TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD , TAG_THROWS, TAG_API_NOTE, TAG_IMPL_SPEC, TAG_IMPL_NOTE, TAG_HIDDEN, TAG_USES, TAG_PROVIDES,
// Inline tags
TAG_LINK,
TAG_DOC_ROOT
@@ -206,7 +215,7 @@ protected void verifyAllTagsCompletion() {
TAG_CODE, TAG_LITERAL, TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
};
}
- allTagsFinal = this.complianceLevel > ClassFileConstants.JDK1_8 ? allTagsJava9Plus : allTags;
+ allTagsFinal = this.complianceLevel > ClassFileConstants.JDK1_8 ? allTagsJava9Plus : this.complianceLevel == ClassFileConstants.JDK1_8 ? allTagsJava8 : allTags ;
if (additionalTags != null) {
int length = allTagsFinal.length;
int add = additionalTags.length;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
index cba26f476e..8663caba08 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
@@ -523,6 +523,9 @@ public class JavadocParser extends AbstractCommentParser {
if (length == TAG_AUTHOR_LENGTH && CharOperation.equals(TAG_AUTHOR, tagName, 0, length)) {
this.tagValue = TAG_AUTHOR_VALUE;
this.tagWaitingForDescription = this.tagValue;
+ }else if (length == TAG_API_NOTE_LENGTH && CharOperation.equals(TAG_API_NOTE, tagName, 0, length)) {
+ this.tagValue = TAG_API_NOTE_VALUE;
+ this.tagWaitingForDescription = this.tagValue;
}
break;
case 'c':
@@ -594,6 +597,12 @@ public class JavadocParser extends AbstractCommentParser {
}
}
this.tagValue = TAG_INHERITDOC_VALUE;
+ } else if (length == TAG_IMPL_SPEC_LENGTH && CharOperation.equals(TAG_IMPL_SPEC, tagName, 0, length)) {
+ this.tagValue = TAG_IMPL_SPEC_VALUE;
+ this.tagWaitingForDescription = this.tagValue;
+ } else if (length == TAG_IMPL_NOTE_LENGTH && CharOperation.equals(TAG_IMPL_NOTE, tagName, 0, length)) {
+ this.tagValue = TAG_IMPL_NOTE_VALUE;
+ this.tagWaitingForDescription = this.tagValue;
}
break;
case 'l':
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
index 6382f2f68d..a0776e2eff 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
@@ -50,6 +50,9 @@ public interface JavadocTagConstants {
public static final char[] TAG_HIDDEN = "hidden".toCharArray(); //$NON-NLS-1$
public static final char[] TAG_INDEX = "index".toCharArray(); //$NON-NLS-1$
public static final char[] TAG_SUMMARY = "summary".toCharArray(); //$NON-NLS-1$
+ public static final char[] TAG_API_NOTE = "apiNote".toCharArray(); //$NON-NLS-1$
+ public static final char[] TAG_IMPL_SPEC = "implSpec".toCharArray(); //$NON-NLS-1$
+ public static final char[] TAG_IMPL_NOTE = "implNote".toCharArray(); //$NON-NLS-1$
// tags lengthes
public static final int TAG_DEPRECATED_LENGTH = TAG_DEPRECATED.length;
@@ -78,6 +81,9 @@ public interface JavadocTagConstants {
public static final int TAG_HIDDEN_LENGTH = TAG_HIDDEN.length;
public static final int TAG_INDEX_LENGTH = TAG_INDEX.length;
public static final int TAG_SUMMARY_LENGTH = TAG_SUMMARY.length;
+ public static final int TAG_API_NOTE_LENGTH = TAG_API_NOTE.length;
+ public static final int TAG_IMPL_SPEC_LENGTH = TAG_IMPL_SPEC.length;
+ public static final int TAG_IMPL_NOTE_LENGTH = TAG_IMPL_NOTE.length;
// tags value
public static final int NO_TAG_VALUE = 0;
@@ -107,6 +113,9 @@ public interface JavadocTagConstants {
public static final int TAG_HIDDEN_VALUE = 23;
public static final int TAG_INDEX_VALUE = 24;
public static final int TAG_SUMMARY_VALUE = 25;
+ public static final int TAG_API_NOTE_VALUE = 26;
+ public static final int TAG_IMPL_SPEC_VALUE = 27;
+ public static final int TAG_IMPL_NOTE_VALUE = 28;
public static final int TAG_OTHERS_VALUE = 100;
// Tag names array
public static final char[][] TAG_NAMES = {
@@ -137,6 +146,9 @@ public interface JavadocTagConstants {
TAG_HIDDEN, /* 24 */
TAG_INDEX, /* 25 */
TAG_SUMMARY, /* 26 */
+ TAG_API_NOTE, /* 27 */
+ TAG_IMPL_SPEC, /* 28 */
+ TAG_IMPL_NOTE, /* 29 */
};
// tags expected positions
@@ -174,7 +186,7 @@ public interface JavadocTagConstants {
// since 1.7
{},
// since 1.8
- {},
+ {TAG_API_NOTE, TAG_IMPL_SPEC, TAG_IMPL_NOTE},
// since 9
{ TAG_HIDDEN, TAG_USES, TAG_PROVIDES },
// since 10
@@ -247,6 +259,9 @@ public interface JavadocTagConstants {
TAG_TYPE_BLOCK, // TAG_USES_VALUE = 24;
TAG_TYPE_INLINE, // TAG_INDEX_VALUE = 25;
TAG_TYPE_INLINE, // TAG_SUMMARY_VALUE = 26;
+ TAG_TYPE_BLOCK, // TAG_API_NOTE = 27;
+ TAG_TYPE_BLOCK, // TAG_IMPL_SPEC = 28;
+ TAG_TYPE_BLOCK, // TAG_IMPL_NOTE = 29;
};
/*
* Tags usage
@@ -266,6 +281,9 @@ public interface JavadocTagConstants {
TAG_HIDDEN,
TAG_INDEX,
TAG_SUMMARY,
+ TAG_API_NOTE,
+ TAG_IMPL_SPEC,
+ TAG_IMPL_NOTE,
};
public static final char[][] COMPILATION_UNIT_TAGS = {};
public static final char[][] CLASS_TAGS = {
@@ -287,6 +305,9 @@ public interface JavadocTagConstants {
TAG_HIDDEN,
TAG_INDEX,
TAG_SUMMARY,
+ TAG_API_NOTE,
+ TAG_IMPL_SPEC,
+ TAG_IMPL_NOTE,
};
public static final char[][] FIELD_TAGS = {
TAG_SEE,
@@ -305,6 +326,9 @@ public interface JavadocTagConstants {
TAG_INDEX,
TAG_HIDDEN,
TAG_SUMMARY,
+ TAG_API_NOTE,
+ TAG_IMPL_SPEC,
+ TAG_IMPL_NOTE,
};
public static final char[][] METHOD_TAGS = {
TAG_SEE,
@@ -327,6 +351,9 @@ public interface JavadocTagConstants {
TAG_HIDDEN,
TAG_INDEX,
TAG_SUMMARY,
+ TAG_API_NOTE,
+ TAG_IMPL_SPEC,
+ TAG_IMPL_NOTE,
};
public static final char[][] MODULE_TAGS = {
TAG_SEE,
@@ -346,6 +373,9 @@ public interface JavadocTagConstants {
TAG_PROVIDES,
TAG_HIDDEN,
TAG_INDEX,
- TAG_SUMMARY
+ TAG_SUMMARY,
+ TAG_API_NOTE,
+ TAG_IMPL_SPEC,
+ TAG_IMPL_NOTE,
};
}

Back to the top