### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java,v retrieving revision 1.8 diff -u -r1.8 FormatJavadocBlock.java --- formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java 27 Jun 2008 16:04:08 -0000 1.8 +++ formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java 10 Nov 2009 21:35:39 -0000 @@ -211,14 +211,14 @@ } // If we have a text after another text, keep the same level to append if (lastTextCanHaveChildren || (htmlDepth == 0 && !lastText.isHtmlTag() && text != null && !text.isHtmlTag())) { - if (textHierarchy == null) textHierarchy = new FormatJavadocText[MAX_TAG_HIERARCHY]; + if (textHierarchy == null) textHierarchy = new FormatJavadocText[htmlDepth+1]; textHierarchy[ptr] = lastText; return textHierarchy; } // Last text cannot have children, so return the built hierarchy return textHierarchy; } - if (textHierarchy == null) textHierarchy = new FormatJavadocText[MAX_TAG_HIERARCHY]; + if (textHierarchy == null) textHierarchy = new FormatJavadocText[htmlDepth+1]; textHierarchy[ptr++] = lastText; lastNode = lastText.htmlNodes[lastText.htmlNodesPtr]; } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java,v retrieving revision 1.7 diff -u -r1.7 FormatterBugsTests.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 9 Nov 2009 22:06:51 -0000 1.7 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 10 Nov 2009 21:35:45 -0000 @@ -1644,6 +1644,125 @@ } /** + * @bug 294618: [formatter] The formatter takes two passes to format a common sequence of html tags + * @test Verify that the specific sequence of html tags is well formatted in one pass + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=294618" + */ +public void testBug294618a() { + String source = + "package wkps3;\n" + + "\n" + + "/**\n" + + " * The formatter was not able to format the current comment:\n" + + " * \n" + + " *
    \n" + + " *
  1. First item\n" + + " *\n" + + " *

  2. Second item\n" + + " *\n" + + " *

  3. First paragraph of third item\n" + + " *\n" + + " *

    Second paragraph of third item\n" + + " *\n" + + " *

    \n" + + " * \n" + + " *
    ::255.255.0.d
    \n" + + " *
  4. \n" + + " *
\n" + + " */\n" + + "public class X01 {\n" + + "\n" + + "}\n"; + formatSource(source, + "package wkps3;\n" + + "\n" + + "/**\n" + + " * The formatter was not able to format the current comment:\n" + + " * \n" + + " *
    \n" + + " *
  1. \n" + + " *

    \n" + + " * First item\n" + + " * \n" + + " *

  2. \n" + + " *

    \n" + + " * Second item\n" + + " * \n" + + " *

  3. \n" + + " *

    \n" + + " * First paragraph of third item\n" + + " * \n" + + " *

    \n" + + " * Second paragraph of third item\n" + + " * \n" + + " *

    \n" + + " * \n" + + " * \n" + + " * \n" + + " *
    ::255.255.0.d\n" + + " * \n" + + " *
    \n" + + " *
  4. \n" + + " *
\n" + + " */\n" + + "public class X01 {\n" + + "\n" + + "}\n" + ); +} +public void testBug294618b() { + String source = + "/**\n" + + " * Verify deep html tag nesting:\n" + + " * \n" + + " *
    \n" + + " *
  1. First item\n" + + " *

  2. Second item\n" + + " *

    \n" + + " *
  3. \n" + + " *
\n" + + " */\n" + + "public class X02 {\n" + + "\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Verify deep html tag nesting:\n" + + " * \n" + + " *
    \n" + + " *
  1. \n" + + " *

    \n" + + " * First item\n" + + " *

  2. \n" + + " *

    \n" + + " * Second item\n" + + " *

    \n" + + " *
  3. \n" + + " *
\n" + + " */\n" + + "public class X02 {\n" + + "\n" + + "}\n" + ); +} + +/** * @bug 294631: [formatter] The formatter takes two passes to format a common sequence of html tags * @test Verify that the specific sequence of html tags is well formatted in one pass * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=294631"