### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java,v retrieving revision 1.95 diff -u -r1.95 AbstractCommentParser.java --- compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 8 Feb 2011 05:16:20 -0000 1.95 +++ compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 13 Apr 2011 19:17:38 -0000 @@ -284,6 +284,7 @@ refreshReturnStatement(); } if (this.inlineTagStarted) { + textEndPosition = this.index - 1; if (this.lineStarted && this.textStart != -1 && this.textStart < textEndPosition) { pushText(this.textStart, textEndPosition); } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v retrieving revision 1.179 diff -u -r1.179 ASTConverterTestAST3_2.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 7 Jan 2011 15:10:22 -0000 1.179 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 13 Apr 2011 19:17:39 -0000 @@ -75,6 +75,7 @@ import org.eclipse.jdt.core.dom.InfixExpression; import org.eclipse.jdt.core.dom.Initializer; import org.eclipse.jdt.core.dom.InstanceofExpression; +import org.eclipse.jdt.core.dom.Javadoc; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.MethodInvocation; import org.eclipse.jdt.core.dom.Modifier; @@ -95,6 +96,8 @@ import org.eclipse.jdt.core.dom.SuperMethodInvocation; import org.eclipse.jdt.core.dom.SwitchCase; import org.eclipse.jdt.core.dom.SwitchStatement; +import org.eclipse.jdt.core.dom.TagElement; +import org.eclipse.jdt.core.dom.TextElement; import org.eclipse.jdt.core.dom.TryStatement; import org.eclipse.jdt.core.dom.Type; import org.eclipse.jdt.core.dom.TypeDeclaration; @@ -122,7 +125,7 @@ static { // TESTS_NAMES = new String[] {"test0602"}; // TESTS_RANGE = new int[] { 713, -1 }; -// TESTS_NUMBERS = new int[] { 504, 505, 512, 720 }; +// TESTS_NUMBERS = new int[] { 721 }; } public static Test suite() { return buildModelTestSuite(ASTConverterTestAST3_2.class); @@ -10575,4 +10578,39 @@ assertTrue("A constructor", !declaration.isConstructor()); checkSourceRange(declaration, "public void method(final int parameter) { }", source, true/*expectMalformed*/); } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=342455 + */ + public void test0721() throws JavaModelException { + ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0721", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + char[] source = sourceUnit.getSource().toCharArray(); + ASTNode result = runConversion(AST.JLS3, sourceUnit, true); + assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$ + CompilationUnit unit = (CompilationUnit) result; + ASTNode node = getASTNode(unit, 0); + TypeDeclaration declaration = (TypeDeclaration) node; + Javadoc javadoc = declaration.getJavadoc(); + List tags = javadoc.tags(); + TagElement element = (TagElement) tags.get(0); + List fragments = element.fragments(); + element = (TagElement) fragments.get(0); + assertEquals("wrong tag name", "@code", element.getTagName()); + checkSourceRange((TextElement) element.fragments().get(0), " stars*", source); + + element = (TagElement) fragments.get(2); + assertEquals("wrong tag name", "@literal", element.getTagName()); + checkSourceRange((TextElement) element.fragments().get(0), " stars****", source); + + element = (TagElement) fragments.get(4); + assertEquals("wrong tag name", "@code", element.getTagName()); + checkSourceRange((TextElement) element.fragments().get(0), " space* ", source); + + element = (TagElement) fragments.get(5); + assertEquals("wrong tag name", "@code", element.getTagName()); + checkSourceRange((TextElement) element.fragments().get(0), " stars* ", source); + + element = (TagElement) fragments.get(7); + assertEquals("wrong tag name", "@literal", element.getTagName()); + checkSourceRange((TextElement) element.fragments().get(0), " stars**** ", source); + } } \ No newline at end of file Index: workspace/Converter/src/test0721/A.java =================================================================== RCS file: workspace/Converter/src/test0721/A.java diff -N workspace/Converter/src/test0721/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/Converter/src/test0721/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,11 @@ +package test0721; + +/** + * {@code stars*}.
+ * {@literal stars****}.
+ * {@code space* } + * {@code stars* }.
+ * {@literal stars**** }.
+ */ +class A { +} \ No newline at end of file