Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23] Code assist changes for markdown Javadoc comments #2744 #2772

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ protected final boolean scanForTextBlockBeginning() {
}
return false;
}
protected final boolean scanForMarkdownBeginning() {
protected final boolean lineBeginsWithMarkdown() {
try {
int temp = this.currentPosition;
int count = 0;
Expand Down Expand Up @@ -1470,10 +1470,10 @@ public int getNextToken() throws InvalidInputException {
this.multiCaseLabelComma = false;
return token;
}
private int findCommentType() {
protected int findCommentType() {
int test = getNextChar('/', '*');
if (test == 0) { //line comment or markdown
if (JavaFeature.MARKDOWN_COMMENTS.isSupported(this.complianceLevel, this.previewEnabled)
if (JavaFeature.MARKDOWN_COMMENTS.isSupported(this.sourceLevel, this.previewEnabled)
&& getNextChar('/')) {
return 2;
}
Expand Down Expand Up @@ -1949,7 +1949,7 @@ protected int getNextToken0() throws InvalidInputException {
pushLineSeparator();
}
}
if (!scanForMarkdownBeginning()) {
if (!lineBeginsWithMarkdown()) {
break;
}
}
Expand Down Expand Up @@ -1982,7 +1982,7 @@ protected int getNextToken0() throws InvalidInputException {
pushLineSeparator();
}
}
if (!scanForMarkdownBeginning()) {
if (!lineBeginsWithMarkdown()) {
break;
}
}
Expand Down Expand Up @@ -2846,7 +2846,7 @@ public final void jumpOverMethodBody() {
pushLineSeparator();
}
}
if (!scanForMarkdownBeginning()) {
if (!lineBeginsWithMarkdown()) {
break;
}
}
Expand Down Expand Up @@ -2879,7 +2879,7 @@ public final void jumpOverMethodBody() {
pushLineSeparator();
}
}
if (!scanForMarkdownBeginning()) {
if (!lineBeginsWithMarkdown()) {
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*******************************************************************************/
Expand Down Expand Up @@ -101,44 +105,44 @@ protected Map getCompilerOptions() {
options.put(CompilerOptions.OPTION_Source, this.sourceLevel);
return options;
}
private char[][] getAdditionalTagsPerLevels() {
public static char[][] getAdditionalTagsPerLevels(long complianceLevel) {
char[][] additionalTags = null;
if (this.complianceLevel == ClassFileConstants.JDK1_4) {
if (complianceLevel == ClassFileConstants.JDK1_4) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE
};
} else if (this.complianceLevel > ClassFileConstants.JDK1_4
&& this.complianceLevel < ClassFileConstants.JDK9) {
} else if (complianceLevel > ClassFileConstants.JDK1_4
&& complianceLevel < ClassFileConstants.JDK9) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL
};
} else if (this.complianceLevel == ClassFileConstants.JDK9) {
} else if (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) {
} else if (complianceLevel >= ClassFileConstants.JDK10
&& 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
&& this.complianceLevel < ClassFileConstants.JDK16) {
} else if(complianceLevel >= ClassFileConstants.JDK12
&& complianceLevel < ClassFileConstants.JDK16) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL, TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
};
} else if(this.complianceLevel >= ClassFileConstants.JDK16
&& this.complianceLevel < ClassFileConstants.JDK18) {
} else if(complianceLevel >= ClassFileConstants.JDK16
&& complianceLevel < ClassFileConstants.JDK18) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL, TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY, TAG_RETURN
};
} else if(this.complianceLevel >= ClassFileConstants.JDK18) {
} else if(complianceLevel >= ClassFileConstants.JDK18) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
TAG_CODE, TAG_LITERAL, TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY, TAG_RETURN, TAG_SNIPPET
Expand Down Expand Up @@ -236,7 +240,7 @@ protected void verifyAllTagsCompletion() {
TAG_LINK,
TAG_DOC_ROOT
};
char[][] additionalTags = getAdditionalTagsPerLevels();
char[][] additionalTags = getAdditionalTagsPerLevels(this.complianceLevel);
allTagsFinal = this.complianceLevel > ClassFileConstants.JDK1_8 ? allTagsJava9Plus : this.complianceLevel == ClassFileConstants.JDK1_8 ? allTagsJava8 : allTags ;
if (additionalTags != null) {
int length = allTagsFinal.length;
Expand Down Expand Up @@ -322,7 +326,7 @@ public void test006() {
TAG_LINK,
TAG_DOC_ROOT,
};
char[][] additionalTags = getAdditionalTagsPerLevels();
char[][] additionalTags = getAdditionalTagsPerLevels(this.complianceLevel);
if (additionalTags != null) {
int length = allTags.length;
int add = additionalTags.length;
Expand Down Expand Up @@ -551,7 +555,7 @@ public void test025() {
TAG_LINK,
TAG_DOC_ROOT,
};
char[][] additionalTags = getAdditionalTagsPerLevels();
char[][] additionalTags = getAdditionalTagsPerLevels(this.complianceLevel);
if (additionalTags != null) {
int length = allTags.length;
int add = additionalTags.length;
Expand Down Expand Up @@ -614,7 +618,7 @@ public void test028() {
TAG_LINK,
TAG_DOC_ROOT,
};
char[][] additionalTags = getAdditionalTagsPerLevels();
char[][] additionalTags = getAdditionalTagsPerLevels(this.complianceLevel);
if (additionalTags != null) {
int length = allTags.length;
int add = additionalTags.length;
Expand Down
Loading
Loading