@@ -2234,4 +2234,84 @@ public class Markdown{}
22342234 assertEquals ("incorrect Fifth tagElement" , ASTNode .TAG_ELEMENT , tags .get (4 ).getNodeType ());
22352235 }
22362236 }
2237+
2238+ public void testIncorrectLinkTagParsing4743_01 () throws JavaModelException {
2239+ String source ="""
2240+ /// {@link java.lang.String}
2241+ public class Markdown{}
2242+ """ ;
2243+ this .workingCopies = new ICompilationUnit [1 ];
2244+ this .workingCopies [0 ] = getWorkingCopy ("/Converter_25/src/markdown/Markdown.java" , source , null );
2245+ if (this .docCommentSupport .equals (JavaCore .ENABLED )) {
2246+ CompilationUnit compilUnit = (CompilationUnit ) runConversion (this .workingCopies [0 ], true );
2247+ TypeDeclaration typedeclaration = (TypeDeclaration ) compilUnit .types ().get (0 );
2248+ Javadoc javadoc = typedeclaration .getJavadoc ();
2249+ List <TagElement > tags = javadoc .tags ();
2250+ TagElement firstTag = tags .get (0 );
2251+ List <?> frags = firstTag .fragments ();
2252+ assertEquals ("Incorrect Frags" , 1 , frags .size ());
2253+ TagElement innerTag = (TagElement ) frags .get (0 );
2254+ assertEquals ("invalid tag name" ,"@link" ,innerTag .getTagName ());
2255+ }
2256+ }
2257+
2258+ public void testIncorrectLinkTagParsing4743_02 () throws JavaModelException {
2259+ String source ="""
2260+ /// {@linkplain java.lang.String}
2261+ public class Markdown{}
2262+ """ ;
2263+ this .workingCopies = new ICompilationUnit [1 ];
2264+ this .workingCopies [0 ] = getWorkingCopy ("/Converter_25/src/markdown/Markdown.java" , source , null );
2265+ if (this .docCommentSupport .equals (JavaCore .ENABLED )) {
2266+ CompilationUnit compilUnit = (CompilationUnit ) runConversion (this .workingCopies [0 ], true );
2267+ TypeDeclaration typedeclaration = (TypeDeclaration ) compilUnit .types ().get (0 );
2268+ Javadoc javadoc = typedeclaration .getJavadoc ();
2269+ List <TagElement > tags = javadoc .tags ();
2270+ TagElement firstTag = tags .get (0 );
2271+ List <?> frags = firstTag .fragments ();
2272+ assertEquals ("Incorrect Frags" , 1 , frags .size ());
2273+ TagElement innerTag = (TagElement ) frags .get (0 );
2274+ assertEquals ("invalid tag name" ,"@linkplain" ,innerTag .getTagName ());
2275+ }
2276+ }
2277+
2278+ public void testIncorrectLinkTagParsing4743_03 () throws JavaModelException {
2279+ String source ="""
2280+ /// {@code List<String>}
2281+ public class Markdown{}
2282+ """ ;
2283+ this .workingCopies = new ICompilationUnit [1 ];
2284+ this .workingCopies [0 ] = getWorkingCopy ("/Converter_25/src/markdown/Markdown.java" , source , null );
2285+ if (this .docCommentSupport .equals (JavaCore .ENABLED )) {
2286+ CompilationUnit compilUnit = (CompilationUnit ) runConversion (this .workingCopies [0 ], true );
2287+ TypeDeclaration typedeclaration = (TypeDeclaration ) compilUnit .types ().get (0 );
2288+ Javadoc javadoc = typedeclaration .getJavadoc ();
2289+ List <TagElement > tags = javadoc .tags ();
2290+ TagElement firstTag = tags .get (0 );
2291+ List <?> frags = firstTag .fragments ();
2292+ assertEquals ("Incorrect Frags" , 1 , frags .size ());
2293+ TagElement innerTag = (TagElement ) frags .get (0 );
2294+ assertEquals ("invalid tag name" ,"@code" ,innerTag .getTagName ());
2295+ }
2296+ }
2297+
2298+ public void testIncorrectLinkTagParsing4743_04 () throws JavaModelException {
2299+ String source ="""
2300+ /// {@literal List<String>}
2301+ public class Markdown{}
2302+ """ ;
2303+ this .workingCopies = new ICompilationUnit [1 ];
2304+ this .workingCopies [0 ] = getWorkingCopy ("/Converter_25/src/markdown/Markdown.java" , source , null );
2305+ if (this .docCommentSupport .equals (JavaCore .ENABLED )) {
2306+ CompilationUnit compilUnit = (CompilationUnit ) runConversion (this .workingCopies [0 ], true );
2307+ TypeDeclaration typedeclaration = (TypeDeclaration ) compilUnit .types ().get (0 );
2308+ Javadoc javadoc = typedeclaration .getJavadoc ();
2309+ List <TagElement > tags = javadoc .tags ();
2310+ TagElement firstTag = tags .get (0 );
2311+ List <?> frags = firstTag .fragments ();
2312+ assertEquals ("Incorrect Frags" , 1 , frags .size ());
2313+ TagElement innerTag = (TagElement ) frags .get (0 );
2314+ assertEquals ("invalid tag name" ,"@literal" ,innerTag .getTagName ());
2315+ }
2316+ }
22372317}
0 commit comments