Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Matela2018-02-26 19:25:47 +0000
committerMateusz Matela2018-02-28 21:01:03 +0000
commitb708843ad11f7f5ff80496fc53b6035686ba8d48 (patch)
tree86284e55f3f7574ee965196663391d7f2fd2ed94
parent50c15c4e1333ba01cb763373ea4bf8e222f99bc0 (diff)
downloadeclipse.jdt.core-I20180228-2000.tar.gz
eclipse.jdt.core-I20180228-2000.tar.xz
eclipse.jdt.core-I20180228-2000.zip
Bug 128653 - [formatter] Improve tag description indentation in javadocI20180228-2000
Change-Id: Icb36b34ae6379812a12791d7665702082e2e82b0 Signed-off-by: Mateusz Matela <mateusz.matela@gmail.com>
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterJavadocDontIndentTagsTests.java3
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java111
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/A_out.java111
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/B_out.java113
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/C_out.java114
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/D_out.java113
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/E_out.java114
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/F_out.java128
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/G_out.java127
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/H_out.java123
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/I_out.java113
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/in.java77
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java52
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java127
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java18
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java24
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/CommentWrapExecutor.java4
17 files changed, 1446 insertions, 26 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterJavadocDontIndentTagsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterJavadocDontIndentTagsTests.java
index cbebb86f47..4f59f0389c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterJavadocDontIndentTagsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterJavadocDontIndentTagsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -52,6 +52,7 @@ protected void setUp() throws Exception {
DefaultCodeFormatter codeFormatter() {
this.formatterPrefs.comment_indent_root_tags = false; // Eclipse default is true
+ this.formatterPrefs.comment_indent_parameter_description = false;
DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(this.formatterPrefs);
return codeFormatter;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
index c5974aca46..b1789a0e7e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -14060,4 +14060,113 @@ public void testBug518235() throws JavaModelException {
"}";
formatSource(source);
}
+
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653a() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = false;
+ this.formatterPrefs.comment_align_tags_names_descriptions = false;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = false;
+ this.formatterPrefs.comment_indent_parameter_description = false;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = false;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "A_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653b() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = true;
+ this.formatterPrefs.comment_align_tags_names_descriptions = false;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = false;
+ this.formatterPrefs.comment_indent_parameter_description = false;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = false;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "B_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653c() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = false;
+ this.formatterPrefs.comment_align_tags_names_descriptions = true;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = false;
+ this.formatterPrefs.comment_indent_parameter_description = false;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = false;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "C_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653d() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = false;
+ this.formatterPrefs.comment_align_tags_names_descriptions = false;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = true;
+ this.formatterPrefs.comment_indent_parameter_description = false;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = false;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "D_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653e() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = false;
+ this.formatterPrefs.comment_align_tags_names_descriptions = true;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = false;
+ this.formatterPrefs.comment_indent_parameter_description = true;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = false;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "E_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653f() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = false;
+ this.formatterPrefs.comment_align_tags_names_descriptions = true;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = false;
+ this.formatterPrefs.comment_indent_parameter_description = false;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = true;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "F_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653g() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = false;
+ this.formatterPrefs.comment_align_tags_names_descriptions = false;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = true;
+ this.formatterPrefs.comment_indent_parameter_description = true;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = true;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "G_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653h() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = false;
+ this.formatterPrefs.comment_align_tags_names_descriptions = false;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = false;
+ this.formatterPrefs.comment_indent_parameter_description = true;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = true;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "H_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/128653 - [formatter] Improve tag description indentation in javadoc
+ */
+public void testBug128653i() throws JavaModelException {
+ this.formatterPrefs.comment_indent_root_tags = true;
+ this.formatterPrefs.comment_align_tags_names_descriptions = false;
+ this.formatterPrefs.comment_align_tags_descriptions_grouped = false;
+ this.formatterPrefs.comment_indent_parameter_description = true;
+ this.formatterPrefs.comment_insert_new_line_for_parameter = false;
+ String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test128653", "I_out.java").getSource());
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/A_out.java
new file mode 100644
index 0000000000..d7481231cb
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/A_out.java
@@ -0,0 +1,111 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first the first param. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @param second a second apram. Curabitur commodo tortor vel sapien elementum,
+ * sit amet varius eros varius.
+ * @param x a third param. Pellentesque ac ipsum. Quisque ac nunc odioque id
+ * nunc convallis nec mi.
+ * @throws Exception1 when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium tincidunt ligula. Ut eget
+ * placerat justo.
+ * @throws OtherException when some other thing happens. Duis feugiat ultricies
+ * magna, sit amet sagittis nibh eleifend eu. Curabitur in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam, quis nostrud
+ * exercitation ullamco. Nullam nec ex vitae felis eleifend lacinia in in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException Curabitur morbi sit amet viverra est. Sed eu libero
+ * in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument Integer diam sapien, interdum a dolor sit amet, vestibulum
+ * vehicula ante. Mauris ultricies odio sit amet nunc laoreet, sed venenatis
+ * enim efficitur.
+ * @throws e Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque metus
+ * accumsan. Curabitur dictum arcu magna, eget mattis lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img the image to be drawn
+ * @param x the x-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param y the y-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param observer the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was painted
+ * successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/B_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/B_out.java
new file mode 100644
index 0000000000..787ac90b75
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/B_out.java
@@ -0,0 +1,113 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first the first param. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @param second a second apram. Curabitur commodo tortor vel sapien elementum,
+ * sit amet varius eros varius.
+ * @param x a third param. Pellentesque ac ipsum. Quisque ac nunc odioque id
+ * nunc convallis nec mi.
+ * @throws Exception1 when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium tincidunt ligula.
+ * Ut eget placerat justo.
+ * @throws OtherException when some other thing happens. Duis feugiat ultricies
+ * magna, sit amet sagittis nibh eleifend eu. Curabitur in egestas
+ * velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam, quis nostrud
+ * exercitation ullamco. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException Curabitur morbi sit amet viverra est. Sed eu libero
+ * in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument Integer diam sapien, interdum a dolor sit amet, vestibulum
+ * vehicula ante. Mauris ultricies odio sit amet nunc laoreet, sed
+ * venenatis enim efficitur.
+ * @throws e Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque metus
+ * accumsan. Curabitur dictum arcu magna, eget mattis lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img the image to be drawn
+ * @param x the x-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param y the y-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param observer the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was painted
+ * successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/C_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/C_out.java
new file mode 100644
index 0000000000..282b996941
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/C_out.java
@@ -0,0 +1,114 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first the first param. Nullam nec ex vitae felis eleifend
+ * lacinia in in velit.
+ * @param second a second apram. Curabitur commodo tortor vel sapien
+ * elementum, sit amet varius eros varius.
+ * @param x a third param. Pellentesque ac ipsum. Quisque ac nunc
+ * odioque id nunc convallis nec mi.
+ * @throws Exception1 when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium
+ * tincidunt ligula. Ut eget placerat justo.
+ * @throws OtherException when some other thing happens. Duis feugiat ultricies
+ * magna, sit amet sagittis nibh eleifend eu. Curabitur
+ * in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco. Nullam nec ex vitae
+ * felis eleifend lacinia in in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException Curabitur morbi sit amet viverra est. Sed eu libero
+ * in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument Integer diam sapien, interdum a dolor sit amet,
+ * vestibulum vehicula ante. Mauris ultricies odio sit amet
+ * nunc laoreet, sed venenatis enim efficitur.
+ * @throws e Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque
+ * metus accumsan. Curabitur dictum arcu magna, eget mattis
+ * lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img the image to be drawn
+ * @param x the x-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param y the y-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param observer the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was
+ * painted successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/D_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/D_out.java
new file mode 100644
index 0000000000..3a2b76484c
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/D_out.java
@@ -0,0 +1,113 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first the first param. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @param second a second apram. Curabitur commodo tortor vel sapien elementum,
+ * sit amet varius eros varius.
+ * @param x a third param. Pellentesque ac ipsum. Quisque ac nunc odioque
+ * id nunc convallis nec mi.
+ * @throws Exception1 when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium
+ * tincidunt ligula. Ut eget placerat justo.
+ * @throws OtherException when some other thing happens. Duis feugiat ultricies
+ * magna, sit amet sagittis nibh eleifend eu. Curabitur
+ * in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam, quis nostrud
+ * exercitation ullamco. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException Curabitur morbi sit amet viverra est. Sed eu libero
+ * in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument Integer diam sapien, interdum a dolor sit amet, vestibulum
+ * vehicula ante. Mauris ultricies odio sit amet nunc laoreet,
+ * sed venenatis enim efficitur.
+ * @throws e Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque metus
+ * accumsan. Curabitur dictum arcu magna, eget mattis lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img the image to be drawn
+ * @param x the x-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param y the y-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param observer the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was painted
+ * successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/E_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/E_out.java
new file mode 100644
index 0000000000..0dd917fdeb
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/E_out.java
@@ -0,0 +1,114 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first the first param. Nullam nec ex vitae felis eleifend
+ * lacinia in in velit.
+ * @param second a second apram. Curabitur commodo tortor vel sapien
+ * elementum, sit amet varius eros varius.
+ * @param x a third param. Pellentesque ac ipsum. Quisque ac nunc
+ * odioque id nunc convallis nec mi.
+ * @throws Exception1 when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium
+ * tincidunt ligula. Ut eget placerat justo.
+ * @throws OtherException when some other thing happens. Duis feugiat ultricies
+ * magna, sit amet sagittis nibh eleifend eu.
+ * Curabitur in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco. Nullam nec ex vitae
+ * felis eleifend lacinia in in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException Curabitur morbi sit amet viverra est. Sed eu libero
+ * in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument Integer diam sapien, interdum a dolor sit amet,
+ * vestibulum vehicula ante. Mauris ultricies odio sit
+ * amet nunc laoreet, sed venenatis enim efficitur.
+ * @throws e Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque
+ * metus accumsan. Curabitur dictum arcu magna, eget mattis
+ * lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img the image to be drawn
+ * @param x the x-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param y the y-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param observer the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was
+ * painted successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/F_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/F_out.java
new file mode 100644
index 0000000000..e9b4f9ebb1
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/F_out.java
@@ -0,0 +1,128 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first
+ * the first param. Nullam nec ex vitae felis eleifend
+ * lacinia in in velit.
+ * @param second
+ * a second apram. Curabitur commodo tortor vel sapien
+ * elementum, sit amet varius eros varius.
+ * @param x
+ * a third param. Pellentesque ac ipsum. Quisque ac nunc
+ * odioque id nunc convallis nec mi.
+ * @throws Exception1
+ * when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium
+ * tincidunt ligula. Ut eget placerat justo.
+ * @throws OtherException
+ * when some other thing happens. Duis feugiat ultricies
+ * magna, sit amet sagittis nibh eleifend eu. Curabitur
+ * in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco. Nullam nec ex vitae
+ * felis eleifend lacinia in in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne
+ * the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter
+ * the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException
+ * Curabitur morbi sit amet viverra est. Sed eu libero
+ * in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument
+ * Integer diam sapien, interdum a dolor sit amet,
+ * vestibulum vehicula ante. Mauris ultricies odio sit amet
+ * nunc laoreet, sed venenatis enim efficitur.
+ * @throws e
+ * Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque
+ * metus accumsan. Curabitur dictum arcu magna, eget mattis
+ * lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img
+ * the image to be drawn
+ * @param x
+ * the x-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param y
+ * the y-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param observer
+ * the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was
+ * painted successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/G_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/G_out.java
new file mode 100644
index 0000000000..9411bdea72
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/G_out.java
@@ -0,0 +1,127 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first
+ * the first param. Nullam nec ex vitae felis eleifend lacinia
+ * in in velit.
+ * @param second
+ * a second apram. Curabitur commodo tortor vel sapien
+ * elementum, sit amet varius eros varius.
+ * @param x
+ * a third param. Pellentesque ac ipsum. Quisque ac nunc
+ * odioque id nunc convallis nec mi.
+ * @throws Exception1
+ * when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium
+ * tincidunt ligula. Ut eget placerat justo.
+ * @throws OtherException
+ * when some other thing happens. Duis feugiat
+ * ultricies magna, sit amet sagittis nibh eleifend
+ * eu. Curabitur in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam, quis nostrud
+ * exercitation ullamco. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne
+ * the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter
+ * the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException
+ * Curabitur morbi sit amet viverra est. Sed eu
+ * libero in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument
+ * Integer diam sapien, interdum a dolor sit amet,
+ * vestibulum vehicula ante. Mauris ultricies odio sit amet
+ * nunc laoreet, sed venenatis enim efficitur.
+ * @throws e
+ * Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque metus
+ * accumsan. Curabitur dictum arcu magna, eget mattis lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img
+ * the image to be drawn
+ * @param x
+ * the x-coordinate of the northwest corner of the
+ * destination rectangle in pixels
+ * @param y
+ * the y-coordinate of the northwest corner of the
+ * destination rectangle in pixels
+ * @param observer
+ * the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was painted
+ * successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/H_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/H_out.java
new file mode 100644
index 0000000000..424aef3ab0
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/H_out.java
@@ -0,0 +1,123 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first
+ * the first param. Nullam nec ex vitae felis eleifend lacinia in in velit.
+ * @param second
+ * a second apram. Curabitur commodo tortor vel sapien elementum, sit amet
+ * varius eros varius.
+ * @param x
+ * a third param. Pellentesque ac ipsum. Quisque ac nunc odioque id nunc
+ * convallis nec mi.
+ * @throws Exception1
+ * when the first thing happens. Nam nec sodales sem. Curabitur odio sem,
+ * sodales ac lorem eget, pretium tincidunt ligula. Ut eget placerat justo.
+ * @throws OtherException
+ * when some other thing happens. Duis feugiat ultricies magna, sit amet
+ * sagittis nibh eleifend eu. Curabitur in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam, quis nostrud
+ * exercitation ullamco. Nullam nec ex vitae felis eleifend lacinia in in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne
+ * the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter
+ * the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException
+ * Curabitur morbi sit amet viverra est. Sed eu libero in mauris facilisis
+ * condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument
+ * Integer diam sapien, interdum a dolor sit amet, vestibulum vehicula ante.
+ * Mauris ultricies odio sit amet nunc laoreet, sed venenatis enim
+ * efficitur.
+ * @throws e
+ * Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque metus
+ * accumsan. Curabitur dictum arcu magna, eget mattis lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img
+ * the image to be drawn
+ * @param x
+ * the x-coordinate of the northwest corner of the destination rectangle in
+ * pixels
+ * @param y
+ * the y-coordinate of the northwest corner of the destination rectangle in
+ * pixels
+ * @param observer
+ * the image observer to be notified as more of the image is converted. May
+ * be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was painted
+ * successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/I_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/I_out.java
new file mode 100644
index 0000000000..78a748fb90
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/I_out.java
@@ -0,0 +1,113 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ * quis nostrud exercitation ullamco.
+ *
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two
+ * three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ * tempor incididunt ut labore et dolore magna aliqua.
+ *
+ * @param first the first param. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @param second a second apram. Curabitur commodo tortor vel sapien elementum,
+ * sit amet varius eros varius.
+ * @param x a third param. Pellentesque ac ipsum. Quisque ac nunc odioque id
+ * nunc convallis nec mi.
+ * @throws Exception1 when the first thing happens. Nam nec sodales sem.
+ * Curabitur odio sem, sodales ac lorem eget, pretium tincidunt
+ * ligula. Ut eget placerat justo.
+ * @throws OtherException when some other thing happens. Duis feugiat ultricies
+ * magna, sit amet sagittis nibh eleifend eu. Curabitur in egestas
+ * velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam, quis nostrud
+ * exercitation ullamco. Nullam nec ex vitae felis eleifend lacinia in
+ * in velit.
+ * @since 1.1.1
+ */
+ void method1() {
+ }
+
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna,
+ * euismod tempus eros.
+ *
+ * @param parameterOne the first param.
+ * <li>item1</li>
+ * <li>item2</li>
+ * <li>item3</li>
+ * @param theSecondParameter the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {
+ }
+
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit
+ * amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ *
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException Curabitur morbi sit amet viverra est. Sed eu libero
+ * in mauris facilisis condimentum.
+ */
+ void method3() {
+ }
+
+ /**
+ * @param argument Integer diam sapien, interdum a dolor sit amet, vestibulum
+ * vehicula ante. Mauris ultricies odio sit amet nunc laoreet, sed
+ * venenatis enim efficitur.
+ * @throws e Proin dignissim enim eu erat cursus fringilla.
+ * <p>
+ * Aliquam efficitur sed turpis ut cursus.
+ * <p>
+ * Nunc pharetra aliquam massa et sagittis.
+ * @param param
+ *
+ * <pre>
+ * int i = 1234;
+ * </pre>
+ *
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque metus
+ * accumsan. Curabitur dictum arcu magna, eget mattis lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {
+ }
+
+ /**
+ * Draws as much of the specified image as is currently available with its
+ * northwest corner at the specified coordinate (x, y). This method will return
+ * immediately in all cases, even if the entire image has not yet been scaled,
+ * dithered and converted for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then the method will
+ * return false and the indicated {@link ImageObserver} object will be notified
+ * as the conversion process progresses.
+ *
+ * @param img the image to be drawn
+ * @param x the x-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param y the y-coordinate of the northwest corner of the destination
+ * rectangle in pixels
+ * @param observer the image observer to be notified as more of the image is
+ * converted. May be <code>null</code>
+ * @return <code>true</code> if the image is completely loaded and was painted
+ * successfully; <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/in.java
new file mode 100644
index 0000000000..856fdcb129
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test128653/in.java
@@ -0,0 +1,77 @@
+/**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
+ * @author kilroy
+ * @see Example2
+ * @see http://wiki.ecipse.org
+ * @deprecated Do not use this class, it's only to test formatting on. One two three four five six seven eight nine ten.
+ */
+public class Example {
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ * @param first the first param. Nullam nec ex vitae felis eleifend lacinia in in velit.
+ * @param second a second apram. Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius.
+ * @param x a third param. Pellentesque ac ipsum. Quisque ac nunc odioque id nunc convallis nec mi.
+ * @throws Exception1 when the first thing happens. Nam nec sodales sem. Curabitur odio sem, sodales ac lorem eget, pretium tincidunt ligula. Ut eget placerat justo.
+ * @throws OtherException when some other thing happens. Duis feugiat ultricies magna, sit amet sagittis nibh eleifend eu. Curabitur in egestas velit.
+ * @return Lorem consectetur adipiscing ut enim ad minim veniam, quis nostrud exercitation ullamco. Nullam nec ex vitae felis eleifend lacinia in in velit.
+ * @since 1.1.1
+ */
+ void method1() {}
+ /**
+ * Curabitur commodo tortor vel sapien elementum, sit amet varius eros varius. Morbi posuere ex sit amet lorem vestibulum pulvinar. In in sagittis urna, euismod tempus eros.
+ * @param parameterOne the first param. <li>item1</li><li>item2</li><li>item3</li>
+ * @param theSecondParameter the second param. <code>line1
+ * line2</code>
+ * @deprecated method1 should be used instead
+ */
+ void method2() {}
+ /**
+ * Curabitur rhoncus felis non elit malesuada, et gravida enim tempus. Morbi sit amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ * @see <a href="http://bugs.eclipse.org">bugzilla</a>
+ * @see method1
+ * @return
+ * @throws RuntimeException Curabitur morbi sit amet viverra est. Sed eu libero in mauris facilisis condimentum.
+ */
+ void method3() {}
+ /**
+ * @param argument Integer diam sapien, interdum a dolor sit amet, vestibulum vehicula ante. Mauris ultricies odio sit amet nunc laoreet, sed venenatis enim efficitur.
+ * @throws e Proin dignissim enim eu erat cursus fringilla.<p>Aliquam efficitur sed turpis ut cursus.<p>Nunc pharetra aliquam massa et sagittis.
+ * @param param <pre>int i = 1234 ;</pre>
+ * @return Nunc ultricies neque eu elit porttitor, vel scelerisque metus accumsan. Curabitur dictum arcu magna, eget mattis lacus congue id.
+ * @gibberish invalid tag?
+ */
+ void method5() {}
+
+
+ /**
+ * Draws as much of the specified image as is currently available
+ * with its northwest corner at the specified coordinate (x, y).
+ * This method will return immediately in all cases, even if the
+ * entire image has not yet been scaled, dithered and converted
+ * for the current output device.
+ * <p>
+ * If the current output representation is not yet complete then
+ * the method will return false and the indicated
+ * {@link ImageObserver} object will be notified as the
+ * conversion process progresses.
+ *
+ * @param img the image to be drawn
+ * @param x the x-coordinate of the northwest corner
+ * of the destination rectangle in pixels
+ * @param y the y-coordinate of the northwest corner
+ * of the destination rectangle in pixels
+ * @param observer the image observer to be notified as more
+ * of the image is converted. May be
+ * <code>null</code>
+ * @return <code>true</code> if the image is completely
+ * loaded and was painted successfully;
+ * <code>false</code> otherwise.
+ * @see Image
+ * @see ImageObserver
+ * @since 1.0
+ */
+ public abstract boolean drawImage(Image img, int x, int y,
+ ImageObserver observer);
+
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
index 21941253c4..60efae1e03 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -1033,14 +1033,64 @@ public class DefaultCodeFormatterConstants {
* - possible values: { TRUE, FALSE }
* - default: TRUE
* </pre>
+ *
+ * Note that at most one of these options can be set to {@code TRUE}:
+ * <li>{@code FORMATTER_COMMENT_INDENT_ROOT_TAGS},
+ * <li>{@code FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS},
+ * <li>{@code FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED}.
+ *
* @see #TRUE
* @see #FALSE
+ * @see #FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS
+ * @see #FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED
* @since 3.1
*/
public final static String FORMATTER_COMMENT_INDENT_ROOT_TAGS = "org.eclipse.jdt.core.formatter.comment.indent_root_tags"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to control whether names and descriptions in Javadoc root tags should be aligned.
+ * - option id: "org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions"
+ * - possible values: { TRUE, FALSE }
+ * - default: TRUE
+ * </pre>
+ *
+ * Note that at most one of these options can be set to {@code TRUE}:
+ * <li>{@code FORMATTER_COMMENT_INDENT_ROOT_TAGS},
+ * <li>{@code FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS},
+ * <li>{@code FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED}.
+ *
+ * @see #TRUE
+ * @see #FALSE
+ * @see #FORMATTER_COMMENT_INDENT_ROOT_TAGS
+ * @see #FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED
+ * @since 3.14
+ */
+ public static final String FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS = "org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions"; //$NON-NLS-1$
+
+ /**
+ * <pre>
+ * FORMATTER / Option to control whether descriptions and names in Javadoc root tags, should be aligned and grouped by tag type.
+ * - option id: "org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped"
+ * - possible values: { TRUE, FALSE }
+ * - default: TRUE
+ * </pre>
+ *
+ * Note that at most one of these options can be set to {@code TRUE}:
+ * <li>{@code FORMATTER_COMMENT_INDENT_ROOT_TAGS},
+ * <li>{@code FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS},
+ * <li>{@code FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED}.
+ *
+ * @see #TRUE
+ * @see #FALSE
+ * @see #FORMATTER_COMMENT_INDENT_ROOT_TAGS
+ * @see #FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS
+ * @since 3.14
+ */
+ public static final String FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED = "org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped"; //$NON-NLS-1$
+
+ /**
+ * <pre>
* FORMATTER / Option to insert an empty line before the Javadoc root tag block
* - option id: "org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags"
* - possible values: { INSERT, DO_NOT_INSERT }
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java
index 2b83816190..c670234170 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2016 Mateusz Matela and others.
+ * Copyright (c) 2014, 2018 Mateusz Matela 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
@@ -39,6 +39,7 @@ import org.eclipse.jdt.core.dom.LineComment;
import org.eclipse.jdt.core.dom.MemberRef;
import org.eclipse.jdt.core.dom.MethodRef;
import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.TagElement;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -549,6 +550,9 @@ public class CommentsPreparator extends ASTVisitor {
this.commentStructure = commentToken.getInternalStructure();
this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true);
this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm);
+
+ handleJavadocTagAlignment(node);
+
return true;
}
@@ -585,16 +589,10 @@ public class CommentsPreparator extends ASTVisitor {
Token token = this.ctm.get(startIndex + 2);
token.breakBefore();
}
-
- if (this.options.comment_indent_root_tags) {
- int indent = this.ctm.getLength(this.ctm.get(startIndex), 0) + 1;
- if (isParamTag && this.options.comment_indent_parameter_description)
- indent += this.options.indentation_size;
- for (int i = startIndex + 1; i <= endIndex; i++) {
+ if (isParamTag && this.options.comment_indent_parameter_description) {
+ for (int i = startIndex + 2; i <= endIndex; i++) {
Token token = this.ctm.get(i);
- token.setIndent(indent);
- // indent is used temporarily, tokens that are actually first in line
- // will have this changed to align (indent is reserved for code inside <pre> tags)
+ token.setIndent(token.getIndent() + this.options.indentation_size);
}
}
@@ -623,6 +621,108 @@ public class CommentsPreparator extends ASTVisitor {
if (TagElement.TAG_SEE.equals(tagName))
handleStringLiterals(this.tm.toString(node), node.getStartPosition());
+
+ if (PARAM_TAGS.contains(tagName) && this.options.comment_indent_parameter_description) {
+ // tokens in the first line should not be indented
+ int startIndex = this.ctm.firstIndexIn(node, -1);
+ int endIndex = this.ctm.lastIndexIn(node, -1);
+ int range = this.options.indentation_size;
+ for (int i = startIndex + 2; i <= endIndex && range > 0; i++) {
+ Token token = this.ctm.get(i);
+ if (token.getLineBreaksBefore() > 0)
+ break;
+ assert token.getIndent() >= this.options.indentation_size;
+ token.setIndent(token.getIndent() - this.options.indentation_size);
+ if (token.getLineBreaksAfter() > 0)
+ break;
+ range -= this.ctm.getLength(token, 0) + (token.isSpaceBefore() ? 1 : 0);
+ }
+ }
+ }
+
+ private void handleJavadocTagAlignment(Javadoc node) {
+ // Lists of tag tokens: index 0 for tag name, index 1 for param name (may be null), the rest for description
+ List<List<Token>> javadocRootTags = new ArrayList<>();
+ List<TagElement> tagElements = node.tags();
+ for (TagElement tagElement : tagElements) {
+ String tagName = tagElement.getTagName();
+ if (tagName == null || tagName.length() <= 1)
+ continue;
+ int startIndex = tokenStartingAt(tagElement.getStartPosition());
+ int nodeEnd = tagElement.getStartPosition() + tagElement.getLength() - 1;
+ while (ScannerHelper.isWhitespace(this.ctm.charAt(nodeEnd)))
+ nodeEnd--;
+ int endIndex = tokenEndingAt(nodeEnd);
+
+ List<Token> tagTokens = new ArrayList<>();
+ tagTokens.add(this.ctm.get(startIndex));
+ if (!PARAM_TAGS.contains(tagName) || tagElement.fragments().isEmpty()
+ || !(tagElement.fragments().get(0) instanceof SimpleName)) {
+ tagTokens.add(null);
+ }
+ for (int i = startIndex + 1; i <= endIndex; i++) {
+ tagTokens.add(this.ctm.get(i));
+ }
+ javadocRootTags.add(tagTokens);
+ }
+
+ // indent is used temporarily, tokens that are actually first in line
+ // will have this changed to align (indent is reserved for code inside <pre> tags)
+ if (this.options.comment_align_tags_names_descriptions) {
+ int maxTagNameLength = 0;
+ int maxParamNameLength = 0;
+ for (List<Token> tagTokens : javadocRootTags) {
+ Token tagName = tagTokens.get(0);
+ Token paramName = tagTokens.get(1);
+ maxTagNameLength = Math.max(maxTagNameLength, this.tm.getLength(tagName, 0));
+ if (paramName != null)
+ maxParamNameLength = Math.max(maxParamNameLength, this.tm.getLength(paramName, 0));
+ }
+ int paramNameAlign = maxTagNameLength + 1;
+ int descriptionAlign = paramNameAlign;
+ if (maxParamNameLength > 0)
+ descriptionAlign += maxParamNameLength + 1;
+ for (List<Token> tagTokens : javadocRootTags) {
+ if (tagTokens.get(1) != null)
+ tagTokens.get(1).setIndent(paramNameAlign);
+ for (int i = 2; i < tagTokens.size(); i++)
+ tagTokens.get(i).setIndent(descriptionAlign);
+ }
+ } else if (this.options.comment_align_tags_descriptions_grouped) {
+ int groupStart = 0;
+ String groupTagName = null;
+ int descriptionAlign = 0;
+ for (int i = 0; i < javadocRootTags.size(); i++) {
+ List<Token> tagTokens = javadocRootTags.get(i);
+ String tagName = this.ctm.toString(tagTokens.get(0));
+ if (!tagName.equals(groupTagName)) {
+ for (int j = groupStart; j < i; j++) {
+ List<Token> tokens = javadocRootTags.get(j);
+ for (int k = 2; k < tokens.size(); k++)
+ tokens.get(k).setIndent(descriptionAlign);
+ }
+ groupStart = i;
+ groupTagName = tagName;
+ descriptionAlign = 0;
+ }
+ int indent = tagName.length() + 1;
+ if (tagTokens.get(1) != null)
+ indent += 1 + this.ctm.getLength(tagTokens.get(1), 0);
+ descriptionAlign = Math.max(descriptionAlign, indent);
+ }
+ for (int j = groupStart; j < javadocRootTags.size(); j++) {
+ List<Token> tokens = javadocRootTags.get(j);
+ for (int k = 2; k < tokens.size(); k++)
+ tokens.get(k).setIndent(descriptionAlign);
+ }
+ } else if (this.options.comment_indent_root_tags) {
+ for (List<Token> tagTokens : javadocRootTags) {
+ Token tagName = tagTokens.get(0);
+ int indent = this.ctm.getLength(tagName, 0) + 1;
+ for (int i = 2; i < tagTokens.size(); i++)
+ tagTokens.get(i).setIndent(indent);
+ }
+ }
}
private void handleHtml(TagElement node) {
@@ -1030,11 +1130,13 @@ public class CommentsPreparator extends ASTVisitor {
}
private void addSubstituteWraps() {
- int commentStart = this.ctm.get(0).originalStart;
+ Token previous = this.ctm.get(0);
+ int commentStart = previous.originalStart;
for (int i = 1; i < this.ctm.size() - 1; i++) {
Token token = this.ctm.get(i);
boolean touchesPrevious = token.originalStart == this.ctm.get(i - 1).originalEnd + 1;
- if (touchesPrevious && token.getWrapPolicy() == null && token.getLineBreaksBefore() == 0) {
+ if (touchesPrevious && token.getLineBreaksBefore() == 0 && previous.getLineBreaksAfter() == 0
+ && token.getWrapPolicy() == null) {
boolean allowWrap = this.allowSubstituteWrapping[token.originalStart - commentStart];
token.setWrapPolicy(allowWrap ? WrapPolicy.SUBSTITUTE_ONLY : WrapPolicy.DISABLE_WRAP);
}
@@ -1047,6 +1149,7 @@ public class CommentsPreparator extends ASTVisitor {
this.ctm.get(tokenStartingAt(pos + 1)).setWrapPolicy(WrapPolicy.SUBSTITUTE_ONLY);
}
}
+ previous = token;
}
}
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
index c38b76dbe4..aa41dd564e 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -197,6 +197,8 @@ public class DefaultCodeFormatterOptions {
public boolean comment_format_source;
public boolean comment_indent_parameter_description;
public boolean comment_indent_root_tags;
+ public boolean comment_align_tags_names_descriptions;
+ public boolean comment_align_tags_descriptions_grouped;
public boolean comment_insert_empty_line_before_root_tags;
public boolean comment_insert_new_line_for_parameter;
public boolean comment_preserve_white_space_between_code_and_line_comments;
@@ -513,6 +515,8 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, this.comment_format_source ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION, this.comment_indent_parameter_description ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INDENT_ROOT_TAGS, this.comment_indent_root_tags ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS, this.comment_align_tags_names_descriptions ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED, this.comment_align_tags_descriptions_grouped ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, this.comment_insert_empty_line_before_root_tags ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_NEW_LINE_FOR_PARAMETER, this.comment_insert_new_line_for_parameter ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_PRESERVE_WHITE_SPACE_BETWEEN_CODE_AND_LINE_COMMENT, this.comment_preserve_white_space_between_code_and_line_comments ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
@@ -1358,6 +1362,14 @@ public class DefaultCodeFormatterOptions {
if (commentIndentRootTagsOption != null) {
this.comment_indent_root_tags = DefaultCodeFormatterConstants.TRUE.equals(commentIndentRootTagsOption);
}
+ final Object commentAlignTagsDescriptionsOption= settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_ALIGN_TAGS_NAMES_DESCRIPTIONS);
+ if (commentAlignTagsDescriptionsOption != null) {
+ this.comment_align_tags_names_descriptions = DefaultCodeFormatterConstants.TRUE.equals(commentAlignTagsDescriptionsOption);
+ }
+ final Object commentAlignTagsGroupedOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_ALIGN_TAGS_DESCREIPTIONS_GROUPED);
+ if (commentAlignTagsGroupedOption != null) {
+ this.comment_align_tags_descriptions_grouped = DefaultCodeFormatterConstants.TRUE.equals(commentAlignTagsGroupedOption);
+ }
final Object commentInsertEmptyLineBeforeRootTagsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS);
if (commentInsertEmptyLineBeforeRootTagsOption != null) {
this.comment_insert_empty_line_before_root_tags = JavaCore.INSERT.equals(commentInsertEmptyLineBeforeRootTagsOption);
@@ -2486,6 +2498,8 @@ public class DefaultCodeFormatterOptions {
this.comment_format_source = true;
this.comment_indent_parameter_description = true;
this.comment_indent_root_tags = true;
+ this.comment_align_tags_names_descriptions = false;
+ this.comment_align_tags_descriptions_grouped = false;
this.comment_insert_empty_line_before_root_tags = true;
this.comment_insert_new_line_for_parameter = true;
this.comment_new_lines_at_block_boundaries = true;
@@ -2797,6 +2811,8 @@ public class DefaultCodeFormatterOptions {
this.comment_format_source = true;
this.comment_indent_parameter_description = true;
this.comment_indent_root_tags = true;
+ this.comment_align_tags_names_descriptions = false;
+ this.comment_align_tags_descriptions_grouped = false;
this.comment_insert_empty_line_before_root_tags = true;
this.comment_insert_new_line_for_parameter = true;
this.comment_new_lines_at_block_boundaries = true;
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java
index c47d13d7e8..8b40368484 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2016 Mateusz Matela and others.
+ * Copyright (c) 2014, 2018 Mateusz Matela 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
@@ -173,8 +173,7 @@ public class TextEditsBuilder extends TokenTraverser {
} else if (index == 0 && this.parent == null) {
bufferIndent(token, index);
} else {
- bufferAlign(token, index);
- if (isSpaceBefore() && token.getAlign() == 0)
+ if (!bufferAlign(token, index) && isSpaceBefore())
this.buffer.append(' ');
}
}
@@ -278,10 +277,16 @@ public class TextEditsBuilder extends TokenTraverser {
target.append(indentChars);
}
- private void bufferAlign(Token token, int index) {
+ private boolean bufferAlign(Token token, int index) {
int align = token.getAlign();
+ int alignmentChar = this.alignChar;
+ if (align == 0 && getLineBreaksBefore() == 0 && this.parent != null) {
+ align = token.getIndent();
+ token.setAlign(align);
+ alignmentChar = DefaultCodeFormatterOptions.SPACE;
+ }
if (align == 0)
- return;
+ return false;
int currentPositionInLine = 0;
if (getLineBreaksBefore() > 0) {
@@ -291,11 +296,11 @@ public class TextEditsBuilder extends TokenTraverser {
currentPositionInLine = this.tm.getPositionInLine(index - 1);
currentPositionInLine += this.tm.getLength(this.tm.get(index - 1), currentPositionInLine);
}
- if (isSpaceBefore())
- align = Math.max(align, currentPositionInLine + 1);
+ if (currentPositionInLine >= align)
+ return false;
final int tabSize = this.options.tab_size;
- switch (this.alignChar) {
+ switch (alignmentChar) {
case DefaultCodeFormatterOptions.SPACE:
while (currentPositionInLine++ < align) {
this.buffer.append(' ');
@@ -317,8 +322,9 @@ public class TextEditsBuilder extends TokenTraverser {
}
break;
default:
- throw new IllegalStateException("Unrecognized align char: " + this.alignChar); //$NON-NLS-1$
+ throw new IllegalStateException("Unrecognized align char: " + alignmentChar); //$NON-NLS-1$
}
+ return true;
}
private void flushBuffer(int currentPosition) {
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/CommentWrapExecutor.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/CommentWrapExecutor.java
index 3923553f60..d9646a97a0 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/CommentWrapExecutor.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/CommentWrapExecutor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2017 Mateusz Matela and others.
+ * Copyright (c) 2014, 2018 Mateusz Matela 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
@@ -161,6 +161,8 @@ public class CommentWrapExecutor extends TokenTraverser {
}
}
+ if (index > 1 && getNext() != null && (token.getAlign() + token.getIndent()) > 0)
+ this.counter = Math.max(this.counter, getStartingPosition(token));
this.counter += this.tm.getLength(token, this.counter);
this.counterIfWrapped += this.tm.getLength(token, this.counterIfWrapped);
this.counterIfWrappedSubstitute += this.tm.getLength(token, this.counterIfWrappedSubstitute);

Back to the top