diff options
3 files changed, 56 insertions, 16 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 677874c917..91068fbde9 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -8,6 +8,10 @@ * * SPDX-License-Identifier: EPL-2.0 * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -173,11 +177,16 @@ protected void verifyAllTagsCompletion() { additionalTags = new char[][] { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE }; - } else if(this.complianceLevel > ClassFileConstants.JDK1_4) { + } else if(this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) { additionalTags = new char[][] { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, TAG_CODE, TAG_LITERAL }; + } else if(this.complianceLevel >= ClassFileConstants.JDK12) { + additionalTags = new char[][] { + TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, + TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY + }; } if (additionalTags != null) { int length = allTags.length; @@ -268,11 +277,16 @@ public void test006() { additionalTags = new char[][] { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE }; - } else if (this.complianceLevel > ClassFileConstants.JDK1_4) { + } else if(this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) { additionalTags = new char[][] { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, TAG_CODE, TAG_LITERAL }; + } else if(this.complianceLevel >= ClassFileConstants.JDK12) { + additionalTags = new char[][] { + TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, + TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY + }; } if (additionalTags != null) { int length = allTags.length; @@ -411,7 +425,9 @@ public void test020() { " */\n" + "public class Test {}\n"; verifyCompletionInJavadoc(source, "@s"); - verifyCompletionOnJavadocTag("s".toCharArray(), new char[][] { TAG_SEE, TAG_SINCE, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD }, false); + 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); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); assertEquals("Invalid tag start position", 24, completionTag.tagSourceStart); assertEquals("Invalid tag end position", 28, completionTag.tagSourceEnd+1); @@ -489,12 +505,16 @@ public void test025() { additionalTags = new char[][] { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE }; - } - else if (this.complianceLevel > ClassFileConstants.JDK1_4) { + }else if (this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) { additionalTags = new char[][] { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, TAG_CODE, TAG_LITERAL }; + }else if (this.complianceLevel >= ClassFileConstants.JDK12) { + additionalTags = new char[][] { + TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, + TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY + }; } if (additionalTags != null) { int length = allTags.length; @@ -564,12 +584,18 @@ public void test028() { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE }; } - else if (this.complianceLevel > ClassFileConstants.JDK1_4) { + else if(this.complianceLevel > ClassFileConstants.JDK1_4 && this.complianceLevel < ClassFileConstants.JDK12) { additionalTags = new char[][] { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, TAG_CODE, TAG_LITERAL }; + } else if(this.complianceLevel >= ClassFileConstants.JDK12) { + additionalTags = new char[][] { + TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE, + TAG_CODE, TAG_LITERAL, TAG_SYSTEM_PROPERTY + }; } + if (additionalTags != null) { int length = allTags.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 efad084512..36096a7365 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -8,6 +8,10 @@ * * SPDX-License-Identifier: EPL-2.0 * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -636,7 +640,10 @@ public class JavadocParser extends AbstractCommentParser { } else if (length == TAG_SINCE_LENGTH && CharOperation.equals(TAG_SINCE, tagName, 0, length)) { this.tagValue = TAG_SINCE_VALUE; this.tagWaitingForDescription = this.tagValue; - } + } else if (length == TAG_SYSTEM_PROPERTY_LENGTH && CharOperation.equals(TAG_SYSTEM_PROPERTY, tagName, 0, length)) { + this.tagValue = TAG_SYSTEM_PROPERTY_VALUE; + this.tagWaitingForDescription = this.tagValue; + } break; case 't': if (length == TAG_THROWS_LENGTH && CharOperation.equals(TAG_THROWS, tagName, 0, length)) { 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 ad9af1329e..d4e110de99 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 @@ -48,6 +48,7 @@ public interface JavadocTagConstants { public static final char[] TAG_SINCE = "since".toCharArray(); //$NON-NLS-1$ public static final char[] TAG_VERSION = "version".toCharArray(); //$NON-NLS-1$ public static final char[] TAG_CATEGORY = "category".toCharArray(); //$NON-NLS-1$ + public static final char[] TAG_SYSTEM_PROPERTY = "systemProperty".toCharArray(); //$NON-NLS-1$ // tags lengthes public static final int TAG_DEPRECATED_LENGTH = TAG_DEPRECATED.length; @@ -70,6 +71,7 @@ public interface JavadocTagConstants { public static final int TAG_CODE_LENGTH = TAG_CODE.length; public static final int TAG_LITERAL_LENGTH = TAG_LITERAL.length; public static final int TAG_DOC_ROOT_LENGTH = TAG_DOC_ROOT.length; + public static final int TAG_SYSTEM_PROPERTY_LENGTH = TAG_SYSTEM_PROPERTY.length; // tags value public static final int NO_TAG_VALUE = 0; @@ -93,8 +95,8 @@ public interface JavadocTagConstants { public static final int TAG_CODE_VALUE = 18; public static final int TAG_LITERAL_VALUE = 19; public static final int TAG_DOC_ROOT_VALUE = 20; + public static final int TAG_SYSTEM_PROPERTY_VALUE=21; public static final int TAG_OTHERS_VALUE = 100; - // Tag names array public static final char[][] TAG_NAMES = { CharOperation.NO_CHAR, @@ -118,6 +120,7 @@ public interface JavadocTagConstants { TAG_CODE, /* 18 */ TAG_LITERAL, /* 19 */ TAG_DOC_ROOT, /* 20 */ + TAG_SYSTEM_PROPERTY /* 21 */ }; // tags expected positions @@ -191,7 +194,7 @@ public interface JavadocTagConstants { // since 11 {}, //since 12 - {} + {TAG_SYSTEM_PROPERTY} }; public final static int INLINE_TAGS_LENGTH = INLINE_TAGS.length; public final static int BLOCK_TAGS_LENGTH = BLOCK_TAGS.length; @@ -200,7 +203,6 @@ public interface JavadocTagConstants { public final static short TAG_TYPE_NONE = 0; public final static short TAG_TYPE_INLINE = 1; public final static short TAG_TYPE_BLOCK = 2; - public static final short[] JAVADOC_TAG_TYPE = { TAG_TYPE_NONE, // NO_TAG_VALUE = 0; TAG_TYPE_BLOCK, // TAG_DEPRECATED_VALUE = 1; @@ -222,7 +224,8 @@ public interface JavadocTagConstants { TAG_TYPE_BLOCK, // TAG_VERSION_VALUE = 17; TAG_TYPE_INLINE, // TAG_CODE_VALUE = 18; TAG_TYPE_INLINE, // TAG_LITERAL_VALUE = 19; - TAG_TYPE_INLINE // TAG_DOC_ROOT_VALUE = 20; + TAG_TYPE_INLINE, // TAG_DOC_ROOT_VALUE = 20; + TAG_TYPE_INLINE // TAG_DOC_ROOT_VALUE = 21 }; /* * Tags usage @@ -238,6 +241,7 @@ public interface JavadocTagConstants { TAG_LINKPLAIN, TAG_DOC_ROOT, TAG_VALUE, + TAG_SYSTEM_PROPERTY }; public static final char[][] COMPILATION_UNIT_TAGS = {}; public static final char[][] CLASS_TAGS = { @@ -254,7 +258,8 @@ public interface JavadocTagConstants { TAG_DOC_ROOT, TAG_VALUE, TAG_CODE, - TAG_LITERAL + TAG_LITERAL, + TAG_SYSTEM_PROPERTY }; public static final char[][] FIELD_TAGS = { TAG_SEE, @@ -268,7 +273,8 @@ public interface JavadocTagConstants { TAG_DOC_ROOT, TAG_VALUE, TAG_CODE, - TAG_LITERAL + TAG_LITERAL, + TAG_SYSTEM_PROPERTY }; public static final char[][] METHOD_TAGS = { TAG_SEE, @@ -286,6 +292,7 @@ public interface JavadocTagConstants { TAG_DOC_ROOT, TAG_VALUE, TAG_CODE, - TAG_LITERAL + TAG_LITERAL, + TAG_SYSTEM_PROPERTY }; } |