diff --git a/impl/src/main/java/org/jboss/forge/roaster/model/impl/JavaDocImpl.java b/impl/src/main/java/org/jboss/forge/roaster/model/impl/JavaDocImpl.java index 838d78bc..47973ecb 100644 --- a/impl/src/main/java/org/jboss/forge/roaster/model/impl/JavaDocImpl.java +++ b/impl/src/main/java/org/jboss/forge/roaster/model/impl/JavaDocImpl.java @@ -16,7 +16,6 @@ import java.util.Set; import org.eclipse.jdt.core.dom.Javadoc; -import org.eclipse.jdt.core.dom.SimpleName; import org.eclipse.jdt.core.dom.TagElement; import org.eclipse.jdt.core.dom.TextElement; import org.jboss.forge.roaster.model.JavaDocTag; @@ -93,22 +92,14 @@ public String getFullText() List fragments = tagElement.fragments(); for (Iterator iterator = fragments.iterator(); iterator.hasNext();) { - Object fragment = iterator.next(); - if (fragment instanceof SimpleName) + String fragment = iterator.next().toString(); + if (text.length() > 0 && (!fragment.startsWith(" ") && text.charAt(text.length() - 1) != ' ')) { - // Param name - text.append(' ').append(fragment); - } - else - { - text.append(fragment); - if (iterator.hasNext()) - { - text.append(' '); - } + text.append(' '); } + text.append(fragment); } - text.append(System.getProperty("line.separator")); + text.append(System.lineSeparator()); } return text.toString().trim(); } diff --git a/tests/src/test/java/org/jboss/forge/test/roaster/model/JavaDocTest.java b/tests/src/test/java/org/jboss/forge/test/roaster/model/JavaDocTest.java index cb2730dd..262d4577 100644 --- a/tests/src/test/java/org/jboss/forge/test/roaster/model/JavaDocTest.java +++ b/tests/src/test/java/org/jboss/forge/test/roaster/model/JavaDocTest.java @@ -30,7 +30,7 @@ */ public class JavaDocTest { - private static final String LINE_SEPARATOR = System.getProperty("line.separator"); + private static final String LINE_SEPARATOR = System.lineSeparator(); @Test public void testJavaDocParsing() @@ -205,4 +205,25 @@ public void testJavaDocFullTextShouldFormatParamWithSpace() + "@return the modified text", method.getJavaDoc().getFullText()); } + + + @Test + public void testJavadocFullTextWithSeeTags() { + JavaClassSource src = Roaster.parse(JavaClassSource.class, + "package issue;\npublic class Issue { \n" + + " /**\n" + + " * Convenience entry point for {@link IdCard} assertions when being mixed with other \"assertThat\" assertion libraries.\n" + + " *\n" + + " * @see #assertThat\n" + + " */\n" + + " public static String someMethod(String actual) {\n" + + " return actual;\n" + + " }}"); + MethodSource method = src.getMethods().get(0); + assertEquals( + "Convenience entry point for {@link IdCard} assertions when being mixed with other \"assertThat\" assertion libraries.\n" + + "@see #assertThat", + method.getJavaDoc().getFullText()); + + } } \ No newline at end of file