diff --git a/groovy-eclipse.setup b/groovy-eclipse.setup
index 64346fe67a..bddbb71b9d 100644
--- a/groovy-eclipse.setup
+++ b/groovy-eclipse.setup
@@ -299,7 +299,7 @@
+ * Note that this node type is used only inside doc comments
+ * ({@link Javadoc Javadoc}).
+ *
+ * The default implementation provided by this class tests whether the
+ * other object is a node of the same type with structurally isomorphic
+ * child subtrees. Subclasses may override this method as needed.
+ *
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
index 0920dfb295..0fc2787096 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
@@ -1051,6 +1051,14 @@ public abstract class ASTNode {
*/
public static final int JAVADOC_REGION = 111;
+ /**
+ * Node type constant indicating a node of type
+ *
+ * The default implementation does nothing and return true.
+ * Subclasses may reimplement.
+ *
@@ -2580,6 +2597,19 @@ public void endVisit(JavaDocRegion node) {
// default implementation: do nothing
}
+ /**
+ * End of visit the given type-specific AST node.
+ *
+ * The default implementation does nothing. Subclasses may reimplement.
+ *
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTextElement.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTextElement.java
new file mode 100644
index 0000000000..a761ad3b9d
--- /dev/null
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTextElement.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.core.dom;
+
+import org.eclipse.jdt.internal.compiler.util.Util;
+
+/**
+ * AST node for a text element within a doc comment.
+ *
+ * N.B. This constructor is package-private; all subclasses must be
+ * declared in the same package; clients are unable to declare
+ * additional subclasses.
+ *
+ * The text element typically includes leading and trailing
+ * whitespace that separates it from the immediately preceding
+ * or following elements.
+ *
+ * This convenience methods checks to see whether the parent
+ * of this node is of type {@link org.eclipse.jdt.core.dom.AbstractTextElement}.
+ *
+ * N.B. This constructor is package-private; all subclasses must be
+ * declared in the same package; clients are unable to declare
+ * additional subclasses.
+ *
+ * The text element typically includes leading and trailing
+ * whitespace that separates it from the immediately preceding
+ * or following elements.
+ *
@@ -156,10 +134,9 @@ public String getText() {
* @exception IllegalArgumentException if the text is null
* or contains a block comment closing delimiter
*/
+ @Override
public void setText(String text) {
- if (text == null) {
- throw new IllegalArgumentException();
- }
+ super.setText(text);
if (text.indexOf("*/") > 0) { //$NON-NLS-1$
throw new IllegalArgumentException();
}
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
index 5775a00de8..f445d0c612 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
@@ -934,6 +934,12 @@ public boolean visit(JavaDocRegion node) {
return false;
}
+ @Override
+ public boolean visit(JavaDocTextElement node) {
+ this.buffer.append(node.getText());
+ return false;
+ }
+
@Override
public boolean visit(LabeledStatement node) {
printIndent();
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index e662bb11a2..ba2bbb89a4 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -3229,6 +3229,17 @@ public boolean visit(Javadoc node) {
return false;
}
+ @Override
+ public boolean visit(JavaDocTextElement node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ String newText= (String) getNewValue(node, JavaDocTextElement.TEXT_PROPERTY);
+ TextEditGroup group = getEditGroup(node, JavaDocTextElement.TEXT_PROPERTY);
+ doTextReplace(node.getStartPosition(), node.getLength(), newText, group);
+ return false;
+ }
+
@Override
public boolean visit(LabeledStatement node) {
if (!hasChildrenChanges(node)) {
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
index 3f4d9a867b..6873d34afd 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -679,6 +679,11 @@ public boolean visit(Javadoc node) {
return false;
}
+ @Override
+ public boolean visit(JavaDocTextElement node) {
+ this.result.append(getAttribute(node, JavaDocTextElement.TEXT_PROPERTY));
+ return false;
+ }
@Override
public boolean visit(LabeledStatement node) {
getChildNode(node, LabeledStatement.LABEL_PROPERTY).accept(this);
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
index f46bad84a2..5da51b2c1b 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
- *
+ *
*
* SPDX-License-Identifier: EPL-2.0
*
@@ -129,14 +129,14 @@ public NodeMarker[] getMarkers() {
public ASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, Map options, String lineDelimiter) {
this.placeholders= placeholders;
this.eventStore= eventStore;
-
+
this.options= options == null ? JavaCore.getOptions() : (Map) new HashMap(options);
this.options.put(
DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY,
DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
this.lineDelimiter= lineDelimiter;
-
+
this.tabWidth= IndentManipulation.getTabWidth(options);
this.indentWidth= IndentManipulation.getIndentWidth(options);
}
@@ -348,6 +348,7 @@ private TextEdit formatNode(ASTNode node, String str, int indentationLevel) {
case ASTNode.METHOD_REF_PARAMETER:
case ASTNode.TAG_ELEMENT:
case ASTNode.TEXT_ELEMENT:
+ case ASTNode.JAVADOC_TEXT_ELEMENT:
// javadoc formatting disabled due to bug 93644
return null;
@@ -569,12 +570,12 @@ public String[] getPrefixAndSuffix(int indent, ASTNode node, RewriteEventStore e
public final Prefix VARARGS= new FormattingPrefix("void foo(A ... a) { }", "A ." , CodeFormatter.K_CLASS_BODY_DECLARATIONS); //$NON-NLS-1$ //$NON-NLS-2$
public final Prefix TRY_RESOURCES = new FormattingPrefix("try (A a = new A(); B b = new B()) {}", "; B" , CodeFormatter.K_STATEMENTS); //$NON-NLS-1$ //$NON-NLS-2$
public final Prefix TRY_RESOURCES_PAREN = new FormattingPrefix("try (A a = new A(); B b = new B()) {}", "y (" , CodeFormatter.K_STATEMENTS); //$NON-NLS-1$ //$NON-NLS-2$
-
+
public final BlockContext IF_BLOCK_WITH_ELSE= new BlockFormattingPrefixSuffix("if (true)", "else{}", 8); //$NON-NLS-1$ //$NON-NLS-2$
public final BlockContext IF_BLOCK_NO_ELSE= new BlockFormattingPrefix("if (true)", 8); //$NON-NLS-1$
public final BlockContext ELSE_AFTER_STATEMENT= new BlockFormattingPrefix("if (true) foo();else ", 15); //$NON-NLS-1$
public final BlockContext ELSE_AFTER_BLOCK= new BlockFormattingPrefix("if (true) {}else ", 11); //$NON-NLS-1$
-
+
public final Prefix CASE_SEPARATION= new FormattingPrefix("case A, B", "A" , CodeFormatter.K_EXPRESSION); //$NON-NLS-1$ //$NON-NLS-2$
public final BlockContext FOR_BLOCK= new BlockFormattingPrefix("for (;;) ", 7); //$NON-NLS-1$
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ClasspathContainerInitializer.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ClasspathContainerInitializer.java
index e70ca2a531..94c248d036 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ClasspathContainerInitializer.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ClasspathContainerInitializer.java
@@ -137,7 +137,7 @@ public ClasspathContainerInitializer() {
* Returns
+ *
* @param containerPath the path of the container which requires to be updated
* @param project the project for which the container is to be updated
* @return returns
* In order to anticipate whether the container initializer allows to update its containers, the predicate
* {@link #canUpdateClasspathContainer(IPath, IJavaProject)} should be used.
- *
+ *
+ *
* @param containerPath the path of the container which is being checked
* @param project the project for which the container is to being checked
* @return returns an Object identifying the container for comparison
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
index ba3afda8fb..6f097c8557 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
@@ -25,20 +25,22 @@
* to a different container object.
*
* The set of entries associated with a classpath container may contain any of the following:
+ *
+ *
* A library entry can reference other libraries through the Class-Path section of the JAR's MANIFEST.MF file. If the
* container wants such referenced entries to be part of the classpath, the container must explicitly add them to the
* array returned from {@link #getClasspathEntries()}.
+ *
* Classpath container values are persisted locally to the workspace, but are not preserved from a
* session to another. It is thus highly recommended to register a
+ *
+ *
* Variable source attachment is also resolved and recorded in the resulting classpath entry.
- *
+ *
- * Note that this deprecated API doesn't handle CPE_CONTAINER entries.
+
*
* @deprecated Use {@link JavaCore#getResolvedClasspathEntry(IClasspathEntry)} instead
*/
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
index 0e0a5f5954..a9c25caf0d 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
@@ -72,7 +72,6 @@ void codeComplete(int offset, ICompletionRequestor requestor)
* is the 0-based index of the character, after which code assist is desired.
* An
*
* @param offset the given offset position
* @param requestor the given completion requestor
@@ -87,7 +86,7 @@ void codeComplete(int offset, ICompletionRequestor requestor)
*/
void codeComplete(int offset, CompletionRequestor requestor)
throws JavaModelException;
-
+
/**
* Performs code completion at the given offset position in this compilation unit,
* reporting results to the given completion requestor. The
*
* @param offset the given offset position
* @param requestor the given completion requestor
@@ -188,7 +187,7 @@ void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner o
*/
void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner)
throws JavaModelException;
-
+
/**
* Performs code completion at the given offset position in this compilation unit,
* reporting results to the given completion requestor. The
*
* @param offset the given offset position
* @param requestor the given completion requestor
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJarEntryResource.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJarEntryResource.java
index 6a169d2752..03f2889fb6 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJarEntryResource.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJarEntryResource.java
@@ -24,7 +24,7 @@
* Files don't have any children and the returned array is always empty.
*
* Jar entry resources that refer to the same element are guaranteed to be equal, but not necessarily identical.
- *
+ *
+ * In case an archive is used by multiple projects, the delta issued will account for
* all of them. This means that even if a project was not part of the elements scope, it
* may still be notified of changes if it is referencing a library comprised in the scope.
+ *
* Since 3.7, a project refresh automatically triggers a refresh of external archives.
* Hence, this method doesn't need to be explicitly called after a project refresh.
- *
+ *
* Note that if a working copy is empty, it will be as if the original compilation
* unit had been deleted.
- *
+ *
* Note that if a working copy is empty, it will be as if the original compilation
* unit had been deleted.
- *
+ * null
+ * @return true
if the subtree matches, or
+ * false
if they do not match or the other object has a
+ * different node type or is null
+ * @since 3.31
+ */
+ public boolean match(JavaDocTextElement node, Object other) {
+ if (!(other instanceof JavaDocTextElement)) {
+ return false;
+ }
+ JavaDocTextElement o = (JavaDocTextElement) other;
+ return safeEquals(node.getText(), o.getText());
+ }
+
/**
* Return whether the deprecated comment strings of the given java doc are equals.
* TextElement
.
+ * @see TextElement
+ * @since 3.31
+ */
+ public static final int JAVADOC_TEXT_ELEMENT = 112;
+
/**
* Returns the node class for the corresponding node type.
@@ -1152,6 +1160,8 @@ public static Class nodeClassForType(int nodeType) {
return Javadoc.class;
case JAVADOC_REGION :
return JavaDocRegion.class;
+ case JAVADOC_TEXT_ELEMENT :
+ return JavaDocTextElement.class;
case LABELED_STATEMENT :
return LabeledStatement.class;
case LAMBDA_EXPRESSION :
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
index 276191d47a..53fb21fae5 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
@@ -920,6 +920,23 @@ public boolean visit(JavaDocRegion node) {
return this.visitDocTags;
}
+ /**
+ * Visits the given type-specific AST node.
+ * true
if the children of this node should be
+ * visited, and false
if the children of this node should
+ * be skipped
+ * @since 3.31
+ */
+ public boolean visit(JavaDocTextElement node) {
+ return true;
+ }
+
/**
* Visits the given type-specific AST node.
*
+ * AbstractTextElement:
+ * Sequence of characters not including a close comment delimiter */
+ *
+ *
+ * @see TextElement
+ * @see JavaDocTextElement
+ * @since 3.31
+ */
+
+@SuppressWarnings("rawtypes")
+public abstract class AbstractTextElement extends ASTNode implements IDocElement {
+
+ /**
+ * The "text" structural property of this node type (type: {@link String}).
+ *
+ */
+ public static final SimplePropertyDescriptor internalTextPropertyFactory(Class nodeClass) {
+ return new SimplePropertyDescriptor(nodeClass, "text", String.class, MANDATORY); //$NON-NLS-1$
+ }
+
+
+ /**
+ * The text element; defaults to the empty string.
+ */
+ String text = Util.EMPTY_STRING;
+
+
+ /**
+ * Creates a new AST node for a text element owned by the given AST.
+ * null
if none.
+ * For top level doc tags such as parameter tags, the tag name
+ * includes the "@" character ("@param").
+ * For inline doc tags such as link tags, the tag name
+ * includes the "@" character ("@link").
+ * The tag name may also be null
; this is used to
+ * represent the material at the start of a doc comment preceding
+ * the first explicit tag.
+ *
+ * @return the tag name, or null
if none
+ */
+ public String getText() {
+ return this.text;
+ }
+
+ /**
+ * Sets the text of this node to the given value.
+ * true
if this node is a nested tag element,
+ * and false if this node is either parented by a doc comment node
+ * ({@link Javadoc}), or is unparented
+ */
+ public boolean isNested() {
+ return (getParent() instanceof AbstractTextElement);
+ }
+
+ @Override
+ int memSize() {
+ int size = BASE_NODE_SIZE + 2 * 3 + stringSize(this.text);
+ return size;
+ }
+
+ @Override
+ int treeSize() {
+ return memSize();
+ }
+}
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
index e26ff479f4..a13b002467 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
@@ -206,6 +206,10 @@ public void endVisit(JavaDocRegion node) {
endVisitNode(node);
}
@Override
+ public void endVisit(JavaDocTextElement node) {
+ endVisitNode(node);
+ }
+ @Override
public void endVisit(LabeledStatement node) {
endVisitNode(node);
}
@@ -641,6 +645,10 @@ public boolean visit(JavaDocRegion node) {
return visitNode(node);
}
@Override
+ public boolean visit(JavaDocTextElement node) {
+ return visitNode(node);
+ }
+ @Override
public boolean visit(LabeledStatement node) {
return visitNode(node);
}
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
index d6aed9e03b..c7bab8a826 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
@@ -1090,18 +1090,26 @@ protected void pushText(int start, int end) {
@Override
protected void pushSnippetText(char[] text, int start, int end, boolean addNewLine, Object snippetTag) {
- boolean isExternalSnippet = false;
+ pushSnippetText(text, start, end, addNewLine, snippetTag, false);
+ }
+
+ private void pushSnippetText(char[] text, int start, int end, boolean addNewLine, Object snippetTag, boolean isExternalSnippet) {
// Create text element
- TextElement textElem = this.ast.newTextElement();
String textToBeAdded= new String( text, start, end-start);
+ AbstractTextElement textElem= null;
+ if (isExternalSnippet && textToBeAdded.indexOf("*/") > 0) { //$NON-NLS-1$
+ textElem = this.ast.newJavaDocTextElement();
+ } else {
+ textElem = this.ast.newTextElement();
+ }
+
int iindex = textToBeAdded.indexOf('*');
if (iindex > -1 && textToBeAdded.substring(0, iindex+1).trim().equals("*")) { //$NON-NLS-1$
textToBeAdded = textToBeAdded.substring(iindex+1);
if (addNewLine) {
textToBeAdded += System.lineSeparator();
}
- } else if (iindex == -1){
- isExternalSnippet = true;
+ } else if (isExternalSnippet){
if (addNewLine) {
textToBeAdded += System.lineSeparator();
}
@@ -1193,7 +1201,7 @@ protected void pushSnippetText(char[] text, int start, int end, boolean addNewLi
endPos = end;
}
Object textVal = region.getProperty(TagProperty.TAG_PROPERTY_SNIPPET_REGION_TEXT);
- if (!(textVal instanceof TextElement)) {
+ if (!(textVal instanceof AbstractTextElement)) {
region.setProperty(TagProperty.TAG_PROPERTY_SNIPPET_REGION_TEXT, textElem);
}
region.setSourceRange(startPos, endPos-startPos);
@@ -1242,38 +1250,8 @@ private void setRegionEnded(JavaDocRegion region, boolean value) {
}
@Override
- protected void pushExternalSnippetText(String text,int start, int end) {
- String snippetLangHeader = ""; //$NON-NLS-1$ //the code snippets comes as preformatted so need to prefix them with
tag
- String snipperLangFooter = "
"; //$NON-NLS-1$
- text = snippetLangHeader + text + snipperLangFooter;
- TextElement textElement = this.ast.newTextElement();
- textElement.setText(text);
- textElement.setSourceRange(start, end-start);
-
- // Search previous tag on which to add the text element
- TagElement previousTag = null;
- int previousStart = start;
- int previousEnd = end;
- if (this.astPtr == -1) {
- previousTag = this.ast.newTagElement();
- previousTag.setSourceRange(start, end-start);
- pushOnAstStack(previousTag, true);
- } else {
- previousTag = (TagElement) this.astStack[this.astPtr];
- previousStart = previousTag.getStartPosition();
- previousEnd = previousStart + previousTag.getLength();
- }
- previousTag.fragments().add(textElement);
- int curStart = previousStart;
- int curEnd = previousEnd;
- if (start < previousStart) {
- curStart = start;
- }
- if (end > previousEnd) {
- curEnd = end;
- }
- previousTag.setSourceRange(curStart, curEnd-curStart);
- this.textStart = -1;
+ protected void pushExternalSnippetText(char[] text, int start, int end, boolean addNewLine, Object snippetTag) {
+ pushSnippetText(text, start, end, addNewLine, snippetTag, true);
}
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocTextElement.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocTextElement.java
new file mode 100644
index 0000000000..9e4bcee82d
--- /dev/null
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocTextElement.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.core.dom;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.internal.compiler.util.Util;
+
+/**
+ * AST node for a text element within a doc comment.
+ *
+ * TextElement:
+ * Sequence of characters including a close comment delimiter */
+ *
+ *
+ * @see Javadoc
+ * @since 3.31
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+@SuppressWarnings("rawtypes")
+public final class JavaDocTextElement extends AbstractTextElement {
+
+ /**
+ * The "text" structural property of this node type (type: {@link String}).
+ */
+
+ public static final SimplePropertyDescriptor TEXT_PROPERTY =
+ internalTextPropertyFactory(JavaDocTextElement.class);
+
+ /**
+ * A list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor}),
+ * or null if uninitialized.
+ */
+ private static final List PROPERTY_DESCRIPTORS;
+
+ static {
+ List propertyList = new ArrayList(2);
+ createPropertyList(JavaDocTextElement.class, propertyList);
+ addProperty(TEXT_PROPERTY, propertyList);
+ PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
+ }
+
+ /**
+ * Returns a list of structural property descriptors for this node type.
+ * Clients must not modify the result.
+ *
+ * @param apiLevel the API level; one of the
+ * AST.JLS*
constants
+ * @return a list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor})
+ */
+ public static List propertyDescriptors(int apiLevel) {
+ return PROPERTY_DESCRIPTORS;
+ }
+
+
+ @Override
+ final SimplePropertyDescriptor internalTextPropertyFactory() {
+ return TEXT_PROPERTY;
+ }
+
+ /**
+ * Creates a new AST node for a text element owned by the given AST.
+ * The new node has an empty text string.
+ * null
tag name and
- * generally contains 1 or more {@link TextElement}s,
+ * generally contains 1 or more {@link AbstractTextElement}s,
* and possibly interspersed with tag elements for nested tags
* like "{@link String String}".
* Subsequent tag elements represent successive top-level doc
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
index 94fbe6ea89..5b83577b9a 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
@@ -453,10 +453,10 @@ public List tagRegionsContainingTextElement(ASTNode docElem) {
public List tagRegionsStartingAtTextElement(ASTNode docElem) {
unsupportedBelow18();
Listtrue
if this container initializer can be requested to perform updates
* on its own container values. If so, then an update request will be performed using
* {@link #requestClasspathContainerUpdate(IPath, IJavaProject, IClasspathContainer)}.
- * true
if the container can be updated
@@ -159,10 +159,11 @@ public boolean canUpdateClasspathContainer(IPath containerPath, IJavaProject pro
* container definition (after reconciling changes) at its earliest convenience, using
* {@link JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)}.
* Until it does so, the update will not be reflected in the Java Model.
+ *
*
* In particular, a classpath container can neither reference further classpath containers or classpath variables.
- * CPE_LIBRARY
) CPE_PROJECT
) ClasspathContainerInitializer
* for each referenced container (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
- * ClasspathContainerInitializer
* registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer", which can
* be invoked if needing to resolve the container before it is explicitly set.
- * null
* if the given path could not be resolved to a classpath entry
- * offset
of -1 indicates to code assist at the beginning of this
* compilation unit.
- * offset
@@ -99,7 +98,8 @@ void codeComplete(int offset, CompletionRequestor requestor)
* can be very long to compute are proposed. To avoid that the code assist operation
* take too much time a {@link IProgressMonitor} which automatically cancel the code
* assist operation when a specified amount of time is reached could be used.
- *
+ *
* new IProgressMonitor() {
* private final static int TIMEOUT = 500; //ms
@@ -113,7 +113,6 @@ void codeComplete(int offset, CompletionRequestor requestor)
* ...
* };
*
- * offset
@@ -207,7 +206,8 @@ void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner ow
* can be very long to compute are proposed. To avoid that the code assist operation
* take too much time a {@link IProgressMonitor} which automatically cancel the code
* assist operation when a specified amount of time is reached could be used.
- *
+ *
* new IProgressMonitor() {
* private final static int TIMEOUT = 500; //ms
@@ -221,7 +221,6 @@ void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner ow
* ...
* };
*
- * IMethods
,
* IFields
, etc.
- * null
if none
* @exception JavaModelException if this element does not exist or if an
diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModel.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModel.java
index 7e7486df01..7a414bbe99 100644
--- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModel.java
+++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModel.java
@@ -224,10 +224,11 @@ public interface IJavaModel extends IJavaElement, IOpenable, IParent {
* setRawClasspath(...)
.
+ *
* The default output location is where class files are ordinarily generated * (and resource files, copied). Each source classpath entry can also @@ -901,12 +902,12 @@ ITypeHierarchy newTypeHierarchy( * necessarily the default output folder. This means that the generated * class files for the project may end up scattered across several folders, * rather than all in the default output folder (which is more standard). - *
+ *
* In order to manually force a project classpath refresh, one can simply assign the project classpath using the result of this
* method, as follows:
* proj.setRawClasspath(proj.readRawClasspath(), proj.readOutputLocation(), monitor)
* (note that the readRawClasspath/readOutputLocation
methods could return null
).
- *
+ *
* @return the workspace-relative absolute path of the default output folder * @see #getOutputLocation() * @since 3.0 diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IOpenable.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IOpenable.java index 40f9d6545d..22513a2491 100644 --- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IOpenable.java +++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IOpenable.java @@ -118,10 +118,10 @@ public interface IOpenable { boolean isConsistent() throws JavaModelException; /** * Returns whether this openable is open. This is a handle-only method. - * + * *Note: This method doesn't tell whether an {@link IJavaProject}'s {@link IJavaProject#getProject() getProject()} is open. * It is not equivalent to {@link IProject#isOpen()}!
- * + * *Note: Although {@link #isOpen} is exposed in the API, clients * rarely have a need to rely on this internal state of the Java model.
@@ -138,7 +138,7 @@ public interface IOpenable { * {@link ICompilationUnit#reconcile(int, boolean, boolean, WorkingCopyOwner, IProgressMonitor)} * operation will not account for changes which occurred before an * explicit use of {@link #makeConsistent(IProgressMonitor)} - *+ *
* @param progress the given progress monitor * @exception JavaModelException if the element is unable to access the contents * of its underlying resource. Reasons include: diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java index 1ec8d70c98..3e2aa59fbf 100644 --- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java +++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java @@ -178,6 +178,7 @@ void codeComplete( * can be very long to compute are proposed. To avoid that the code assist operation * take too much time a {@link IProgressMonitor} which automatically cancel the code * assist operation when a specified amount of time is reached could be used. + * * ** new IProgressMonitor() { @@ -192,7 +193,6 @@ void codeComplete( * ... * }; *- *
* * @param snippet the code snippet * @param insertion the position with in source where the snippet @@ -288,6 +288,7 @@ void codeComplete( * can be very long to compute are proposed. To avoid that the code assist operation * take too much time a {@link IProgressMonitor} which automatically cancel the code * assist operation when a specified amount of time is reached could be used. + *
* ** new IProgressMonitor() { @@ -302,7 +303,6 @@ void codeComplete( * ... * }; *- *
* * @param snippet the code snippet * @param insertion the position with in source where the snippet @@ -1104,7 +1104,7 @@ ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies, IProgressMoni *
* Note that if a working copy is empty, it will be as if the original compilation * unit had been deleted. - *
+ *
* * @param owner the owner of working copies that take precedence over their original compilation units * @param monitor the given progress monitor @@ -1141,7 +1141,7 @@ ITypeHierarchy newSupertypeHierarchy(WorkingCopyOwner owner, IProgressMonitor mo ** Note that if a working copy is empty, it will be as if the original compilation * unit had been deleted. - *
+ *
* * @param project the given project * @param owner the owner of working copies that take precedence over their original compilation units @@ -1215,7 +1215,7 @@ ITypeHierarchy newSupertypeHierarchy(WorkingCopyOwner owner, IProgressMonitor mo ** Note that if a working copy is empty, it will be as if the original compilation * unit had been deleted. - *
+ *
* * @param owner the owner of working copies that take precedence over their original compilation units * @param monitor the given progress monitor diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java index 57bd852390..24004a2e04 100644 --- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java +++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java @@ -446,7 +446,6 @@ public static IStatus validateImportDeclaration(String name, String sourceLevel, /** * Validate the given Java type name, either simple or qualified. * For example,"java.lang.Object"
, or "Object"
.
- *
*
* @param name the name of a type
* @return a status object with code IStatus.OK
if
@@ -794,7 +793,7 @@ public static IStatus validateModuleName(String name, String sourceLevel, String
*
* This validation is intended to anticipate classpath issues prior to assigning it to a project. In particular, it will automatically * be performed during the classpath setting operation (if validation fails, the classpath setting will not complete). - *
+ *
* @param javaProject the given java project * @param rawClasspath the given classpath * @param projectOutputLocation the given output location diff --git a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/IEvaluationContext.java b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/IEvaluationContext.java index 4f14cd522a..d3d1fb2090 100644 --- a/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/IEvaluationContext.java +++ b/jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/IEvaluationContext.java @@ -100,7 +100,7 @@ public interface IEvaluationContext { * reporting results to the given completion requestor. ** Note that code completion does not involve evaluation. - *
+ *
* * @param codeSnippet the code snippet to complete in * @param position the character position in the code snippet to complete at, @@ -132,7 +132,7 @@ public void codeComplete( * ** Note that code completion does not involve evaluation. - *
+ *
* * @param codeSnippet the code snippet to complete in * @param position the character position in the code snippet to complete at, @@ -159,7 +159,7 @@ public void codeComplete( * reporting results to the given completion requestor. ** Note that code completion does not involve evaluation. - *
+ *
* * @param codeSnippet the code snippet to complete in * @param position the character position in the code snippet to complete at, @@ -178,18 +178,19 @@ public void codeComplete( int position, CompletionRequestor requestor) throws JavaModelException; - + /** * Performs a code completion at the given position in the given code snippet, * reporting results to the given completion requestor. ** Note that code completion does not involve evaluation. - *
+ *
* If {@link IProgressMonitor} is not null
then some proposals which
* can be very long to compute are proposed. To avoid that the code assist operation
* take too much time a {@link IProgressMonitor} which automatically cancel the code
* assist operation when a specified amount of time is reached could be used.
- *
+ *
* new IProgressMonitor() { * private final static int TIMEOUT = 500; //ms @@ -203,7 +204,6 @@ public void codeComplete( * ... * }; *- *
* * @param codeSnippet the code snippet to complete in * @param position the character position in the code snippet to complete at, @@ -224,7 +224,7 @@ public void codeComplete( CompletionRequestor requestor, IProgressMonitor monitor) throws JavaModelException; - + /** * Performs a code completion at the given position in the given code snippet, * reporting results to the given completion requestor. @@ -237,7 +237,7 @@ public void codeComplete( *
** Note that code completion does not involve evaluation. - *
+ *
* * @param codeSnippet the code snippet to complete in * @param position the character position in the code snippet to complete at, @@ -258,7 +258,7 @@ public void codeComplete( CompletionRequestor requestor, WorkingCopyOwner owner) throws JavaModelException; - + /** * Performs a code completion at the given position in the given code snippet, * reporting results to the given completion requestor. @@ -271,12 +271,13 @@ public void codeComplete( * ** Note that code completion does not involve evaluation. - *
+ *
* If {@link IProgressMonitor} is not null
then some proposals which
* can be very long to compute are proposed. To avoid that the code assist operation
* take too much time a {@link IProgressMonitor} which automatically cancel the code
* assist operation when a specified amount of time is reached could be used.
- *
+ *
* new IProgressMonitor() { * private final static int TIMEOUT = 500; //ms @@ -290,7 +291,6 @@ public void codeComplete( * ... * }; *- *
* * @param codeSnippet the code snippet to complete in * @param position the character position in the code snippet to complete at, @@ -313,14 +313,14 @@ public void codeComplete( WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException; - + /** * Resolves and returns a collection of Java elements corresponding to the source * code at the given positions in the given code snippet. *
* Note that code select does not involve evaluation, and problems are never * reported. - *
+ *
* * @param codeSnippet the code snippet to resolve in * @param offset the position in the code snippet of the first character @@ -349,7 +349,7 @@ public IJavaElement[] codeSelect(String codeSnippet, int offset, int length) ** Note that code select does not involve evaluation, and problems are never * reported. - *
+ *
* * @param codeSnippet the code snippet to resolve in * @param offset the position in the code snippet of the first character @@ -542,7 +542,7 @@ public void validateImports(ICodeSnippetRequestor requestor) * reporting results to the given completion requestor. ** Note that code completion does not involve evaluation. - *
+ *
* * @param codeSnippet the code snippet to complete in * @param position the character position in the code snippet to complete at, diff --git a/jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java b/jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java index 11f6a736ea..5a6b225e30 100644 --- a/jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java +++ b/jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java @@ -186,6 +186,7 @@ public abstract class SearchPattern { * Match rule: The search pattern contains a Camel Case expression. ** Examples: + *
*+ * * @see #camelCaseMatch(String, String) for a detailed explanation of Camel * Case matching. * @@ -223,10 +224,10 @@ public abstract class SearchPattern { * of other match rule flags are combined with this one, then match rule validation * will return a modified rule in order to perform a better appropriate search request * (see {@link #validateMatchRule(String, int)} for more details). - *
+ * * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed * explanation of Camel Case matching. - *
+ * * @since 3.4 */ public static final int R_CAMELCASE_SAME_PART_COUNT_MATCH = 0x0100; @@ -1532,7 +1533,6 @@ private static SearchPattern createPackagePattern(String patternString, int limi *
/pack.X
find in the unnamed module.ALL-UNNAMED/pack.X
find in the unnamed module.* *
[declaringType '.'] ['<' typeArguments '>'] methodName ['(' parameterTypes ')'] [returnType]
*
* @param stringPattern The string pattern
* @param matchRule The match rule
diff --git a/pom.xml b/pom.xml
index 97e1bc3f60..4d6623f7be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,7 +124,7 @@