Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thomann2007-01-05 17:14:08 +0000
committerOlivier Thomann2007-01-05 17:14:08 +0000
commitc1803f6dbb80a08ff9de7af1b901dae4e4e4711c (patch)
tree64339d692c8547f0f5e60d9c31205b8f0687a6ce
parent5e274d225284c242320759d6dd4d54ffbede67b7 (diff)
downloadeclipse.jdt.core-c1803f6dbb80a08ff9de7af1b901dae4e4e4711c.tar.gz
eclipse.jdt.core-c1803f6dbb80a08ff9de7af1b901dae4e4e4711c.tar.xz
eclipse.jdt.core-c1803f6dbb80a08ff9de7af1b901dae4e4e4711c.zip
3.2 maintenance - Fix for 99738
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java74
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html6
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/JavaDocRegion.java4
3 files changed, 72 insertions, 12 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java
index 52e1dfbaf0..2f15fb782d 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,6 +20,10 @@ import org.eclipse.jdt.internal.formatter.comment.JavaDocLine;
import org.eclipse.jdt.internal.formatter.comment.MultiCommentLine;
public class JavaDocTestCase extends CommentTestCase {
+
+ static {
+// TESTS_NAMES = new String[] { "testNoExtraNewlineWithPre1" } ;
+ }
protected static final String INFIX= MultiCommentLine.MULTI_COMMENT_CONTENT_PREFIX;
@@ -90,7 +94,15 @@ public class JavaDocTestCase extends CommentTestCase {
String postfix= DELIMITER + INFIX + "</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$
String input= prefix + "while (i != 0) i--;" + postfix; //$NON-NLS-1$
String expected= prefix + "while (i != 0)" + DELIMITER + INFIX + "\ti--;" + postfix; //$NON-NLS-1$//$NON-NLS-2$
- assertEquals(expected, testFormat(input));
+ String result= testFormat(input);
+ assertEquals(expected, result);
+
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+
+ assertEquals(expected, result);
}
/**
@@ -102,13 +114,29 @@ public class JavaDocTestCase extends CommentTestCase {
String postfix= DELIMITER + INFIX + "</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$
String input= prefix + "while (i != 0) { i--; }" + postfix; //$NON-NLS-1$
String expected= prefix + "while (i != 0) {" + DELIMITER + INFIX + "\ti--;" + DELIMITER + INFIX + "}" + postfix; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals(expected, testFormat(input));
+ String result= testFormat(input);
+ assertEquals(expected, result);
+
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+
+ assertEquals(expected, result);
}
public void testMultiLineCommentCodeSnippet3() {
String input= PREFIX + DELIMITER + "<pre>" + DELIMITER + "while (i != 0)" + DELIMITER + "i--;" + DELIMITER + "</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String expected= PREFIX + DELIMITER + INFIX + "<pre>" + DELIMITER + INFIX + "while (i != 0)" + DELIMITER + INFIX + "\ti--;" + DELIMITER + INFIX + "</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals(expected, testFormat(input));
+ String result= testFormat(input);
+ assertEquals(expected, result);
+
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+
+ assertEquals(expected, result);
}
public void testMultiLineCommentCodeSnippetHtmlEntities1() {
@@ -116,7 +144,15 @@ public class JavaDocTestCase extends CommentTestCase {
String postfix= DELIMITER + INFIX + "</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$
String input= prefix + "System.out.println(\"test\");" + postfix; //$NON-NLS-1$
String expected= prefix + "System.out.println(&quot;test&quot;);" + postfix; //$NON-NLS-1$
- assertEquals(expected, testFormat(input));
+ String result= testFormat(input);
+ assertEquals(expected, result);
+
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+
+ assertEquals(expected, result);
}
public void testMultiLineCommentIndentTabs1() {
@@ -453,9 +489,31 @@ public class JavaDocTestCase extends CommentTestCase {
result= testFormat(result);
result= testFormat(result);
- // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=99738
- String WORKAROUND_BUG_99738= " "; //$NON-NLS-1$
- expected= PREFIX + DELIMITER + INFIX + "<pre>" + DELIMITER + INFIX + WORKAROUND_BUG_99738 + "wrap here" + DELIMITER + INFIX + "</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$; //$NON-NLS-2$; //$NON-NLS-3$;
+ expected= PREFIX + DELIMITER + INFIX + "<pre>" + DELIMITER + INFIX + "wrap here" + DELIMITER + INFIX + "</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$; //$NON-NLS-2$; //$NON-NLS-3$;
+ assertEquals(expected, result);
+ }
+
+ /**
+ * [formatting] Javadoc formatting: extra newline with [pre]
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52921
+ * <p>
+ * This test only formats once.
+ * </p>
+ */
+ public void testNoExtraNewlineWithPre2() {
+ setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, DefaultCodeFormatterConstants.FALSE);
+ String input= PREFIX + DELIMITER + INFIX + "<pre>wrap here</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$
+ String expected= PREFIX + DELIMITER + INFIX + "<pre>wrap here</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$
+ String result= testFormat(input);
+ assertEquals(expected, result);
+
+ // now re-format several times
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+ result= testFormat(result);
+
+ expected= PREFIX + DELIMITER + INFIX + "<pre>wrap here</pre>" + DELIMITER + POSTFIX; //$NON-NLS-1$
assertEquals(expected, result);
}
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index e07e27aceb..037f0d11f8 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -42,13 +42,15 @@
<p><hr><h1>
Eclipse Platform Build Notes<br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.2.2 - ??th January 2007
+Eclipse SDK 3.2.2 - 5th January 2007
<br>Project org.eclipse.jdt.core v_684_R32x
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_684_R32x">cvs</a>).
<h2>What's new in this drop</h2>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=160550">160550</a>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=99738">99738</a>
+[formatting] each format shifts code inside &lt;pre&gt; one space to the right
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=160550">160550</a>
Infinite build when projects have cycle and build path errors
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=114349">114349</a>
[compiler] Problems building cyclical projects
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/JavaDocRegion.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/JavaDocRegion.java
index 0e539f8682..e8f6359883 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/JavaDocRegion.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/JavaDocRegion.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -165,7 +165,7 @@ public class JavaDocRegion extends MultiCommentRegion implements IJavaDocTagCons
}
int prefixOffset= buffer.indexOf(contentPrefix, lineOffset);
if (prefixOffset >= 0 && buffer.substring(lineOffset, prefixOffset).trim().length() == 0)
- buffer.delete(lineOffset, prefixOffset + contentPrefix.length());
+ buffer.delete(lineOffset, prefixOffset + contentPrefix.length() + 1);
}
return convertHtml2Java(buffer.toString());

Back to the top