Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core.tests.model')
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java681
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java290
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java3
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test167/A_out.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test169/A_out.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test170/A_out.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test337/A_out.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test455/A_out.java14
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test484/A_out.java5
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test485/A_out.java5
10 files changed, 957 insertions, 57 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
index 678bc405d..c3b07c5c8 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
@@ -14,6 +14,7 @@ import java.util.Map;
import junit.framework.Test;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
@@ -634,6 +635,529 @@ public void testBug027079f4() throws JavaModelException {
}
/**
+ * @bug 59891: [formatter] the code formatter doesn't respect my new lines
+ * @test Ensure that the formatter keep line breaks wrapping set by users in the code
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=59891"
+ */
+public void testBug059891_01() throws JavaModelException {
+ this.formatterPrefs.page_width = 40;
+ String source =
+ "public class X01 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4), bar(5, 6, 7, 8));\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4),\n" +
+ " bar(5, 6, 7, 8));\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_01b() throws JavaModelException {
+ this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "40");
+ this.formatterOptions.put(
+ DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
+ DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
+ String source =
+ "public class X01 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4), bar(5, 6, 7, 8));\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4),\n" +
+ " bar(5, 6, 7, 8));\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_02() throws JavaModelException {
+ this.formatterPrefs.page_width = 40;
+ String source =
+ "public class X02 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), bar(11, 12, 13, 14, 15, 16, 17, 18, 19, 20));\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X02 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4, 5, 6, 7, 8,\n" +
+ " 9, 10),\n" +
+ " bar(11, 12, 13, 14, 15,\n" +
+ " 16, 17, 18, 19,\n" +
+ " 20));\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_02b() throws JavaModelException {
+ this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "40");
+ this.formatterOptions.put(
+ DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
+ DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
+ String source =
+ "public class X02 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), bar(11, 12, 13, 14, 15, 16, 17, 18, 19, 20));\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X02 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4, 5, 6, 7, 8,\n" +
+ " 9, 10),\n" +
+ " bar(11, 12, 13, 14, 15, 16,\n" +
+ " 17, 18, 19, 20));\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_03() throws JavaModelException {
+ this.formatterPrefs.page_width = 40;
+ String source =
+ "public class X03 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4), bar(5, 6, 7, 8), bar(9, 10, 11, 12));\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X03 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4),\n" +
+ " bar(5, 6, 7, 8),\n" +
+ " bar(9, 10, 11, 12));\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_03b() throws JavaModelException {
+ this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "40");
+ this.formatterOptions.put(
+ DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
+ DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
+ String source =
+ "public class X03 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4), bar(5, 6, 7, 8), bar(9, 10, 11, 12));\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X03 {\n" +
+ " void test() {\n" +
+ " foo(bar(1, 2, 3, 4),\n" +
+ " bar(5, 6, 7, 8),\n" +
+ " bar(9, 10, 11, 12));\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=146175
+public void testBug059891_146175() throws JavaModelException {
+ String source =
+ "public class FormatterDemo {\n" +
+ "\n" +
+ " public void fooBar() {\n" +
+ " SomeOtherClass instanceOfOtherClass = new SomeOtherClass();\n" +
+ "\n" +
+ " /* The following statement demonstrates the formatter issue */\n" +
+ " SomeOtherClass.someMethodInInnerClass(\n" +
+ " instanceOfOtherClass.anotherMethod(\"Value of paramter 1\"),\n" +
+ " instanceOfOtherClass.anotherMethod(\"Value of paramter 2\"));\n" +
+ "\n" +
+ " }\n" +
+ "\n" +
+ " private static class SomeOtherClass {\n" +
+ " public static void someMethodInInnerClass(\n" +
+ " String param1,\n" +
+ " String param2) {\n" +
+ " }\n" +
+ " public String anotherMethod(String par) {\n" +
+ " return par;\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class FormatterDemo {\n" +
+ "\n" +
+ " public void fooBar() {\n" +
+ " SomeOtherClass instanceOfOtherClass = new SomeOtherClass();\n" +
+ "\n" +
+ " /* The following statement demonstrates the formatter issue */\n" +
+ " SomeOtherClass.someMethodInInnerClass(\n" +
+ " instanceOfOtherClass.anotherMethod(\"Value of paramter 1\"),\n" +
+ " instanceOfOtherClass.anotherMethod(\"Value of paramter 2\"));\n" +
+ "\n" +
+ " }\n" +
+ "\n" +
+ " private static class SomeOtherClass {\n" +
+ " public static void someMethodInInnerClass(String param1, String param2) {\n" +
+ " }\n" +
+ "\n" +
+ " public String anotherMethod(String par) {\n" +
+ " return par;\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=164093
+public void testBug059891_164093_01() throws JavaModelException {
+ this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "30");
+ this.formatterOptions.put(
+ DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
+ DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
+ String source =
+ "public class Test {\n" +
+ " int someLongMethodName(int foo, boolean bar, String yetAnotherArg) {\n" +
+ " return 0;\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class Test {\n" +
+ " int someLongMethodName( int foo,\n" +
+ " boolean bar,\n" +
+ " String yetAnotherArg) {\n" +
+ " return 0;\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_164093_02() throws JavaModelException {
+ this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "55");
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
+ this.formatterOptions.put(
+ DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION,
+ DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
+ String source =
+ "public class X01 {\n" +
+ " void foo() {\n" +
+ " someIdentifier(someArg).someMethodName().someMethodName(foo, bar).otherMethod(arg0, arg1);\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ " void foo() {\n" +
+ " someIdentifier(someArg).someMethodName()\n" +
+ " .someMethodName(foo,\n" +
+ " bar)\n" +
+ " .otherMethod(arg0, arg1);\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=203588
+public void testBug059891_203588() throws JavaModelException {
+ String source =
+ "public class Test {\n" +
+ "public void a()\n" +
+ "{\n" +
+ " if(true)\n" +
+ " {\n" +
+ " allocation.add(idx_ta + 1, Double.valueOf(allocation.get(idx_ta).doubleValue() + q));\n" +
+ " }\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class Test {\n" +
+ " public void a() {\n" +
+ " if (true) {\n" +
+ " allocation.add(idx_ta + 1,\n" +
+ " Double.valueOf(allocation.get(idx_ta).doubleValue() + q));\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+// wksp1
+public void testBug059891_wksp1_01() throws JavaModelException {
+ String source =
+ "public class X01 {\n" +
+ " private void reportError(String name) throws ParseError {\n" +
+ " throw new ParseError(MessageFormat.format(AntDTDSchemaMessages.getString(\"NfmParser.Ambiguous\"), new String[]{name})); //$NON-NLS-1$\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ " private void reportError(String name) throws ParseError {\n" +
+ " throw new ParseError(\n" +
+ " MessageFormat.format(\n" +
+ " AntDTDSchemaMessages.getString(\"NfmParser.Ambiguous\"), new String[] { name })); //$NON-NLS-1$\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_02() throws JavaModelException {
+ String source =
+ "public class X02 {\n" +
+ " private void parseBuildFile(Project project) {\n" +
+ " if (!buildFile.exists()) {\n" +
+ " throw new BuildException(MessageFormat.format(InternalAntMessages.getString(\"InternalAntRunner.Buildfile__{0}_does_not_exist_!_1\"), //$NON-NLS-1$\n" +
+ " new String[]{buildFile.getAbsolutePath()}));\n" +
+ " }\n" +
+ " if (!buildFile.isFile()) {\n" +
+ " throw new BuildException(MessageFormat.format(InternalAntMessages.getString(\"InternalAntRunner.Buildfile__{0}_is_not_a_file_1\"), //$NON-NLS-1$\n" +
+ " new String[]{buildFile.getAbsolutePath()}));\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X02 {\n" +
+ " private void parseBuildFile(Project project) {\n" +
+ " if (!buildFile.exists()) {\n" +
+ " throw new BuildException(\n" +
+ " MessageFormat.format(\n" +
+ " InternalAntMessages\n" +
+ " .getString(\"InternalAntRunner.Buildfile__{0}_does_not_exist_!_1\"), //$NON-NLS-1$\n" +
+ " new String[] { buildFile.getAbsolutePath() }));\n" +
+ " }\n" +
+ " if (!buildFile.isFile()) {\n" +
+ " throw new BuildException(\n" +
+ " MessageFormat.format(\n" +
+ " InternalAntMessages\n" +
+ " .getString(\"InternalAntRunner.Buildfile__{0}_is_not_a_file_1\"), //$NON-NLS-1$\n" +
+ " new String[] { buildFile.getAbsolutePath() }));\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_03() throws JavaModelException {
+ String source =
+ "public class X03 {\n" +
+ "\n" +
+ " protected void foo() {\n" +
+ " printTargets(project, subNames, null, InternalAntMessages.getString(\"InternalAntRunner.Subtargets__5\"), 0); //$NON-NLS-1$\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X03 {\n" +
+ "\n" +
+ " protected void foo() {\n" +
+ " printTargets(project, subNames, null,\n" +
+ " InternalAntMessages\n" +
+ " .getString(\"InternalAntRunner.Subtargets__5\"), 0); //$NON-NLS-1$\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_04() throws JavaModelException {
+ String source =
+ "public class X04 {\n" +
+ " void foo() {\n" +
+ " if (AntUIPlugin.getDefault().getPreferenceStore().getBoolean(IAntUIPreferenceConstants.OUTLINE_LINK_WITH_EDITOR)) {\n" +
+ " synchronizeOutlinePage(node, true);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X04 {\n" +
+ " void foo() {\n" +
+ " if (AntUIPlugin.getDefault().getPreferenceStore()\n" +
+ " .getBoolean(IAntUIPreferenceConstants.OUTLINE_LINK_WITH_EDITOR)) {\n" +
+ " synchronizeOutlinePage(node, true);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_05() throws JavaModelException {
+ String source =
+ "public class X05 {\n" +
+ "void foo() {\n" +
+ " if (false && AntUIPlugin.getDefault().getPreferenceStore().getBoolean(AntEditorPreferenceConstants.TEMPLATES_USE_CODEFORMATTER)) {\n" +
+ " }\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class X05 {\n" +
+ " void foo() {\n" +
+ " if (false && AntUIPlugin\n" +
+ " .getDefault()\n" +
+ " .getPreferenceStore()\n" +
+ " .getBoolean(\n" +
+ " AntEditorPreferenceConstants.TEMPLATES_USE_CODEFORMATTER)) {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+// TODO Improve this formatting as it let the message send argument in one line over the max width
+public void testBug059891_wksp1_06() throws JavaModelException {
+ String source =
+ "public class X06 {\n" +
+ " public void launch() {\n" +
+ " try {\n" +
+ " if ((javaProject == null) || !javaProject.exists()) {\n" +
+ " abort(PDEPlugin________.getResourceString(\"JUnitLaunchConfig_____\"), null, IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT);\n" +
+ " }\n" +
+ " } catch (CoreException e) {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X06 {\n" +
+ " public void launch() {\n" +
+ " try {\n" +
+ " if ((javaProject == null) || !javaProject.exists()) {\n" +
+ " abort(PDEPlugin________\n" +
+ " .getResourceString(\"JUnitLaunchConfig_____\"),\n" +
+ " null,\n" +
+ " IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT);\n" +
+ " }\n" +
+ " } catch (CoreException e) {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_07() throws JavaModelException {
+ String source =
+ "public class X07 {\n" +
+ " void foo() {\n" +
+ " if (true) {\n" +
+ " configureAntObject(result, element, task, task.getTaskName(), InternalCoreAntMessages.getString(\"AntCorePreferences.No_library_for_task\")); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X07 {\n" +
+ " void foo() {\n" +
+ " if (true) {\n" +
+ " configureAntObject(\n" +
+ " result,\n" +
+ " element,\n" +
+ " task,\n" +
+ " task.getTaskName(),\n" +
+ " InternalCoreAntMessages\n" +
+ " .getString(\"AntCorePreferences.No_library_for_task\")); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_08() throws JavaModelException {
+ String source =
+ "public class X08 {\n" +
+ " public void foo() {\n" +
+ " if (true) {\n" +
+ " IStatus status= new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, AntCorePlugin.ERROR_RUNNING_BUILD, MessageFormat.format(InternalCoreAntMessages.getString(\"AntRunner.Already_in_progess\"), new String[]{buildFileLocation}), null); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X08 {\n" +
+ " public void foo() {\n" +
+ " if (true) {\n" +
+ " IStatus status = new Status(\n" +
+ " IStatus.ERROR,\n" +
+ " AntCorePlugin.PI_ANTCORE,\n" +
+ " AntCorePlugin.ERROR_RUNNING_BUILD,\n" +
+ " MessageFormat.format(\n" +
+ " InternalCoreAntMessages\n" +
+ " .getString(\"AntRunner.Already_in_progess\"), new String[] { buildFileLocation }), null); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_09() throws JavaModelException {
+ String source =
+ "public class X09 {\n" +
+ " void foo() {\n" +
+ " if (true) {\n" +
+ " String secondFileName = secondDirectoryAbsolutePath + File.separator + currentFile.substring(firstDirectoryAbsolutePath.length() + 1);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X09 {\n" +
+ " void foo() {\n" +
+ " if (true) {\n" +
+ " String secondFileName = secondDirectoryAbsolutePath\n" +
+ " + File.separator\n" +
+ " + currentFile\n" +
+ " .substring(firstDirectoryAbsolutePath.length() + 1);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_10() throws JavaModelException {
+ String source =
+ "public class X10 {\n" +
+ " void foo() {\n" +
+ " if (true) {\n" +
+ " if (true) {\n" +
+ " throw new BuildException(InternalAntMessages.getString(\"InternalAntRunner.Could_not_load_the_version_information._10\")); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X10 {\n" +
+ " void foo() {\n" +
+ " if (true) {\n" +
+ " if (true) {\n" +
+ " throw new BuildException(\n" +
+ " InternalAntMessages\n" +
+ " .getString(\"InternalAntRunner.Could_not_load_the_version_information._10\")); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_11() throws JavaModelException {
+ String source =
+ "public class X11 {\n" +
+ " private void antFileNotFound() {\n" +
+ " reportError(AntLaunchConfigurationMessages.getString(\"AntLaunchShortcut.Unable\"), null); //$NON-NLS-1$ \n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X11 {\n" +
+ " private void antFileNotFound() {\n" +
+ " reportError(\n" +
+ " AntLaunchConfigurationMessages\n" +
+ " .getString(\"AntLaunchShortcut.Unable\"), null); //$NON-NLS-1$ \n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug059891_wksp1_12() throws JavaModelException {
+ String source =
+ "public class X12 {\n" +
+ " void foo() {\n" +
+ " if (this.fTests.size() == 0) {\n" +
+ " this.addTest(TestSuite\n" +
+ " .warning(\"No tests found in \" + theClass.getName())); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X12 {\n" +
+ " void foo() {\n" +
+ " if (this.fTests.size() == 0) {\n" +
+ " this.addTest(TestSuite\n" +
+ " .warning(\"No tests found in \" + theClass.getName())); //$NON-NLS-1$\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+
+/**
* @bug 198074: [formatter] the code formatter doesn't respect my new lines
* @test Ensure that the formatter keep line breaks wrapping set by users in the code
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=198074"
@@ -1114,6 +1638,39 @@ public void testBug208541() throws JavaModelException {
}
/**
+ * @bug 203588: [formatter] Qualified invocation + binary expressions excessive wrap
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=203588"
+ */
+public void testBug203588() throws JavaModelException {
+ String source =
+ "public class Test {\n" +
+ "void foo() {\n" +
+ " while (true) {\n" +
+ " if (patternChar\n" +
+ " != (isCaseSensitive\n" +
+ " ? name[iName]\n" +
+ " : Character.toLowerCase(name[iName]))\n" +
+ " && patternChar != \'?\') {\n" +
+ " return;\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class Test {\n" +
+ " void foo() {\n" +
+ " while (true) {\n" +
+ " if (patternChar != (isCaseSensitive ? name[iName] : Character\n" +
+ " .toLowerCase(name[iName])) && patternChar != \'?\') {\n" +
+ " return;\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+
+/**
* @bug 252556: [formatter] Spaces removed before formatted region of a compilation unit.
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=252556"
*/
@@ -2412,9 +2969,9 @@ public void testBug286668() throws JavaModelException {
"\n" +
" void foo() {\n" +
" StringBuilder builder = new StringBuilder();\n" +
- " builder.append(\"abc\").append(\"def\").append(\"ghi\").append(\"jkl\").append(\n" +
- " \"mno\")\n" +
- " .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" +
+ " builder.append(\"abc\").append(\"def\").append(\"ghi\").append(\"jkl\")\n" +
+ " .append(\"mno\")\n" +
+ " .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" +
" }\n" +
"}\n"
);
@@ -2486,14 +3043,15 @@ public void testBug286668_40w() throws JavaModelException {
"\n" +
" void foo() {\n" +
" StringBuilder builder = new StringBuilder();\n" +
- " builder.append(\"abc\").append(\n" +
- " \"def\").append(\"ghi\")\n" +
- " .append(\"jkl\").append(\n" +
- " \"mno\")\n" +
- " .append(\"pqr\").append(\n" +
- " \"stu\").append(\n" +
- " \"vwx\").append(\n" +
- " \"yz\");\n" +
+ " builder.append(\"abc\")\n" +
+ " .append(\"def\")\n" +
+ " .append(\"ghi\")\n" +
+ " .append(\"jkl\")\n" +
+ " .append(\"mno\")\n" +
+ " .append(\"pqr\")\n" +
+ " .append(\"stu\")\n" +
+ " .append(\"vwx\")\n" +
+ " .append(\"yz\");\n" +
" }\n" +
"}\n"
);
@@ -2516,15 +3074,15 @@ public void testBug286668b_40w() throws JavaModelException {
"\n" +
" void foo() {\n" +
" StringBuilder builder = new StringBuilder();\n" +
- " builder.append(\"abc\").append(\n" +
- " \"def\")\n" +
- " .append(\"ghi\").append(\n" +
- " \"jkl\").append(\n" +
- " \"mno\")\n" +
- " .append(\"pqr\").append(\n" +
- " \"stu\").append(\n" +
- " \"vwx\").append(\n" +
- " \"yz\");\n" +
+ " builder.append(\"abc\")\n" +
+ " .append(\"def\")\n" +
+ " .append(\"ghi\")\n" +
+ " .append(\"jkl\")\n" +
+ " .append(\"mno\")\n" +
+ " .append(\"pqr\")\n" +
+ " .append(\"stu\")\n" +
+ " .append(\"vwx\")\n" +
+ " .append(\"yz\");\n" +
" }\n" +
"}\n"
);
@@ -2548,15 +3106,15 @@ public void testBug286668c_40w() throws JavaModelException {
"\n" +
" void foo() {\n" +
" StringBuilder builder = new StringBuilder();\n" +
- " builder.append(\"abc\").append(\n" +
- " \"def\")\n" +
- " .append(\"ghi\").append(\n" +
- " \"jkl\").append(\n" +
- " \"mno\")\n" +
- " .append(\"pqr\").append(\n" +
- " \"stu\").append(\n" +
- " \"vwx\")\n" +
- " .append(\"yz\");\n" +
+ " builder.append(\"abc\")\n" +
+ " .append(\"def\")\n" +
+ " .append(\"ghi\")\n" +
+ " .append(\"jkl\")\n" +
+ " .append(\"mno\")\n" +
+ " .append(\"pqr\")\n" +
+ " .append(\"stu\")\n" +
+ " .append(\"vwx\")\n" +
+ " .append(\"yz\");\n" +
" }\n" +
"}\n"
);
@@ -4932,11 +5490,11 @@ public void testBug264112_wksp2_01() {
" if (point != null) {\n" +
" // Following message send was unnecessarily split\n" +
" sb.append(PATH_SMOOTH_QUAD_TO)\n" +
- " .append(\n" +
- " String.valueOf(midValue(point.x, point_plus1.x)))\n" +
+ " .append(String\n" +
+ " .valueOf(midValue(point.x, point_plus1.x)))\n" +
" .append(XML_SPACE)\n" +
- " .append(\n" +
- " String.valueOf(midValue(point.y, point_plus1.y)));\n" +
+ " .append(String\n" +
+ " .valueOf(midValue(point.y, point_plus1.y)));\n" +
" } else {\n" +
" break;\n" +
" }\n" +
@@ -4992,7 +5550,7 @@ public void testBug264112_wksp2_02() {
" null, // qualifier\n" +
" null, // stopKeyValue\n" +
" ScanController.GT // stopSearchOp\n" +
- " );\n" +
+ " );\n" +
" }\n" +
"\n" +
" }\n" +
@@ -5373,4 +5931,59 @@ public void testBug304529e() {
);
}
+/**
+ * @bug 309706: [formatter] doesn�t work when code has three semicolons side by side
+ * @test Verify that formatter does get puzzled by three consecutive semicolons
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=309706"
+ */
+public void testBug309706() {
+ String source =
+ "public class Test {\n" +
+ "\n" +
+ " private int id;;;\n" +
+ "\n" +
+ " private void dummy() {\n" +
+ "\n" +
+ " if (true) {\n" +
+ " System.out.println(\"bla\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class Test {\n" +
+ "\n" +
+ " private int id;;;\n" +
+ "\n" +
+ " private void dummy() {\n" +
+ "\n" +
+ " if (true) {\n" +
+ " System.out.println(\"bla\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug309706b() {
+ String source =
+ " private int id;;;\n" +
+ "\n" +
+ " private void dummy() {\n" +
+ "\n" +
+ " if (true) {\n" +
+ " System.out.println(\"bla\");\n" +
+ " }\n" +
+ " }\n";
+ formatSource(source,
+ "private int id;;;\n" +
+ "\n" +
+ "private void dummy() {\n" +
+ "\n" +
+ " if (true) {\n" +
+ " System.out.println(\"bla\");\n" +
+ " }\n" +
+ "}",
+ CodeFormatter.K_CLASS_BODY_DECLARATIONS
+ );
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
index 3e84f39ef..b052f0e11 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
@@ -21043,4 +21043,294 @@ public void testBug249704() throws JavaModelException {
"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), 27}",
requestor.getResults());
}
+
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=244820
+// To verify that autocast works correctly even when the compilation unit
+// has some compilation errors.
+public void testBug244820() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/test/CompletionAfterInstanceOf.java",
+ "package test;" +
+ "class MyString {\n" +
+ " public String toWelcome() {\n" +
+ " return \"welcome\";\n" +
+ " }\n" +
+ "}\n" +
+ "public class CompletionAfterInstanceOf {\n" +
+ " void foo() {\n" +
+ " Object chars= null;\n" +
+ " Object ch = null;\n" +
+ " String lower = null;\n" +
+ " if (ch instanceof MyString) {\n" +
+ " ch.t; \n" +
+ " }\n" +
+ " if (ch instanceof MyString) {\n" +
+ " return ch.t; \n" +
+ " }\n" +
+ " if (chars instanceof MyString) {\n" +
+ " lower = chars.to; \n" +
+ " }\n" +
+ " if (ch instanceof MyString) {\n" +
+ " String low = ch.t; \n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, true, true, true, true, true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "lower = chars.to";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE;
+ int start1 = str.lastIndexOf("to") + "".length();
+ int end1 = start1 + "to".length();
+ int start2 = str.lastIndexOf("chars.to");
+ int end2 = start2 + "chars.to".length();
+ int start3 = str.lastIndexOf("chars.");
+ int end3 = start3 + "chars".length();
+
+ assertResults(
+ "toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, null, null, toString, null, replace[" + start1 + ", " + end1 + "], token[" + start1 + ", " + end1 +"], " + relevance1 + "}\n" +
+ "toWelcome[METHOD_REF_WITH_CASTED_RECEIVER]{((MyString)chars).toWelcome(), Ltest.MyString;, ()Ljava.lang.String;, Ltest.MyString;, null, null, toWelcome, null, replace[" + start2 +", " + end2 + "], token[" + start1 + ", " + end1 + "], receiver[" + start3 + ", " + end3 + "], " + relevance1 + "}",
+ requestor.getResults());
+}
+
+
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980
+public void testBug308980a() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/test/Try.java",
+ "package test;\n" +
+ "import java.util.Arrays;\n" +
+ "public class Try {\n" +
+ " public static final AClass a1 = new JustTry(\n" +
+ " new byte[][] {\n" +
+ " {0x00,0x3C},\n" +
+ " {0x04,0x2C}}) {\n" +
+ " int justReturn (int a){\n" +
+ " return a;\n" +
+ " }\n" +
+ " };\n" +
+ " public static final AC" +
+ "}\n" +
+ "class AClass{\n" +
+ " public byte[][] field1;\n" +
+ " public AClass(byte[][] byteArray) {\n" +
+ " field1 = byteArray;\n" +
+ " }\n" +
+ "}\n" +
+ "abstract class JustTry extends AClass {\n" +
+ " public byte[][] field1;\n" +
+ " public JustTry (byte[][] byteArray){\n" +
+ " field1 = byteArray;\n" +
+ " }\n" +
+ " abstract int justReturn(int a);\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "public static final AC";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ assertResults(
+ "AClass[TYPE_REF]{AClass, test, Ltest.AClass;, null, null, 27}",
+ requestor.getResults());
+}
+
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980
+public void testBug308980b() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/test/Try.java",
+ "package test;\n" +
+ "import java.util.Arrays;\n" +
+ "public class Try {\n" +
+ " public static final test.AClass a1 = new JustTry(\n" +
+ " new byte[][] {\n" +
+ " {0x00,0x3C},\n" +
+ " {0x04,0x2C}}) {\n" +
+ " int justReturn (int a){\n" +
+ " return a;\n" +
+ " }\n" +
+ " };\n" +
+ " public static final AC" +
+ "}\n" +
+ "class AClass{\n" +
+ " public byte[][] field1;\n" +
+ " public AClass(byte[][] byteArray) {\n" +
+ " field1 = byteArray;\n" +
+ " }\n" +
+ "}\n" +
+ "abstract class JustTry extends AClass {\n" +
+ " public byte[][] field1;\n" +
+ " public JustTry (byte[][] byteArray){\n" +
+ " field1 = byteArray;\n" +
+ " }\n" +
+ " abstract int justReturn(int a);\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "public static final AC";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ assertResults(
+ "AClass[TYPE_REF]{AClass, test, Ltest.AClass;, null, null, 27}",
+ requestor.getResults());
+}
+
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=267091
+// To verify that we get interface proposals after 'implements'
+public void testBug267091a() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/test/Try.java",
+ "package test;\n" +
+ "interface In{}\n" +
+ "interface Inn{\n" +
+ " interface Inn2{}\n" +
+ "}\n" +
+ "class ABC {\n" +
+ " interface ABCInterface;\n" +
+ "}\n" +
+ "public class Try implements {\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "Try implements ";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ assertResults(
+ // without the fix no proposals obtained.
+ "Inn.Inn2[TYPE_REF]{test.Inn.Inn2, test, Ltest.Inn$Inn2;, null, null, 44}\n" +
+ "ABC.ABCInterface[TYPE_REF]{ABCInterface, test, Ltest.ABC$ABCInterface;, null, null, 47}\n" +
+ "In[TYPE_REF]{In, test, Ltest.In;, null, null, 47}\n" +
+ "Inn[TYPE_REF]{Inn, test, Ltest.Inn;, null, null, 47}",
+ requestor.getResults());
+}
+
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=267091
+// To verify that we get type proposals after 'extends'
+public void testBug267091b() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/test/Try.java",
+ "package test;\n" +
+ "class In{}\n" +
+ "class Inn{\n" +
+ " class Inn2{\n" +
+ " class Inn3{\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "class ABC extends Inn{}\n" +
+ "public class Try extends {\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "Try extends ";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ assertResults(
+ // without the fix no proposals obtained.
+ "Inn.Inn2[TYPE_REF]{test.Inn.Inn2, test, Ltest.Inn$Inn2;, null, null, 44}\n" +
+ "Inn.Inn2.Inn3[TYPE_REF]{test.Inn.Inn2.Inn3, test, Ltest.Inn$Inn2$Inn3;, null, null, 44}\n" +
+ "ABC[TYPE_REF]{ABC, test, Ltest.ABC;, null, null, 47}\n" +
+ "In[TYPE_REF]{In, test, Ltest.In;, null, null, 47}\n" +
+ "Inn[TYPE_REF]{Inn, test, Ltest.Inn;, null, null, 47}",
+ requestor.getResults());
+}
+
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534
+// To verify that autocast works correctly even when instanceof expression
+// and completion node are in the same binary expression, related by &&
+public void testBug261534a() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/test/CompletionAfterInstanceOf.java",
+ "package test;" +
+ "class MyString {\n" +
+ " public String toWelcome() {\n" +
+ " return \"welcome\";\n" +
+ " }\n" +
+ "}\n" +
+ "public class CompletionAfterInstanceOf {\n" +
+ " void foo() {\n" +
+ " Object chars= null;\n" +
+ " if (chars instanceof MyString && chars.to) {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, true, true, true, true, true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "chars instanceof MyString && chars.to";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
+ int start1 = str.lastIndexOf("to") + "".length();
+ int end1 = start1 + "to".length();
+ int start2 = str.lastIndexOf("chars.to");
+ int end2 = start2 + "chars.to".length();
+ int start3 = str.lastIndexOf("chars.");
+ int end3 = start3 + "chars".length();
+
+ assertResults(
+ "toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, null, null, toString, null, replace[" + start1 + ", " + end1 + "], token[" + start1 + ", " + end1 +"], " + relevance1 + "}\n" +
+ "toWelcome[METHOD_REF_WITH_CASTED_RECEIVER]{((MyString)chars).toWelcome(), Ltest.MyString;, ()Ljava.lang.String;, Ltest.MyString;, null, null, toWelcome, null, replace[" + start2 +", " + end2 + "], token[" + start1 + ", " + end1 + "], receiver[" + start3 + ", " + end3 + "], " + relevance1 + "}",
+ requestor.getResults());
+}
+
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534
+// Negative test - To verify that proposals from casted receiver are not obtained
+// when completion node is in an OR_OR_Expression along with an instanceof exp.
+public void testBug261534b() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/test/CompletionAfterInstanceOf.java",
+ "package test;" +
+ "class MyString {\n" +
+ " public String toWelcome() {\n" +
+ " return \"welcome\";\n" +
+ " }\n" +
+ "}\n" +
+ "public class CompletionAfterInstanceOf {\n" +
+ " void foo() {\n" +
+ " Object chars= null;\n" +
+ " if (chars instanceof MyString || chars.to) {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, true, true, true, true, true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "chars instanceof MyString || chars.to";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
+ int start1 = str.lastIndexOf("to") + "".length();
+ int end1 = start1 + "to".length();
+
+ assertResults(
+ "toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, null, null, toString, null, replace[" + start1 + ", " + end1 + "], token[" + start1 + ", " + end1 +"], " + relevance1 + "}",
+ requestor.getResults());
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java
index fb27b0444..fa9a8d437 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java
@@ -7,7 +7,8 @@ public class A {
.someQuiteLongMessageSend("aaaaaaaaaaa", "bbbbbbbbbbbbb",
"cccccccc");
Alignment expressionsAlignment = this.scribe.createAlignment(
- "expressions", Alignment.M_COMPACT_SPLIT
+ "expressions",
+ Alignment.M_COMPACT_SPLIT
+ someMessageSend(Alignment.M_COMPACT_SPLIT,
Alignment.M_COMPACT_SPLIT,
Alignment.M_COMPACT_SPLIT,
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test167/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test167/A_out.java
index bfb3fb84a..c6cb1111e 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test167/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test167/A_out.java
@@ -2,8 +2,8 @@ public class X {
X(String s) {
}
protected void foo() {
- X a = new X(new StringBuffer("this").append("is").append("a").append(
- "long").append("argument").toString()) {
+ X a = new X(new StringBuffer("this").append("is").append("a")
+ .append("long").append("argument").toString()) {
public void run() {
}
};
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test169/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test169/A_out.java
index 684f8a4bb..923d72bee 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test169/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test169/A_out.java
@@ -2,7 +2,7 @@ public class X {
X(String s) {
}
protected void foo() {
- cmd.createArgument().foo().test().error().setFile(
- destDir.getAbsoluteFile());
+ cmd.createArgument().foo().test().error()
+ .setFile(destDir.getAbsoluteFile());
}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test170/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test170/A_out.java
index c5572f035..b099e340d 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test170/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test170/A_out.java
@@ -2,7 +2,7 @@ public class X {
X(String s) {
}
protected void foo() {
- cmd.createArgument().foo().test().error().setFile(
- (Name) (destDir()).getAbsoluteFile());
+ cmd.createArgument().foo().test().error()
+ .setFile((Name) (destDir()).getAbsoluteFile());
}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test337/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test337/A_out.java
index 9b81e7714..16314c150 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test337/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test337/A_out.java
@@ -110,8 +110,8 @@ public class ConfigurationActivator implements BundleActivator {
}
private IPlatform acquirePlatform() {
if (platformTracker == null) {
- platformTracker = new ServiceTracker(context, IPlatform.class
- .getName(), null);
+ platformTracker = new ServiceTracker(context,
+ IPlatform.class.getName(), null);
platformTracker.open();
}
IPlatform result = (IPlatform) platformTracker.getService();
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test455/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test455/A_out.java
index 3cd1c8d45..f04503344 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test455/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test455/A_out.java
@@ -4,16 +4,14 @@ public class A {
try {
IJavaProject javaProject = getJavaProject(configuration);
if ((javaProject == null) || !javaProject.exists()) {
- abort(
- PDEPlugin
- .getResourceString("JUnitLaunchConfiguration.error.invalidproject"), null, IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT); //$NON-NLS-1$
+ abort(PDEPlugin
+ .getResourceString("JUnitLaunchConfiguration.error.invalidproject"), null, IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT); //$NON-NLS-1$
}
IType[] testTypes = getTestTypes(configuration, javaProject,
new SubProgressMonitor(monitor, 1));
if (testTypes.length == 0) {
- abort(
- PDEPlugin
- .getResourceString("JUnitLaunchConfiguration.error.notests"), null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_MAIN_TYPE); //$NON-NLS-1$
+ abort(PDEPlugin
+ .getResourceString("JUnitLaunchConfiguration.error.notests"), null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_MAIN_TYPE); //$NON-NLS-1$
}
monitor.worked(1);
@@ -38,8 +36,8 @@ public class A {
setDefaultSourceLocator(launch, configuration);
launch.setAttribute(PORT_ATTR, Integer.toString(port));
- launch.setAttribute(TESTTYPE_ATTR, testTypes[0]
- .getHandleIdentifier());
+ launch.setAttribute(TESTTYPE_ATTR,
+ testTypes[0].getHandleIdentifier());
PDEPlugin.getDefault().getLaunchesListener().manage(launch);
launcher.getVMRunner(mode).run(runnerConfig, launch, monitor);
monitor.worked(1);
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test484/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test484/A_out.java
index a3ad08657..d92fd63dd 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test484/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test484/A_out.java
@@ -2,9 +2,8 @@ public class A {
public void launch() {
try {
if ((javaProject == null) || !javaProject.exists()) {
- abort(
- PDEPlugin
- .getResourceString("JUnitLaunchConfiguration.error.invalidproject"), null, IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT); //$NON-NLS-1$
+ abort(PDEPlugin
+ .getResourceString("JUnitLaunchConfiguration.error.invalidproject"), null, IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT); //$NON-NLS-1$
}
} catch (CoreException e) {
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test485/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test485/A_out.java
index 49d25e566..f173fb00b 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test485/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test485/A_out.java
@@ -2,9 +2,8 @@ public class A {
public void launch() {
try {
if ((javaProject == null) || !javaProject.exists()) {
- abort(
- PDEPlugin
- .getResourceString("JUnitLaunchConfiguration.error.invalidproject"),
+ abort(PDEPlugin
+ .getResourceString("JUnitLaunchConfiguration.error.invalidproject"),
null,
IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT);
}

Back to the top