Skip to content

Commit bd7b2b5

Browse files
subyssurendran666noopur2507
authored andcommitted
Corrected the fragments order
1 parent 4f6719f commit bd7b2b5

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/core/manipulation/internal/javadoc/CoreMarkdownAccessImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected String removeDocLineIntros(String textWithSlashes) {
6262

6363
@Override
6464
protected void handleLink(List<? extends ASTNode> fragments) {
65-
if (fragments.size() == 2 && fragments.get(0) instanceof TextElement) {
65+
if (fragments.size() == 2 && fragments.get(0) instanceof TextElement && !(fragments.get(1) instanceof TextElement)) {
6666
// super method expects the reference as first fragment, optional label as second fragment
6767
fragments= Arrays.asList(fragments.get(1), fragments.get(0));
6868
}

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/MarkdownCommentTests.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,4 +958,29 @@ public int foo(int i) {
958958
String actualHtmlContent= getHoverHtmlContent(cu, method);
959959
assertHtmlContent(expectedContent, actualHtmlContent);
960960
}
961+
962+
@Test
963+
public void test2068() throws CoreException {
964+
String source= """
965+
package p;
966+
967+
public class X {
968+
/// @see <a href="https://www.eclipse.org">eclipse.org</a>
969+
/// x
970+
void foo() {}
971+
}
972+
""";
973+
ICompilationUnit cu= getWorkingCopy("/TestSetupProject/src/p/X.java", source, null);
974+
assertNotNull("X.java", cu);
975+
976+
IType type= cu.getType("X");
977+
978+
IMethod method= type.getMethods()[0];
979+
String actualHtmlContent= getHoverHtmlContent(cu, method);
980+
String expectedContent= """
981+
<dl><dt>See Also:</dt><dd><a href="https://www.eclipse.org">eclipse.org</a>
982+
x</dd></dl>
983+
""";
984+
assertHtmlContent(expectedContent, actualHtmlContent);
985+
}
961986
}

0 commit comments

Comments
 (0)