Update jdt core and tests to v_A46
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
index a5eccbd..781cdd5 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -1839,7 +1839,7 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
 	String expectedParentNodeToString = "<NONE>";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
@@ -1848,6 +1848,7 @@
 		"public class X {\n" +
 		"  Object o;\n" +
 		"  {\n" +
+		"    <CompleteOnName:zzz>;\n" +
 		"  }\n" +
 		"  public X() {\n" +
 		"  }\n" +
@@ -2063,7 +2064,7 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
 	String expectedParentNodeToString = "<NONE>";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
@@ -2072,6 +2073,7 @@
 		"public class X {\n" +
 		"  Object o;\n" +
 		"  {\n" +
+		"    <CompleteOnName:zzz>;\n" +
 		"  }\n" +
 		"  public X() {\n" +
 		"  }\n" +
@@ -4115,16 +4117,14 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 		"package p;\n" +
 		"public class X {\n" +
-		"  Object o;\n" +
-		"  {\n" +
-		"  }\n" +
+		"  Object o = new X[]{<CompleteOnName:zzz>};\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"}\n";
@@ -4150,16 +4150,13 @@
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
 	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 			"package p;\n" +
 			"public class X {\n" +
-			"  Object o;\n" +
-			"  {\n" +
-			"    <CompleteOnName:zzz>;\n" +
-			"  }\n" +
+			"  Object o = new X[]{<CompleteOnName:zzz>};\n" +			
 			"  public X() {\n" +
 			"  }\n" +
 			"}\n";
@@ -4332,16 +4329,14 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 		"package p;\n" +
 		"public class X {\n" +
-		"  Object o;\n" +
-		"  {\n" +
-		"  }\n" +
+		"  Object o = new X[]{<CompleteOnName:zzz>};\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"}\n";
@@ -4368,16 +4363,13 @@
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
 	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 			"package p;\n" +
 			"public class X {\n" +
-			"  Object o;\n" +
-			"  {\n" +
-			"    <CompleteOnName:zzz>;\n" +
-			"  }\n" +
+			"  Object o = new X[]{<CompleteOnName:zzz>};\n" +
 			"  public X() {\n" +
 			"  }\n" +
 			"}\n";
@@ -4927,16 +4919,14 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
+	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 		"package p;\n" +
 		"public class X {\n" +
-		"  int o;\n" +
-		"  {\n" +
-		"  }\n" +
+		"  int o = new int[]{<CompleteOnName:zzz>};\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"}\n";
@@ -4962,16 +4952,13 @@
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
 	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 			"package p;\n" +
 			"public class X {\n" +
-			"  int o;\n" +
-			"  {\n" +
-			"    <CompleteOnName:zzz>;\n" +
-			"  }\n" +
+			"  int o = new int[]{<CompleteOnName:zzz>};\n" +
 			"  public X() {\n" +
 			"  }\n" +
 			"}\n";
@@ -5148,16 +5135,14 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
+	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 		"package p;\n" +
 		"public class X {\n" +
-		"  int o;\n" +
-		"  {\n" +
-		"  }\n" +
+		"  int o = new int[]{<CompleteOnName:zzz>};\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"}\n";
@@ -5184,16 +5169,13 @@
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
 	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 			"package p;\n" +
 			"public class X {\n" +
-			"  int o;\n" +
-			"  {\n" +
-			"    <CompleteOnName:zzz>;\n" +
-			"  }\n" +
+			"  int o = new int[]{<CompleteOnName:zzz>};\n" +
 			"  public X() {\n" +
 			"  }\n" +
 			"}\n";
@@ -5381,16 +5363,14 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 		"package p;\n" +
 		"public class X {\n" +
-		"  X o;\n" +
-		"  {\n" +
-		"  }\n" +
+		"  X o = new X[]{<CompleteOnName:zzz>};\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"}\n";
@@ -5416,16 +5396,13 @@
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
 	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 			"package p;\n" +
 			"public class X {\n" +
-			"  X o;\n" +
-			"  {\n" +
-			"    <CompleteOnName:zzz>;\n" +
-			"  }\n" +
+			"  X o = new X[]{<CompleteOnName:zzz>};\n" +
 			"  public X() {\n" +
 			"  }\n" +
 			"}\n";
@@ -5601,16 +5578,14 @@
 	String completeBehind = "zzz";
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
-	String expectedCompletionNodeToString = "<NONE>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 		"package p;\n" +
 		"public class X {\n" +
-		"  X o;\n" +
-		"  {\n" +
-		"  }\n" +
+		"  X o = new X[]{<CompleteOnName:zzz>};\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"}\n";
@@ -5637,16 +5612,13 @@
 	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
 
 	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
-	String expectedParentNodeToString = "<NONE>";
+	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
 	String completionIdentifier = "zzz";
 	String expectedReplacedSource = "zzz";
 	String expectedUnitDisplayString =
 			"package p;\n" +
 			"public class X {\n" +
-			"  X o;\n" +
-			"  {\n" +
-			"    <CompleteOnName:zzz>;\n" +
-			"  }\n" +
+			"  X o = new X[]{<CompleteOnName:zzz>};\n" +
 			"  public X() {\n" +
 			"  }\n" +
 			"}\n";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
index 1160b9c..02b250c 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -3956,8 +3956,6 @@
 		"  class Y {\n" +
 		"    public String s;\n" +
 		"    static int y;\n" +
-		"    {\n" +
-		"    }\n" +
 		"    public int i = 0;\n" +
 		"    Y() {\n" +
 		"    }\n" +
@@ -3977,9 +3975,6 @@
 		"  class Y {\n" +
 		"    public String s;\n" +
 		"    static int y;\n" +
-		"    {\n" +
-		"      ;\n" +
-		"    }\n" +
 		"    public int i = 0;\n" +
 		"    Y() {\n" +
 		"      super();\n" +
@@ -4004,8 +3999,6 @@
 		"  class Y {\n" +
 		"    public String s;\n" +
 		"    static int y;\n" +
-		"    {\n" +
-		"    }\n" +
 		"    public int i;\n" +
 		"    Y() {\n" +
 		"    }\n" +
@@ -6394,10 +6387,6 @@
 	String expectedCompletionDietUnitToString =
 		"public class X {\n" +
 		"  static int B;\n" +
-		"  {\n" +
-		"  }\n" +
-		"  {\n" +
-		"  }\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"  <clinit>() {\n" +
@@ -6525,10 +6514,7 @@
 	String expectedCompletionDietUnitToString =
 		"public class X {\n" +
 		"  int a;\n" +
-		"  {\n" +
-		"  }\n" +
-		"  {\n" +
-		"  }\n" +
+		"  int b;\n" +
 		"  public X() {\n" +
 		"  }\n" +
 		"}\n";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
index 8e5dbac..e6a3398 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
@@ -49,7 +49,7 @@
 
 	static {
 //		TESTS_NAMES = new String[] { "test292_warn_options" };
-//		TESTS_NUMBERS = new int[] { 298 };
+//		TESTS_NUMBERS = new int[] { 12 };
 //		TESTS_RANGE = new int[] { 298, -1 };
 	}
 public BatchCompilerTest(String name) {
@@ -1559,6 +1559,12 @@
         "    -err:-<warnings separated by ,>   disable specific warnings to be\n" + 
         "                                      reported as errors\n" + 
         " \n" + 
+        " Setting warning or error options using properties file:\n" + 
+        "    -properties: <file>   set warnings/errors option based on the properties\n" + 
+        "                          file contents. This option can be used with -nowarn,\n" + 
+        "                          -err:.. or -warn:.. options, but the last one on the\n" + 
+        "                          command line sets the options to be used.\n" + 
+        " \n" + 
         " Debug options:\n" +
         "    -g[:lines,vars,source] custom debug info\n" +
         "    -g:lines,source  + both lines table and source debug info\n" +
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 678bc40..c3b07c5 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 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 @@
 }
 
 /**
+ * @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 @@
 }
 
 /**
+ * @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 @@
 		"\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 @@
 		"\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 @@
 		"\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 @@
 		"\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 @@
 		"			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 @@
 		"					null, // qualifier\n" + 
 		"					null, // stopKeyValue\n" + 
 		"					ScanController.GT // stopSearchOp\n" + 
-		"					);\n" + 
+		"			);\n" + 
 		"		}\n" + 
 		"\n" + 
 		"	}\n" + 
@@ -5373,4 +5931,59 @@
 	);
 }
 
+/**
+ * @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 3e84f39..b052f0e 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 @@
 			"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 fb27b04..fa9a8d4 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 @@
 				.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 bfb3fb8..c6cb111 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 @@
 	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 684f8a4..923d72b 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 @@
 	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 c5572f0..b099e34 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 @@
 	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 9b81e77..16314c1 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 @@
 	}
 	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 3cd1c8d..f045033 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 @@
 		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 @@
 
 			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 a3ad086..d92fd63 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 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 49d25e5..f173fb0 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 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);
 			}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index b5da9fb..04c473d 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -17,8 +17,10 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.batch;
 
+import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FilenameFilter;
@@ -43,6 +45,7 @@
 import java.util.Locale;
 import java.util.Map;
 import java.util.MissingResourceException;
+import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.StringTokenizer;
@@ -1780,6 +1783,7 @@
 	final int INSIDE_PROCESSOR_start = 18;
 	final int INSIDE_S_start = 19;
 	final int INSIDE_CLASS_NAMES = 20;
+	final int INSIDE_WARNINGS_PROPERTIES = 21;
 
 	final int DEFAULT = 0;
 	ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
@@ -2162,7 +2166,7 @@
 					continue;
 				}
 				if (currentArg.equals("-inlineJSR")) { //$NON-NLS-1$
-				    mode = DEFAULT;
+					mode = DEFAULT;
 					this.options.put(
 							CompilerOptions.OPTION_InlineJsr,
 							CompilerOptions.ENABLED);
@@ -2451,6 +2455,10 @@
 					mode = INSIDE_CLASS_NAMES;
 					continue;
 				}
+				if (currentArg.equals("-properties")) { //$NON-NLS-1$
+					mode = INSIDE_WARNINGS_PROPERTIES;
+					continue;
+				}
 				break;
 			case INSIDE_TARGET :
 				if (this.didSpecifyTarget) {
@@ -2627,6 +2635,10 @@
 				}
 				mode = DEFAULT;
 				continue;
+			case INSIDE_WARNINGS_PROPERTIES :
+				initializeWarnings(currentArg);
+				mode = DEFAULT;
+				continue;
 		}
 
 		// default is input directory, if no custom destination path exists
@@ -2803,6 +2815,37 @@
 		this.pendingErrors = null;
 	}
 }
+private void initializeWarnings(String propertiesFile) {
+	File file = new File(propertiesFile);
+	if (!file.exists()) {
+		throw new IllegalArgumentException(this.bind("configure.missingwarningspropertiesfile", propertiesFile)); //$NON-NLS-1$
+	}
+	BufferedInputStream stream = null;
+	Properties properties = null;
+	try {
+		stream = new BufferedInputStream(new FileInputStream(propertiesFile));
+		properties = new Properties();
+		properties.load(stream);
+	} catch(IOException e) {
+		e.printStackTrace();
+		throw new IllegalArgumentException(this.bind("configure.ioexceptionwarningspropertiesfile", propertiesFile)); //$NON-NLS-1$
+	} finally {
+		if (stream != null) {
+			try {
+				stream.close();
+			} catch(IOException e) {
+				// ignore
+			}
+		}
+	}
+	for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext(); ) {
+		Map.Entry entry = (Map.Entry) iterator.next();
+		final String key = (String) entry.getKey();
+		if (key.startsWith("org.eclipse.jdt.core.compiler.problem")) { //$NON-NLS-1$
+			this.options.put(key, entry.getValue());
+		}
+	}
+}
 protected void disableWarnings() {
 	Object[] entries = this.options.entrySet().toArray();
 	for (int i = 0, max = entries.length; i < max; i++) {
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 3f81fe1..a248cb8 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -1,19 +1,3 @@
-###############################################################################
-# Copyright (c) 2000, 2010 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
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-#     IBM Corporation - initial API and implementation
-#		Benjamin Muskalla - Contribution for bug 239066
-#     Fraunhofer FIRST - extended API and implementation
-#     Technical University Berlin - extended API and implementation
-###############################################################################
-### JavaBatchCompiler messages.
-
-### compiler
 #Format: compiler.name = word1 word2 word3
 compiler.name = Eclipse Compiler for Java(TM)
 #Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)]
@@ -102,6 +86,8 @@
 configure.incompatibleComplianceForCldcTarget=Target level ''{0}'' is incompatible with compliance level ''{1}''. A compliance level ''1.4''or lower is required
 configure.invalidClasspathSection = invalid Class-Path header in manifest of jar file: {0}
 configure.multipleClasspathSections = multiple Class-Path headers in manifest of jar file: {0}
+configure.missingwarningspropertiesfile=properties file {0} does not exist
+configure.ioexceptionwarningspropertiesfile=An IOException occurred while reading the properties file {0}
 
 ### requestor
 requestor.error = {0}. ERROR in {1}
@@ -192,6 +178,12 @@
 \    -err:-<warnings separated by ,>   disable specific warnings to be\n\
 \                                      reported as errors\n\
 \ \n\
+\ Setting warning or error options using properties file:\n\
+\    -properties: <file>   set warnings/errors option based on the properties\n\
+\                          file contents. This option can be used with -nowarn,\n\
+\                          -err:.. or -warn:.. options, but the last one on the\n\
+\                          command line sets the options to be used.\n\
+\ \n\
 \ Debug options:\n\
 \    -g[:lines,vars,source] custom debug info\n\
 \    -g:lines,source  + both lines table and source debug info\n\
diff --git a/org.eclipse.jdt.core/build.properties b/org.eclipse.jdt.core/build.properties
index db0307d..299ac59 100644
--- a/org.eclipse.jdt.core/build.properties
+++ b/org.eclipse.jdt.core/build.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
+# Copyright (c) 2000, 2010 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
@@ -40,3 +40,4 @@
 jars.extra.classpath=platform:/plugin/org.apache.ant/lib/ant.jar
 src.includes = about.html,\
                schema/
+generateSourceReferences=true
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 7e1e4d6..199d305 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -40,11 +40,42 @@
 	</td>
   </tr>
 </table>
+<a name="v_A46"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.6M7 - April 23, 2010 - 3.6.0 M7
+<br>Project org.eclipse.jdt.core v_A46
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A46">cvs</a>).
+<h2>What's new in this drop</h2>
+
+<h3>Problem Reports Fixed</h3>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=59891">59891</a>
+[formatter] improve lines wrapping in nested method calls
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306172">306172</a>
+[perfs] Invalid test duration for FullSourceWorkspaceTypeHierarchyTests#testPerSuperTypes()
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267091">267091</a>
+[content assist] After 'implements' interface members are not proposed
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534">261534</a>
+content assist after instanceof should also work after &amp;&amp;
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980">308980</a>
+[content assist]An initializer inside a non-array field declaration confuses content assist
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310002">310002</a>
+ToolFactory.createScanner(..) should use workspace compliance
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291528">291528</a>
+Synchronize project warning/error settings to build.properties
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309787">309787</a>
+Extension point &quot;org.eclipse.jdt.core.codeFormatter&quot; is ignored
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=244820">244820</a>
+Content assist after 'instanceof' should also work in assignment
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309706">309706</a>
+[formatter] doesn't work when code has three semicolons side by side
+
 <a name="v_A45"></a>
 <hr><h1>
 Eclipse Platform Build Notes<br>
 Java development tools core</h1>
-Eclipse SDK 3.6M7 - April 20, 2010 - 3.6.0 M7
+Eclipse SDK 3.6M7 - April 20, 2010
 <br>Project org.eclipse.jdt.core v_A45
 (<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A45">cvs</a>).
 <h2>What's new in this drop</h2>
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index 70c88bd..926a3f5 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -10493,7 +10493,7 @@
 		ObjectVector typesFound) {
 
 		ReferenceBinding currentType = receiverType;
-		if (typeName == null || typeName.length == 0)
+		if (typeName == null)
 			return;
 
 		if (this.assistNodeIsSuperType && !this.insideQualifiedReference && isForbidden(currentType)) return; // we're trying to find a supertype
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
index 12d450b..e0978d9 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
@@ -94,10 +94,13 @@
 	protected static final int K_CONTROL_STATEMENT_DELIMITER = COMPLETION_PARSER + 38;
 	protected static final int K_INSIDE_ASSERT_EXCEPTION = COMPLETION_PARSER + 39;
 	protected static final int K_INSIDE_FOR_CONDITIONAL = COMPLETION_PARSER + 40;
+	// added for https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534
+	protected static final int K_BETWEEN_INSTANCEOF_AND_RPAREN = COMPLETION_PARSER + 41;
+
 //{ObjectTeams: OT specific kinds
-	protected static final int K_BETWEEN_WITH_AND_RIGHT_PAREN = COMPLETION_PARSER + 41;
-	protected static final int K_BETWEEN_WITHIN_AND_RIGHT_PAREN = COMPLETION_PARSER + 42;
-	protected static final int K_EXPECTING_RIGHT_METHODSPEC = COMPLETION_PARSER + 43;
+	protected static final int K_BETWEEN_WITH_AND_RIGHT_PAREN = COMPLETION_PARSER + 42;
+	protected static final int K_BETWEEN_WITHIN_AND_RIGHT_PAREN = COMPLETION_PARSER + 43;
+	protected static final int K_EXPECTING_RIGHT_METHODSPEC = COMPLETION_PARSER + 44;
 //gbr+SH}
 
 	public final static char[] FAKE_TYPE_NAME = new char[]{' '};
@@ -594,9 +597,12 @@
 			if(expression == this.assistNode
 				|| (expression instanceof Assignment	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=287939
 					&& ((Assignment)expression).expression == this.assistNode
-					&& (this.expressionPtr > 0 && this.expressionStack[this.expressionPtr - 1] instanceof InstanceOfExpression))
+					&& ((this.expressionPtr > 0 && this.expressionStack[this.expressionPtr - 1] instanceof InstanceOfExpression)
+						|| (this.elementPtr >= 0 && this.elementObjectInfoStack[this.elementPtr] instanceof InstanceOfExpression)))
 				|| (expression instanceof AllocationExpression
-					&& ((AllocationExpression)expression).type == this.assistNode)){
+					&& ((AllocationExpression)expression).type == this.assistNode)
+				|| (expression instanceof AND_AND_Expression
+						&& (this.elementPtr >= 0 && this.elementObjectInfoStack[this.elementPtr] instanceof InstanceOfExpression))){
 				buildMoreCompletionContext(expression);
 				if (this.assistNodeParent == null
 					&& expression instanceof Assignment) {
@@ -1103,8 +1109,16 @@
 
 	int blockIndex = lastIndexOfElement(K_BLOCK_DELIMITER);
 	int controlIndex = lastIndexOfElement(K_CONTROL_STATEMENT_DELIMITER);
-	int index = blockIndex != -1 && controlIndex < blockIndex ? blockIndex : controlIndex;
-
+	int index;
+	if (controlIndex != -1) {
+		index = blockIndex != -1 && controlIndex < blockIndex ? blockIndex : controlIndex;
+	} else {
+		// To handle the case when the completion is requested before enclosing R_PAREN
+		// and an instanceof expression is also present
+		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534
+		int instanceOfIndex = lastIndexOfElement(K_BETWEEN_INSTANCEOF_AND_RPAREN);
+		index = blockIndex != -1 && instanceOfIndex < blockIndex ? blockIndex : instanceOfIndex;
+	}
 	if (index != -1 && this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] != null) {
 		Expression condition = (Expression)this.elementObjectInfoStack[index];
 
@@ -1125,18 +1139,20 @@
 
 				this.currentElement = recoveredBlock;
 
+			}
 		}
+		if (statement instanceof AND_AND_Expression && this.assistNode instanceof Statement) {
+			statement = (Statement) this.assistNode;
 		}
-
-			IfStatement ifStatement =
-				new IfStatement(
+		IfStatement ifStatement =
+			new IfStatement(
 					condition,
 					statement,
 					condition.sourceStart,
 					statement.sourceEnd);
-			this.enclosingNode = ifStatement;
-			return ifStatement;
-		}
+		this.enclosingNode = ifStatement;
+		return ifStatement;
+	}
 
 	return statement;
 }
@@ -2927,6 +2943,10 @@
 protected void consumeInstanceOfExpression() {
 	super.consumeInstanceOfExpression();
 	popElement(K_BINARY_OPERATOR);
+	// to handle https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534
+	if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_IF_AND_RIGHT_PAREN) {
+		pushOnElementStack(K_BETWEEN_INSTANCEOF_AND_RPAREN, IF, this.expressionStack[this.expressionPtr]);
+	}
 
 	InstanceOfExpression exp = (InstanceOfExpression) this.expressionStack[this.expressionPtr];
 	if(this.assistNode != null && exp.type == this.assistNode) {
@@ -3808,6 +3828,9 @@
 					case K_BETWEEN_CATCH_AND_RIGHT_PAREN :
 						popElement(K_BETWEEN_CATCH_AND_RIGHT_PAREN);
 						break;
+					case K_BETWEEN_INSTANCEOF_AND_RPAREN :
+						popElement(K_BETWEEN_INSTANCEOF_AND_RPAREN);
+						//$FALL-THROUGH$
 					case K_BETWEEN_IF_AND_RIGHT_PAREN :
 						if(topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) == this.bracketDepth) {
 							popElement(K_BETWEEN_IF_AND_RIGHT_PAREN);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
index f954355..ca1b422 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -648,6 +648,9 @@
 			}
 		}
 	}
+	if (missingTypes == null) {
+		System.err.println("Could not find missing types in " + this); //$NON-NLS-1$
+	}
 	return missingTypes;
 }
 
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java
index 399f796..5c13af0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java
@@ -16,11 +16,11 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
 import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.Annotation;
 import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
 import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.ASTNode;
 import org.eclipse.jdt.internal.compiler.ast.Expression;
 import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.Statement;
@@ -247,7 +247,8 @@
 				updateSourceEndIfNecessary(braceEnd - 1);
 				return this.parent;
 			} else {
-				this.alreadyCompletedFieldInitialization = true;
+				if (this.fieldDeclaration.declarationSourceEnd > 0)
+					this.alreadyCompletedFieldInitialization = true;
 			}
 		}
 		return this;
@@ -265,11 +266,18 @@
  * in which case the bodyStart is updated.
  */
 public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){
-	if (this.fieldDeclaration.declarationSourceEnd == 0
-		&& (this.fieldDeclaration.type instanceof ArrayTypeReference || this.fieldDeclaration.type instanceof ArrayQualifiedTypeReference)
-		&& !this.alreadyCompletedFieldInitialization){
-		this.bracketBalance++;
-		return null; // no update is necessary	(array initializer)
+	if (this.fieldDeclaration.declarationSourceEnd == 0) {
+		if (this.fieldDeclaration.type instanceof ArrayTypeReference || this.fieldDeclaration.type instanceof ArrayQualifiedTypeReference) {
+			if (!this.alreadyCompletedFieldInitialization) {
+				this.bracketBalance++;
+				return null; // no update is necessary	(array initializer)
+			}
+		} else {  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980
+			// in case an initializer bracket is opened in a non-array field
+			// eg. int field = {..
+			this.bracketBalance++;
+			return null; // no update is necessary	(array initializer)
+		}
 	}
 	if (this.fieldDeclaration.declarationSourceEnd == 0
 		&& this.fieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT){
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java
index 0c64e70..a3b14d8 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java
@@ -497,7 +497,12 @@
 
 		if ((builder.realFragmentsSize() > 1 || fragmentsSize > 4) && numberOfParens == 0) {
 			this.scribe.printComment();
-			Alignment binaryExpressionAlignment = this.scribe.createAlignment("binaryExpressionAlignment", this.preferences.alignment_for_binary_expression, Alignment.R_OUTERMOST, fragmentsSize, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+			Alignment binaryExpressionAlignment = this.scribe.createAlignment(
+					Alignment.BINARY_EXPRESSION,
+					this.preferences.alignment_for_binary_expression,
+					Alignment.R_OUTERMOST,
+					fragmentsSize,
+					this.scribe.scanner.currentPosition);
 			this.scribe.enterAlignment(binaryExpressionAlignment);
 			boolean ok = false;
 			ASTNode[] fragments = builder.fragments();
@@ -699,7 +704,12 @@
 			if (this.preferences.insert_space_after_assignment_operator) {
 				this.scribe.space();
 			}
-			Alignment assignmentAlignment = this.scribe.createAlignment("fieldDeclarationAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_INNERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+			Alignment assignmentAlignment = this.scribe.createAlignment(
+					Alignment.FIELD_DECLARATION_ASSIGNMENT,
+					this.preferences.alignment_for_assignment,
+					Alignment.R_INNERMOST,
+					1,
+					this.scribe.scanner.currentPosition);
 			this.scribe.enterAlignment(assignmentAlignment);
 			boolean ok = false;
 			do {
@@ -790,7 +800,7 @@
 		final int multipleFieldDeclarationsLength = multiFieldDeclaration.declarations.length;
 
 		Alignment multiFieldDeclarationsAlignment =this.scribe.createAlignment(
-				"multiple_field",//$NON-NLS-1$
+				Alignment.MULTIPLE_FIELD,
 				this.preferences.alignment_for_multiple_fields,
 				multipleFieldDeclarationsLength - 1,
 				this.scribe.scanner.currentPosition);
@@ -1100,7 +1110,7 @@
 		final TypeReference superclass = typeDeclaration.superclass;
 		if (superclass != null) {
 			Alignment superclassAlignment =this.scribe.createAlignment(
-					"superclass", //$NON-NLS-1$
+					Alignment.SUPER_CLASS,
 					this.preferences.alignment_for_superclass_in_type_declaration,
 					2,
 					this.scribe.scanner.currentPosition);
@@ -1138,7 +1148,7 @@
 			}
 			int superInterfaceLength = superInterfaces.length;
 			Alignment interfaceAlignment =this.scribe.createAlignment(
-					"superInterfaces",//$NON-NLS-1$
+					Alignment.SUPER_INTERFACES,
 					alignment_for_superinterfaces,
 					superInterfaceLength+1,  // implements token is first fragment
 					this.scribe.scanner.currentPosition);
@@ -1246,7 +1256,7 @@
 				hasConstants = enumConstantsLength != 0;
 				if (enumConstantsLength > 1) {
 					Alignment enumConstantsAlignment = this.scribe.createAlignment(
-							"enumConstants",//$NON-NLS-1$
+							Alignment.ENUM_CONSTANTS,
 							this.preferences.alignment_for_enum_constants,
 							enumConstantsLength,
 							this.scribe.scanner.currentPosition,
@@ -1477,7 +1487,7 @@
 				}
 				int argumentLength = arguments.length;
 				Alignment argumentsAlignment = this.scribe.createAlignment(
-						"messageArguments", //$NON-NLS-1$
+						Alignment.MESSAGE_ARGUMENTS,
 						this.preferences.alignment_for_arguments_in_method_invocation,
 						Alignment.R_OUTERMOST,
 						argumentLength,
@@ -1512,17 +1522,18 @@
 			}
 			startingPositionInCascade = 2;
 		}
+		int tieBreakRule = size-startingPositionInCascade > 2 ? Alignment.R_OUTERMOST : Alignment.R_INNERMOST;
 		Alignment cascadingMessageSendAlignment =
 			this.scribe.createAlignment(
-				"cascadingMessageSendAlignment", //$NON-NLS-1$
+				Alignment.CASCADING_MESSAGE_SEND,
 				this.preferences.alignment_for_selector_in_method_invocation,
-				Alignment.R_INNERMOST,
+				tieBreakRule,
 				size,
 				this.scribe.scanner.currentPosition);
 		this.scribe.enterAlignment(cascadingMessageSendAlignment);
 		boolean ok = false;
-		boolean setStartingColumn = startingPositionInCascade == 1;
-		switch (this.preferences.alignment_for_arguments_in_method_invocation) {
+		boolean setStartingColumn = true;
+		switch (this.preferences.alignment_for_arguments_in_method_invocation & Alignment.SPLIT_MASK) {
 			case Alignment.M_COMPACT_FIRST_BREAK_SPLIT:
 			case Alignment.M_NEXT_SHIFTED_SPLIT:
 			case Alignment.M_ONE_PER_LINE_SPLIT:
@@ -1572,15 +1583,22 @@
 							this.scribe.space();
 						}
 						int argumentLength = arguments.length;
+						int alignmentMode = this.preferences.alignment_for_arguments_in_method_invocation;
 						Alignment argumentsAlignment = this.scribe.createAlignment(
-								"messageArguments", //$NON-NLS-1$
-								this.preferences.alignment_for_arguments_in_method_invocation,
+								Alignment.MESSAGE_ARGUMENTS,
+								alignmentMode,
 								Alignment.R_OUTERMOST,
 								argumentLength,
 								this.scribe.scanner.currentPosition);
 						this.scribe.enterAlignment(argumentsAlignment);
 						boolean okForArguments = false;
 						do {
+							switch (alignmentMode & Alignment.SPLIT_MASK) {
+								case Alignment.M_COMPACT_SPLIT:
+								case Alignment.M_NEXT_PER_LINE_SPLIT:
+									argumentsAlignment.startingColumn = this.scribe.column;
+									break;
+							}
 							try {
 								for (int j = 0; j < argumentLength; j++) {
 									if (j > 0) {
@@ -1588,10 +1606,16 @@
 										this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
 									}
 									this.scribe.alignFragment(argumentsAlignment, j);
-									if (j > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) {
+									if (j == 0) {
+										int fragmentIndentation = argumentsAlignment.fragmentIndentations[j];
+										if ((argumentsAlignment.mode & Alignment.M_INDENT_ON_COLUMN) != 0 && fragmentIndentation > 0) {
+											this.scribe.indentationLevel = fragmentIndentation;
+										}	
+									} else if (this.preferences.insert_space_after_comma_in_method_invocation_arguments) {
 										this.scribe.space();
 									}
 									arguments[j].traverse(this, scope);
+									argumentsAlignment.startingColumn = -1;
 								}
 								okForArguments = true;
 							} catch (AlignmentException e) {
@@ -1627,7 +1651,11 @@
 		final int FIELD = 1, METHOD = 2, TYPE = 3;
 		this.scribe.lastNumberOfNewLines = 1;
 		ASTNode[] mergedNodes = computeMergedMemberDeclarations(nodes);
-		Alignment memberAlignment = this.scribe.createMemberAlignment("typeMembers", this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT, 4, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+		Alignment memberAlignment = this.scribe.createMemberAlignment(
+				Alignment.TYPE_MEMBERS,
+				this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT,
+				4,
+				this.scribe.scanner.currentPosition);
 		this.scribe.enterMemberAlignment(memberAlignment);
 		boolean isChunkStart = false;
 		boolean ok = false;
@@ -1670,7 +1698,7 @@
 						isChunkStart = memberAlignment.checkChunkStart(TYPE, i, this.scribe.scanner.currentPosition);
 						format((TypeDeclaration)member, null, isChunkStart, i == 0);
 					}
-					if (isNextToken(TerminalTokens.TokenNameSEMICOLON)) {
+					while (isNextToken(TerminalTokens.TokenNameSEMICOLON)) {
 						this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
 						this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
 					}
@@ -1777,7 +1805,12 @@
 			if (this.preferences.insert_space_after_assignment_operator) {
 				this.scribe.space();
 			}
-			Alignment assignmentAlignment = this.scribe.createAlignment("localDeclarationAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+			Alignment assignmentAlignment = this.scribe.createAlignment(
+					Alignment.LOCAL_DECLARATION_ASSIGNMENT,
+					this.preferences.alignment_for_assignment,
+					Alignment.R_OUTERMOST,
+					1,
+					this.scribe.scanner.currentPosition);
 			this.scribe.enterAlignment(assignmentAlignment);
 			boolean ok = false;
 			do {
@@ -1807,9 +1840,10 @@
 		Alignment messageAlignment) {
 
 		if (messageAlignment != null) {
-			this.scribe.alignFragment(messageAlignment, 0);
+			if (messageAlignment.canAlign()) {
+				this.scribe.alignFragment(messageAlignment, 0);
+			}
 			this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
-			messageAlignment.startingColumn = -1;
 		}
 		TypeReference[] typeArguments = messageSend.typeArguments;
 		if (typeArguments != null) {
@@ -1843,14 +1877,21 @@
 			}
 			int argumentsLength = arguments.length;
 			if (argumentsLength > 1) {
+				int alignmentMode = this.preferences.alignment_for_arguments_in_method_invocation;
 				Alignment argumentsAlignment = this.scribe.createAlignment(
-						"messageArguments", //$NON-NLS-1$
-						this.preferences.alignment_for_arguments_in_method_invocation,
+						Alignment.MESSAGE_ARGUMENTS,
+						alignmentMode,
 						argumentsLength,
 						this.scribe.scanner.currentPosition);
 				this.scribe.enterAlignment(argumentsAlignment);
 				boolean ok = false;
 				do {
+					switch (alignmentMode & Alignment.SPLIT_MASK) {
+						case Alignment.M_COMPACT_SPLIT:
+						case Alignment.M_NEXT_PER_LINE_SPLIT:
+							argumentsAlignment.startingColumn = this.scribe.column;
+							break;
+					}
 					try {
 						for (int i = 0; i < argumentsLength; i++) {
 							if (i > 0) {
@@ -1861,7 +1902,18 @@
 							if (i > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) {
 								this.scribe.space();
 							}
+							int fragmentIndentation = 0;
+							if (i == 0) {
+								int wrappedIndex = argumentsAlignment.wrappedIndex();
+								if (wrappedIndex >= 0) {
+									fragmentIndentation = argumentsAlignment.fragmentIndentations[wrappedIndex];
+									if ((argumentsAlignment.mode & Alignment.M_INDENT_ON_COLUMN) != 0 && fragmentIndentation > 0) {
+										this.scribe.indentationLevel = fragmentIndentation;
+									}
+								}
+							}
 							arguments[i].traverse(this, scope);
+							argumentsAlignment.startingColumn = -1;
 						}
 						ok = true;
 					} catch (AlignmentException e) {
@@ -1870,16 +1922,7 @@
 				} while (!ok);
 				this.scribe.exitAlignment(argumentsAlignment, true);
 			} else {
-				for (int i = 0; i < argumentsLength; i++) {
-					if (i > 0) {
-						this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_method_invocation_arguments);
-						this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
-					}
-					if (i > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) {
-						this.scribe.space();
-					}
-					arguments[i].traverse(this, scope);
-				}
+				arguments[0].traverse(this, scope);
 			}
 			this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_method_invocation);
 		} else {
@@ -1911,13 +1954,19 @@
 			}
 			int argumentLength = arguments.length;
 			Alignment argumentsAlignment = this.scribe.createAlignment(
-					"methodArguments",//$NON-NLS-1$
+					Alignment.METHOD_ARGUMENTS,
 					methodDeclarationParametersAlignment,
 					argumentLength,
 					this.scribe.scanner.currentPosition);
 			this.scribe.enterAlignment(argumentsAlignment);
 			boolean ok = false;
 			do {
+				switch (methodDeclarationParametersAlignment & Alignment.SPLIT_MASK) {
+					case Alignment.M_COMPACT_SPLIT:
+					case Alignment.M_NEXT_PER_LINE_SPLIT:
+						argumentsAlignment.startingColumn = this.scribe.column;
+						break;
+				}
 				try {
 					for (int i = 0; i < argumentLength; i++) {
 						if (i > 0) {
@@ -1925,10 +1974,16 @@
 							this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
 						}
 						this.scribe.alignFragment(argumentsAlignment, i);
-						if (i > 0 && spaceAfterComma) {
+						if (i == 0) {
+							int fragmentIndentation = argumentsAlignment.fragmentIndentations[0];
+							if ((argumentsAlignment.mode & Alignment.M_INDENT_ON_COLUMN) != 0 && fragmentIndentation > 0) {
+								this.scribe.indentationLevel = fragmentIndentation;
+							}
+						} else if (spaceAfterComma) {
 							this.scribe.space();
 						}
 						arguments[i].traverse(this, methodDeclaration.scope);
+						argumentsAlignment.startingColumn = -1;
 					}
 					ok = true;
 				} catch (AlignmentException e) {
@@ -1962,7 +2017,7 @@
 		if (arguments != null) {
 			int argumentLength = arguments.length;
 			Alignment argumentsAlignment = this.scribe.createAlignment(
-					"enumConstantArguments",//$NON-NLS-1$
+					Alignment.ENUM_CONSTANTS_ARGUMENTS,
 					methodDeclarationParametersAlignment,
 					argumentLength,
 					this.scribe.scanner.currentPosition);
@@ -2100,7 +2155,7 @@
 		if (thrownExceptions != null) {
 			int thrownExceptionsLength = thrownExceptions.length;
 			Alignment throwsAlignment = this.scribe.createAlignment(
-					"throws",//$NON-NLS-1$
+					Alignment.THROWS,
 					alignmentForThrowsClause,
 					thrownExceptionsLength, // throws is the first token
 					this.scribe.scanner.currentPosition);
@@ -2138,7 +2193,11 @@
 	 * Merged traversal of member (types, fields, methods)
 	 */
 	private void formatTypeMembers(TypeDeclaration typeDeclaration) {
-		Alignment memberAlignment = this.scribe.createMemberAlignment("typeMembers", this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT, 3, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+		Alignment memberAlignment = this.scribe.createMemberAlignment(
+				Alignment.TYPE_MEMBERS,
+				this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT,
+				3,
+				this.scribe.scanner.currentPosition);
 		this.scribe.enterMemberAlignment(memberAlignment);
 		ASTNode[] members = computeMergedMemberDeclarations(typeDeclaration);
 		boolean isChunkStart = false;
@@ -2197,7 +2256,7 @@
 							isChunkStart = memberAlignment.checkChunkStart(Alignment.CHUNK_TYPE, i, this.scribe.scanner.currentPosition);
 							format((TypeDeclaration)member, typeDeclaration.scope, isChunkStart, i == 0);
 						}
-						if (isNextToken(TerminalTokens.TokenNameSEMICOLON)) {
+						while (isNextToken(TerminalTokens.TokenNameSEMICOLON)) {
 							this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
 							this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
 						}
@@ -2505,7 +2564,7 @@
 			}
 			int argumentLength = arguments.length;
 			Alignment argumentsAlignment =this.scribe.createAlignment(
-					"allocation",//$NON-NLS-1$
+					Alignment.ALLOCATION,
 					this.preferences.alignment_for_arguments_in_allocation_expression,
 					argumentLength,
 					this.scribe.scanner.currentPosition);
@@ -2706,7 +2765,7 @@
 					this.scribe.printNewLine();
 				}
 				Alignment arrayInitializerAlignment =this.scribe.createAlignment(
-						"array_initializer",//$NON-NLS-1$
+						Alignment.ARRAY_INITIALIZER,
 						this.preferences.alignment_for_expressions_in_array_initializer,
 						Alignment.R_OUTERMOST,
 						expressionsLength,
@@ -2979,7 +3038,12 @@
 			this.scribe.space();
 		}
 
-		Alignment assignmentAlignment = this.scribe.createAlignment("assignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+		Alignment assignmentAlignment = this.scribe.createAlignment(
+				Alignment.ASSIGNMENT,
+				this.preferences.alignment_for_assignment,
+				Alignment.R_OUTERMOST,
+				1,
+				this.scribe.scanner.currentPosition);
 		this.scribe.enterAlignment(assignmentAlignment);
 		boolean ok = false;
 		do {
@@ -3304,7 +3368,12 @@
 		if (this.preferences.insert_space_after_assignment_operator) {
 			this.scribe.space();
 		}
-		Alignment assignmentAlignment = this.scribe.createAlignment("compoundAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+		Alignment assignmentAlignment = this.scribe.createAlignment(
+				Alignment.COMPOUND_ASSIGNMENT,
+				this.preferences.alignment_for_assignment,
+				Alignment.R_OUTERMOST,
+				1,
+				this.scribe.scanner.currentPosition);
 		this.scribe.enterAlignment(assignmentAlignment);
 		boolean ok = false;
 		do {
@@ -3338,7 +3407,7 @@
     	conditionalExpression.condition.traverse(this, scope);
 
     	Alignment conditionalExpressionAlignment =this.scribe.createAlignment(
-    			"conditionalExpression", //$NON-NLS-1$
+    			Alignment.CONDITIONAL_EXPRESSION,
     			this.preferences.alignment_for_conditional_expression,
     			2,
     			this.scribe.scanner.currentPosition);
@@ -3743,7 +3812,7 @@
 			}
 			int argumentLength = arguments.length;
 			Alignment argumentsAlignment =this.scribe.createAlignment(
-					"explicit_constructor_call",//$NON-NLS-1$
+					Alignment.EXPLICIT_CONSTRUCTOR_CALL,
 					this.preferences.alignment_for_arguments_in_explicit_constructor_call,
 					argumentLength,
 					this.scribe.scanner.currentPosition);
@@ -4002,7 +4071,7 @@
 				}
 			} else if (elseStatement == null && this.preferences.keep_simple_if_on_one_line) {
 				Alignment compactIfAlignment = this.scribe.createAlignment(
-						"compactIf", //$NON-NLS-1$
+						Alignment.COMPACT_IF,
 						this.preferences.alignment_for_compact_if,
 						Alignment.R_OUTERMOST,
 						1,
@@ -4240,14 +4309,14 @@
 				messageSend.receiver.traverse(this, scope);
 				int alignmentMode = this.preferences.alignment_for_selector_in_method_invocation;
 				messageAlignment = this.scribe.createAlignment(
-						"messageAlignment", //$NON-NLS-1$
+						Alignment.MESSAGE_SEND,
 						alignmentMode,
 						1,
 						this.scribe.scanner.currentPosition);
 				this.scribe.enterAlignment(messageAlignment);
 				boolean ok = false;
 				do {
-					switch (alignmentMode) {
+					switch (alignmentMode & Alignment.SPLIT_MASK) {
 						case Alignment.M_COMPACT_SPLIT:
 						case Alignment.M_NEXT_PER_LINE_SPLIT:
 							messageAlignment.startingColumn = this.scribe.column;
@@ -4310,7 +4379,7 @@
 
 		// Create alignment
 		Alignment methodDeclAlignment = this.scribe.createAlignment(
-				"methodDeclaration",//$NON-NLS-1$
+				Alignment.METHOD_DECLARATION,
 				this.preferences.alignment_for_method_declaration,
 				Alignment.R_INNERMOST,
 				3,
@@ -4465,7 +4534,7 @@
 		if (memberValuePairs != null) {
 			int length = memberValuePairs.length;
 			Alignment annotationAlignment = this.scribe.createAlignment(
-					"annotationMemberValuePairs",//$NON-NLS-1$
+					Alignment.ANNOTATION_MEMBERS_VALUE_PAIRS,
 					this.preferences.alignment_for_arguments_in_annotation,
 					length,
 					this.scribe.scanner.currentPosition);
@@ -4813,7 +4882,7 @@
 			}
 			int argumentLength = arguments.length;
 			Alignment argumentsAlignment =this.scribe.createAlignment(
-					"allocation",//$NON-NLS-1$
+					Alignment.ALLOCATION,
 					this.preferences.alignment_for_arguments_in_qualified_allocation_expression,
 					argumentLength,
 					this.scribe.scanner.currentPosition);
@@ -5072,7 +5141,12 @@
 		this.scribe.printComment();
 		ASTNode[] fragments = stringLiteral.literals;
 		int fragmentsSize = stringLiteral.counter;
-		Alignment binaryExpressionAlignment = this.scribe.createAlignment("binaryExpressionAlignment", this.preferences.alignment_for_binary_expression, Alignment.R_OUTERMOST, fragmentsSize, this.scribe.scanner.currentPosition); //$NON-NLS-1$
+		Alignment binaryExpressionAlignment = this.scribe.createAlignment(
+				Alignment.BINARY_EXPRESSION,
+				this.preferences.alignment_for_binary_expression,
+				Alignment.R_OUTERMOST,
+				fragmentsSize,
+				this.scribe.scanner.currentPosition);
 		this.scribe.enterAlignment(binaryExpressionAlignment);
 		boolean ok = false;
 		do {
@@ -5915,7 +5989,7 @@
 		if (arguments != null) {
 			int argumentLength = arguments.length;
 			Alignment argumentsAlignment = this.scribe.createAlignment(
-					"methodSpecArguments",//$NON-NLS-1$
+					Alignment.METHOD_ARGUMENTS,
 					methodDeclarationParametersAlignment,
 					argumentLength,
 					this.scribe.scanner.currentPosition);
@@ -5964,7 +6038,7 @@
 		
 		int methodSpecLength = methodSpecs.length;
 		Alignment argumentsAlignment = this.scribe.createAlignment(
-				"methodSpecs",//$NON-NLS-1$
+				Alignment.THROWS, // FIXME(SH): do we need a new Alignment kind?
 				methodDeclarationParametersAlignment,
 				methodSpecLength,
 				this.scribe.scanner.currentPosition);
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java
index 752adda..c6bb885 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java
@@ -604,24 +604,24 @@
 	    return INVALID_TOKEN;
     }
 
-	public Alignment createAlignment(String name, int mode, int count, int sourceRestart){
-		return createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart);
+	public Alignment createAlignment(int kind, int mode, int count, int sourceRestart){
+		return createAlignment(kind, mode, Alignment.R_INNERMOST, count, sourceRestart);
 	}
 
-	public Alignment createAlignment(String name, int mode, int count, int sourceRestart, boolean adjust){
-		return createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart, adjust);
+	public Alignment createAlignment(int kind, int mode, int count, int sourceRestart, boolean adjust){
+		return createAlignment(kind, mode, Alignment.R_INNERMOST, count, sourceRestart, adjust);
 	}
 
-	public Alignment createAlignment(String name, int mode, int tieBreakRule, int count, int sourceRestart){
-		return createAlignment(name, mode, tieBreakRule, count, sourceRestart, this.formatter.preferences.continuation_indentation, false);
+	public Alignment createAlignment(int kind, int mode, int tieBreakRule, int count, int sourceRestart){
+		return createAlignment(kind, mode, tieBreakRule, count, sourceRestart, this.formatter.preferences.continuation_indentation, false);
 	}
 
-	public Alignment createAlignment(String name, int mode, int count, int sourceRestart, int continuationIndent, boolean adjust){
-		return createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart, continuationIndent, adjust);
+	public Alignment createAlignment(int kind, int mode, int count, int sourceRestart, int continuationIndent, boolean adjust){
+		return createAlignment(kind, mode, Alignment.R_INNERMOST, count, sourceRestart, continuationIndent, adjust);
 	}
 
-	public Alignment createAlignment(String name, int mode, int tieBreakRule, int count, int sourceRestart, int continuationIndent, boolean adjust){
-		Alignment alignment = new Alignment(name, mode, tieBreakRule, this, count, sourceRestart, continuationIndent);
+	public Alignment createAlignment(int kind, int mode, int tieBreakRule, int count, int sourceRestart, int continuationIndent, boolean adjust){
+		Alignment alignment = new Alignment(kind, mode, tieBreakRule, this, count, sourceRestart, continuationIndent);
 		// adjust break indentation
 		if (adjust && this.memberAlignment != null) {
 			Alignment current = this.memberAlignment;
@@ -683,8 +683,8 @@
 		return alignment;
 	}
 
-	public Alignment createMemberAlignment(String name, int mode, int count, int sourceRestart) {
-		Alignment mAlignment = createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart);
+	public Alignment createMemberAlignment(int kind, int mode, int count, int sourceRestart) {
+		Alignment mAlignment = createAlignment(kind, mode, Alignment.R_INNERMOST, count, sourceRestart);
 		mAlignment.breakIndentationLevel = this.indentationLevel;
 		return mAlignment;
 	}
@@ -733,13 +733,6 @@
 		this.memberAlignment = current.enclosing;
 	}
 
-	public Alignment getAlignment(String name){
-		if (this.currentAlignment != null) {
-			return this.currentAlignment.getAlignment(name);
-		}
-		return null;
-	}
-
 	/**
 	 * Answer actual indentation level based on true column position
 	 * @return int
@@ -1114,11 +1107,11 @@
 						// skip
 					}
 					this.scanner.resetTo(currentTokenStartPosition, this.scannerEndPosition - 1);
-					boolean canUseAlignmentIndentation = (nextToken != TerminalTokens.TokenNameLBRACE || !this.currentAlignment.name.equals("localDeclarationAssignmentAlignment")); //$NON-NLS-1$
+					boolean canUseAlignmentIndentation = (nextToken != TerminalTokens.TokenNameLBRACE || this.currentAlignment.kind != Alignment.LOCAL_DECLARATION_ASSIGNMENT);
 					if (canUseAlignmentIndentation &&
 							(!this.formatBrace ||
-									this.currentAlignment.name.equals("array_initializer") || //$NON-NLS-1$
-									this.currentAlignment.name.equals("binaryExpressionAlignment")) && //$NON-NLS-1$
+									this.currentAlignment.kind == Alignment.ARRAY_INITIALIZER ||
+									this.currentAlignment.kind == Alignment.BINARY_EXPRESSION) &&
 							this.indentationLevel < this.currentAlignment.breakIndentationLevel) {
 						this.indentationLevel = this.currentAlignment.breakIndentationLevel;
 					}
@@ -1228,10 +1221,25 @@
 		// look for outermost breakable one
 		int relativeDepth = 0, outerMostDepth = -1;
 		Alignment targetAlignment = this.currentAlignment;
+		int previousKind = -1;
+		boolean insideMessageArguments = false;
+		boolean insideMessageSend = false;
 		while (targetAlignment != null){
-			if (targetAlignment.tieBreakRule == Alignment.R_OUTERMOST && targetAlignment.couldBreak()){
+			boolean couldBreak = targetAlignment.tieBreakRule == Alignment.R_OUTERMOST ||
+				((insideMessageArguments || insideMessageSend) && targetAlignment.kind == Alignment.MESSAGE_ARGUMENTS
+						&& (!targetAlignment.wasReset() || previousKind != Alignment.MESSAGE_SEND));
+			if (couldBreak && targetAlignment.couldBreak()){
 				outerMostDepth = relativeDepth;
 			}
+			switch (targetAlignment.kind) {
+				case Alignment.MESSAGE_ARGUMENTS:
+					insideMessageArguments = true;
+					break;
+				case Alignment.MESSAGE_SEND:
+					insideMessageSend = true;
+					break;
+			}
+			previousKind = targetAlignment.kind;
 			targetAlignment = targetAlignment.enclosing;
 			relativeDepth++;
 		}
@@ -1241,14 +1249,41 @@
 		// look for innermost breakable one
 		relativeDepth = 0;
 		targetAlignment = this.currentAlignment;
-		while (targetAlignment != null){
-			if (targetAlignment.couldBreak()){
-				throw new AlignmentException(AlignmentException.LINE_TOO_LONG, relativeDepth);
+		AlignmentException alignmentException = null;
+		int msgArgsDepth = -1;
+		while (targetAlignment != null) {
+			if (targetAlignment.kind == Alignment.MESSAGE_ARGUMENTS) {
+				msgArgsDepth = relativeDepth;
+			}
+			if (alignmentException == null) {
+				if (targetAlignment.couldBreak()) {
+					// do not throw the exception immediately to have a chance to reset
+					// previously broken alignments (see bug 203588)
+					alignmentException = new AlignmentException(AlignmentException.LINE_TOO_LONG, relativeDepth);
+				}
+			} else if (targetAlignment.wasSplit) {
+				// reset the nearest already broken outermost alignment.
+				// Note that it's not done twice to avoid infinite loop while raising
+				// the exception on an innermost alignment...
+				if (!targetAlignment.wasReset()) {
+					targetAlignment.reset();
+					if (msgArgsDepth > alignmentException.relativeDepth) {
+						alignmentException.relativeDepth = msgArgsDepth;
+					}
+					throw alignmentException;
+				}
 			}
 			targetAlignment = targetAlignment.enclosing;
 			relativeDepth++;
 		}
+		if (alignmentException != null) {
+			throw alignmentException;
+		}
 		// did not find any breakable location - proceed
+		if (this.currentAlignment != null) {
+			this.currentAlignment.blockAlign = false;
+			this.currentAlignment.tooLong = true;
+		}
 	}
 
 	/*
@@ -2569,7 +2604,7 @@
 			   			commentIndentationLevel = this.column - 1;
 					}
 				} else {
-					if (this.currentAlignment != null && this.currentAlignment.name.equals("array_initializer") && //$NON-NLS-1$
+					if (this.currentAlignment != null && this.currentAlignment.kind == Alignment.ARRAY_INITIALIZER &&
 						this.indentationLevel < this.currentAlignment.breakIndentationLevel &&
 						this.lastLineComment.lines > 0)
 					{
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/align/Alignment.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/align/Alignment.java
index 666208b..753441e 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/align/Alignment.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/align/Alignment.java
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.formatter.align;
 
+import org.eclipse.core.runtime.Assert;
 import org.eclipse.jdt.internal.formatter.Location;
 import org.eclipse.jdt.internal.formatter.Scribe;
 
@@ -20,8 +21,60 @@
  */
 public class Alignment {
 
+	// Kind of alignment
+	public int kind;
+	public static final int ALLOCATION = 1;
+	public static final int ANNOTATION_MEMBERS_VALUE_PAIRS = 2;
+	public static final int ARRAY_INITIALIZER = 3;
+	public static final int ASSIGNMENT = 4;
+	public static final int BINARY_EXPRESSION = 5;
+	public static final int CASCADING_MESSAGE_SEND = 6;
+	public static final int COMPACT_IF = 7;
+	public static final int COMPOUND_ASSIGNMENT = 8;
+	public static final int CONDITIONAL_EXPRESSION = 9;
+	public static final int ENUM_CONSTANTS = 10;
+	public static final int ENUM_CONSTANTS_ARGUMENTS = 11;
+	public static final int EXPLICIT_CONSTRUCTOR_CALL = 12;
+	public static final int FIELD_DECLARATION_ASSIGNMENT = 13;
+	public static final int LOCAL_DECLARATION_ASSIGNMENT = 14;
+	public static final int MESSAGE_ARGUMENTS = 15;
+	public static final int MESSAGE_SEND = 16;
+	public static final int METHOD_ARGUMENTS = 17;
+	public static final int METHOD_DECLARATION = 18;
+	public static final int MULTIPLE_FIELD = 19;
+	public static final int SUPER_CLASS = 20;
+	public static final int SUPER_INTERFACES = 21;
+	public static final int THROWS = 22;
+	public static final int TYPE_MEMBERS = 23;
+
 	// name of alignment
 	public String name;
+	public static final String[] NAMES = {
+		"", //$NON-NLS-1$
+		"allocation", //$NON-NLS-1$
+		"annotationMemberValuePairs", //$NON-NLS-1$
+		"array_initializer", //$NON-NLS-1$
+		"assignmentAlignment", //$NON-NLS-1$
+		"binaryExpressionAlignment", //$NON-NLS-1$
+		"cascadingMessageSendAlignment", //$NON-NLS-1$
+		"compactIf", //$NON-NLS-1$
+		"compoundAssignmentAlignment", //$NON-NLS-1$
+		"conditionalExpression", //$NON-NLS-1$
+		"enumConstants", //$NON-NLS-1$
+		"enumConstantArguments", //$NON-NLS-1$
+		"explicit_constructor_call", //$NON-NLS-1$
+		"fieldDeclarationAssignmentAlignment", //$NON-NLS-1$
+		"localDeclarationAssignmentAlignment", //$NON-NLS-1$
+		"messageArguments", //$NON-NLS-1$
+		"messageAlignment", //$NON-NLS-1$
+		"methodArguments", //$NON-NLS-1$
+		"methodDeclaration", //$NON-NLS-1$
+		"multiple_field", //$NON-NLS-1$
+		"superclass", //$NON-NLS-1$
+		"superInterfaces", //$NON-NLS-1$
+		"throws", //$NON-NLS-1$
+		"typeMembers", //$NON-NLS-1$
+	};
 
 	// link to enclosing alignment
 	public Alignment enclosing;
@@ -45,9 +98,14 @@
 	public int shiftBreakIndentationLevel;
 	public int[] fragmentBreaks;
 	public boolean wasSplit;
+	public boolean blockAlign = false;
+	public boolean tooLong = false;
 
 	public Scribe scribe;
 
+	// reset
+	private boolean reset = false;
+
 	/*
 	 * Alignment modes
 	 */
@@ -133,9 +191,11 @@
 	public static final int CHUNK_ENUM = 4;
 
 	// location to align and break on.
-	public Alignment(String name, int mode, int tieBreakRule, Scribe scribe, int fragmentCount, int sourceRestart, int continuationIndent){
+	public Alignment(int kind, int mode, int tieBreakRule, Scribe scribe, int fragmentCount, int sourceRestart, int continuationIndent){
 
-		this.name = name;
+		Assert.isTrue(kind >=ALLOCATION && kind <=TYPE_MEMBERS);
+		this.kind = kind;
+		this.name = NAMES[kind];
 		this.location = new Location(scribe, sourceRestart);
 		this.mode = mode;
 		this.tieBreakRule = tieBreakRule;
@@ -174,9 +234,9 @@
 		}
 	}
 
-	public boolean checkChunkStart(int kind, int startIndex, int sourceRestart) {
-		if (this.chunkKind != kind) {
-			this.chunkKind = kind;
+	public boolean checkChunkStart(int chunk, int startIndex, int sourceRestart) {
+		if (this.chunkKind != chunk) {
+			this.chunkKind = chunk;
 
 			// when redoing same chunk alignment, must not reset
 			if (startIndex != this.chunkStartIndex) {
@@ -232,6 +292,61 @@
 		}
 		return depth;
 	}
+	
+	/**
+	 * Returns whether the alignment can be aligned or not.
+	 * Only used for message send alignment, it currently blocks its alignment
+	 * when it's at the first nesting level of a message send. It allow to save
+	 * space on the argument broken line by reducing the number of indentations.
+	 */
+	public boolean canAlign() {
+		if (this.tooLong) {
+			return true;
+		}
+		boolean canAlign = true;
+		Alignment enclosingAlignment = this.enclosing;
+		while (enclosingAlignment != null) {
+			switch (enclosingAlignment.kind) {
+				case Alignment.ALLOCATION:
+				case Alignment.MESSAGE_ARGUMENTS:
+					// message send inside arguments, avoid to align
+					if (enclosingAlignment.isWrapped() && 
+							(enclosingAlignment.fragmentIndex > 0 || enclosingAlignment.fragmentCount < 2)) {
+						return !this.blockAlign;
+					}
+					if (enclosingAlignment.tooLong) {
+						return true;
+					}
+					canAlign = false;
+					break;
+				case Alignment.MESSAGE_SEND:
+					// multiple depth of message send, hence allow current to align
+					switch (this.kind) {
+						case Alignment.ALLOCATION:
+						case Alignment.MESSAGE_ARGUMENTS:
+						case Alignment.MESSAGE_SEND:
+							Alignment superEnclosingAlignment = enclosingAlignment.enclosing;
+							while (superEnclosingAlignment != null) {
+								switch (superEnclosingAlignment.kind) {
+									case Alignment.ALLOCATION:
+									case Alignment.MESSAGE_ARGUMENTS:
+									case Alignment.MESSAGE_SEND:
+										// block the alignment of the intermediate message send
+										if (this.scribe.nlsTagCounter == 0) {
+											enclosingAlignment.blockAlign = true;
+										}
+										return !this.blockAlign;
+								}
+								superEnclosingAlignment = superEnclosingAlignment.enclosing;
+							}
+							break;
+					}
+					return !this.blockAlign;
+			}
+			enclosingAlignment = enclosingAlignment.enclosing;
+		}
+		return canAlign && !this.blockAlign;
+	}
 
 	public boolean couldBreak(){
 		int i;
@@ -329,12 +444,17 @@
 		return false; // cannot split better
 	}
 
-	public Alignment getAlignment(String targetName) {
+	public boolean isWrapped() {
+		return this.fragmentBreaks[this.fragmentIndex] == BREAK;
+	}
 
-		if (targetName.equals(this.name)) return this;
-		if (this.enclosing == null) return null;
-
-		return this.enclosing.getAlignment(targetName);
+	public int wrappedIndex() {
+		for (int i = 0, max = this.fragmentCount; i < max; i++) {
+			if (this.fragmentBreaks[i] == BREAK) {
+				return i;
+			}
+		}
+		return -1;
 	}
 
 	// perform alignment effect for current fragment
@@ -366,6 +486,7 @@
 	// reset fragment indentation/break status
 	public void reset() {
 
+		this.wasSplit = false;
 		if (this.fragmentCount > 0){
 			this.fragmentIndentations = new int[this.fragmentCount];
 			this.fragmentBreaks = new int[this.fragmentCount];
@@ -375,6 +496,7 @@
 		if ((this.mode & M_FORCE) != 0) {
 			couldBreak();
 		}
+		this.reset = true;
 	}
 
 	public void toFragmentsString(StringBuffer buffer){
@@ -397,6 +519,10 @@
 		// First line is for class and name
 		buffer.append(indentation);
 		buffer
+			.append("<kind: ")	//$NON-NLS-1$
+			.append(this.kind)
+			.append("> ");	//$NON-NLS-1$
+		buffer
 			.append("<name: ")	//$NON-NLS-1$
 			.append(this.name)
 			.append(">\n");	//$NON-NLS-1$
@@ -463,12 +589,7 @@
 		}
 	}
 
-	public boolean isWrapped() {
-		for (int i = 0, max = this.fragmentCount; i < max; i++) {
-			if (this.fragmentBreaks[i] == BREAK) {
-				return true;
-			}
-		}
-		return false;
+	public boolean wasReset() {
+		return this.reset;
 	}
 }
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
index da7bfdd..cd489e6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -593,14 +593,17 @@
 	IInitializer[] getInitializers() throws JavaModelException;
 
 	/**
-	 * Returns the binding key for this type. A binding key is a key that uniquely
-	 * identifies this type. It allows access to generic info for parameterized
-	 * types.
+	 * Returns the binding key for this type only if the given type is {@link #isResolved() resolved}.
+	 * A binding key is a key that uniquely identifies this type. It allows access
+	 * to generic info for parameterized types.
 	 *
+	 * <p>If the given type is not resolved, the returned key is simply the java element's key.
+	 * </p>
 	 * @return the binding key for this type
 	 * @see org.eclipse.jdt.core.dom.IBinding#getKey()
 	 * @see BindingKey
 	 * @since 3.1
+	 * @see #isResolved()
 	 */
 	String getKey();
 
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
index 9e1a828..f03ec1c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -21,6 +21,7 @@
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.*;
 import org.eclipse.jdt.core.compiler.IScanner;
+import org.eclipse.jdt.core.compiler.ITerminalSymbols;
 import org.eclipse.jdt.core.formatter.CodeFormatter;
 import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
 import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
@@ -86,7 +87,7 @@
 	 * @return an instance of a code formatter
 	 * @see ICodeFormatter
 	 * @see ToolFactory#createDefaultCodeFormatter(Map)
-	 * @deprecated Use {@link #createCodeFormatter(Map)} instead. Extension point is discontinued
+	 * @deprecated The extension point has been deprecated, use {@link #createCodeFormatter(Map)} instead.
 	 */
 	public static ICodeFormatter createCodeFormatter(){
 
@@ -344,9 +345,7 @@
 	}
 
 	/**
-	 * Create an instance of the built-in code formatter. A code formatter implementation can be contributed via the
-	 * extension point "org.eclipse.jdt.core.codeFormatter". If unable to find a registered extension, the factory will
-	 * default to using the default code formatter.
+	 * Create an instance of the default code formatter.
 	 *
 	 * @param options - the options map to use for formatting with the default code formatter. Recognized options
 	 * 	are documented on <code>JavaCore#getDefaultOptions()</code>. If set to <code>null</code>, then use
@@ -355,7 +354,7 @@
 	 * @see ICodeFormatter
 	 * @see ToolFactory#createCodeFormatter()
 	 * @see JavaCore#getOptions()
-	 * @deprecated Use {@link #createCodeFormatter(Map)} instead
+	 * @deprecated Use {@link #createCodeFormatter(Map)} instead but note the different options
 	 */
 	public static ICodeFormatter createDefaultCodeFormatter(Map options){
 		if (options == null) options = JavaCore.getOptions();
@@ -379,26 +378,38 @@
 	 * </pre>
 	 * </code>
 	 *
-	 * <p>
-	 * The returned scanner will tolerate unterminated line comments (missing line separator). It can be made stricter
-	 * by using API with extra boolean parameter (<code>strictCommentMode</code>).
-	 * <p>
+	 * <p>By default the compliance used to create the scanner is the workspace's compliance when running inside the IDE
+	 * or 1.4 if running from outside of a headless eclipse.
+	 * </p>
+	 *
 	 * @param tokenizeComments if set to <code>false</code>, comments will be silently consumed
 	 * @param tokenizeWhiteSpace if set to <code>false</code>, white spaces will be silently consumed,
 	 * @param assertMode if set to <code>false</code>, occurrences of 'assert' will be reported as identifiers
-	 * (<code>ITerminalSymbols#TokenNameIdentifier</code>), whereas if set to <code>true</code>, it
-	 * would report assert keywords (<code>ITerminalSymbols#TokenNameassert</code>). Java 1.4 has introduced
+	 * ({@link ITerminalSymbols#TokenNameIdentifier}), whereas if set to <code>true</code>, it
+	 * would report assert keywords ({@link ITerminalSymbols#TokenNameassert}). Java 1.4 has introduced
 	 * a new 'assert' keyword.
 	 * @param recordLineSeparator if set to <code>true</code>, the scanner will record positions of encountered line
 	 * separator ends. In case of multi-character line separators, the last character position is considered. These positions
-	 * can then be extracted using <code>IScanner#getLineEnds</code>. Only non-unicode escape sequences are
+	 * can then be extracted using {@link IScanner#getLineEnds()}. Only non-unicode escape sequences are
 	 * considered as valid line separators.
   	 * @return a scanner
 	 * @see org.eclipse.jdt.core.compiler.IScanner
+	 * @see #createScanner(boolean, boolean, boolean, String, String)
 	 */
 	public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean assertMode, boolean recordLineSeparator){
-
-		PublicScanner scanner = new PublicScanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/, assertMode ? ClassFileConstants.JDK1_4 : ClassFileConstants.JDK1_3/*sourceLevel*/, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/);
+		// use default workspace compliance
+		long complianceLevelValue = CompilerOptions.versionToJdkLevel(JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE));
+		if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_4; // fault-tolerance
+		PublicScanner scanner =
+			new PublicScanner(
+				tokenizeComments,
+				tokenizeWhiteSpace,
+				false/*nls*/,
+				assertMode ? ClassFileConstants.JDK1_4 : ClassFileConstants.JDK1_3/*sourceLevel*/,
+				complianceLevelValue,
+				null/*taskTags*/,
+				null/*taskPriorities*/,
+				true/*taskCaseSensitive*/);
 		scanner.recordLineSeparator = recordLineSeparator;
 		return scanner;
 	}
@@ -420,29 +431,41 @@
 	 * </pre>
 	 * </code>
 	 *
-	 * <p>
-	 * The returned scanner will tolerate unterminated line comments (missing line separator). It can be made stricter
-	 * by using API with extra boolean parameter (<code>strictCommentMode</code>).
-	 * <p>
+	 * <p>By default the compliance used to create the scanner is the workspace's compliance when running inside the IDE
+	 * or 1.4 if running from outside of a headless eclipse.
+	 * </p>
+	 *
 	 * @param tokenizeComments if set to <code>false</code>, comments will be silently consumed
 	 * @param tokenizeWhiteSpace if set to <code>false</code>, white spaces will be silently consumed,
 	 * @param recordLineSeparator if set to <code>true</code>, the scanner will record positions of encountered line
 	 * separator ends. In case of multi-character line separators, the last character position is considered. These positions
-	 * can then be extracted using <code>IScanner#getLineEnds</code>. Only non-unicode escape sequences are
+	 * can then be extracted using {@link IScanner#getLineEnds()}. Only non-unicode escape sequences are
 	 * considered as valid line separators.
 	 * @param sourceLevel if set to <code>&quot;1.3&quot;</code> or <code>null</code>, occurrences of 'assert' will be reported as identifiers
-	 * (<code>ITerminalSymbols#TokenNameIdentifier</code>), whereas if set to <code>&quot;1.4&quot;</code>, it
-	 * would report assert keywords (<code>ITerminalSymbols#TokenNameassert</code>). Java 1.4 has introduced
+	 * ({@link ITerminalSymbols#TokenNameIdentifier}), whereas if set to <code>&quot;1.4&quot;</code>, it
+	 * would report assert keywords ({@link ITerminalSymbols#TokenNameassert}). Java 1.4 has introduced
 	 * a new 'assert' keyword.
-  	 * @return a scanner
+	 * @return a scanner
 	 * @see org.eclipse.jdt.core.compiler.IScanner
-     * @since 3.0
+	 * @see #createScanner(boolean, boolean, boolean, String, String)
+	 * @since 3.0
 	 */
 	public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator, String sourceLevel) {
-		PublicScanner scanner = null;
-		long level = CompilerOptions.versionToJdkLevel(sourceLevel);
-		if (level == 0) level = ClassFileConstants.JDK1_3; // fault-tolerance
-		scanner = new PublicScanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/,level /*sourceLevel*/, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/);
+		// use default workspace compliance
+		long complianceLevelValue = CompilerOptions.versionToJdkLevel(JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE));
+		if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_4; // fault-tolerance
+		long sourceLevelValue = CompilerOptions.versionToJdkLevel(sourceLevel);
+		if (sourceLevelValue == 0) sourceLevelValue = ClassFileConstants.JDK1_3; // fault-tolerance
+		PublicScanner scanner =
+			new PublicScanner(
+				tokenizeComments,
+				tokenizeWhiteSpace,
+				false/*nls*/,
+				sourceLevelValue /*sourceLevel*/,
+				complianceLevelValue,
+				null/*taskTags*/,
+				null/*taskPriorities*/,
+				true/*taskCaseSensitive*/);
 		scanner.recordLineSeparator = recordLineSeparator;
 		return scanner;
 	}
@@ -464,33 +487,29 @@
 	 * </pre>
 	 * </code>
 	 *
-	 * <p>
-	 * The returned scanner will tolerate unterminated line comments (missing line separator). It can be made stricter
-	 * by using API with extra boolean parameter (<code>strictCommentMode</code>).
-	 * <p>
 	 * @param tokenizeComments if set to <code>false</code>, comments will be silently consumed
 	 * @param tokenizeWhiteSpace if set to <code>false</code>, white spaces will be silently consumed,
 	 * @param recordLineSeparator if set to <code>true</code>, the scanner will record positions of encountered line
 	 * separator ends. In case of multi-character line separators, the last character position is considered. These positions
-	 * can then be extracted using <code>IScanner#getLineEnds</code>. Only non-unicode escape sequences are
+	 * can then be extracted using {@link IScanner#getLineEnds()}. Only non-unicode escape sequences are
 	 * considered as valid line separators.
 	 * @param sourceLevel if set to <code>&quot;1.3&quot;</code> or <code>null</code>, occurrences of 'assert' will be reported as identifiers
-	 * (<code>ITerminalSymbols#TokenNameIdentifier</code>), whereas if set to <code>&quot;1.4&quot;</code>, it
-	 * would report assert keywords (<code>ITerminalSymbols#TokenNameassert</code>). Java 1.4 has introduced
+	 * ({@link ITerminalSymbols#TokenNameIdentifier}), whereas if set to <code>&quot;1.4&quot;</code>, it
+	 * would report assert keywords ({@link ITerminalSymbols#TokenNameassert}). Java 1.4 has introduced
 	 * a new 'assert' keyword.
 	 * @param complianceLevel This is used to support the Unicode 4.0 character sets. if set to 1.5 or above,
 	 * the Unicode 4.0 is supporte, otherwise Unicode 3.0 is supported.
-  	 * @return a scanner
+	 * @return a scanner
 	 * @see org.eclipse.jdt.core.compiler.IScanner
 	 *
-     * @since 3.1
+	 * @since 3.1
 	 */
 	public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator, String sourceLevel, String complianceLevel) {
 		PublicScanner scanner = null;
 		long sourceLevelValue = CompilerOptions.versionToJdkLevel(sourceLevel);
 		if (sourceLevelValue == 0) sourceLevelValue = ClassFileConstants.JDK1_3; // fault-tolerance
 		long complianceLevelValue = CompilerOptions.versionToJdkLevel(complianceLevel);
-		if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_3; // fault-tolerance
+		if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_4; // fault-tolerance
 		scanner = new PublicScanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/,sourceLevelValue /*sourceLevel*/, complianceLevelValue, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/);
 		scanner.recordLineSeparator = recordLineSeparator;
 		return scanner;
diff --git a/org.eclipse.jdt.core/plugin.xml b/org.eclipse.jdt.core/plugin.xml
index 4a044b6..7705558 100644
--- a/org.eclipse.jdt.core/plugin.xml
+++ b/org.eclipse.jdt.core/plugin.xml
Binary files differ
diff --git a/org.eclipse.jdt.core/schema/codeFormatter.exsd b/org.eclipse.jdt.core/schema/codeFormatter.exsd
index 4fe77e6..09defb2 100644
--- a/org.eclipse.jdt.core/schema/codeFormatter.exsd
+++ b/org.eclipse.jdt.core/schema/codeFormatter.exsd
@@ -1,6 +1,6 @@
 <?xml version='1.0' encoding='UTF-8'?>

 <!-- Schema file written by PDE -->

-<schema targetNamespace="org.eclipse.jdt.core">

+<schema targetNamespace="org.eclipse.jdt.core" xmlns="http://www.w3.org/2001/XMLSchema">

 <annotation>

       <appInfo>

          <meta.schema plugin="org.eclipse.jdt.core" id="codeFormatter" name="Code Formatters"/>

@@ -11,6 +11,11 @@
    </annotation>

 

    <element name="extension">

+      <annotation>

+         <appInfo>

+            <meta.element deprecated="true" />

+         </appInfo>

+      </annotation>

       <complexType>

          <sequence>

             <element ref="codeFormatter" minOccurs="0" maxOccurs="unbounded"/>

@@ -77,35 +82,19 @@
       </documentation>

    </annotation>

 

-   <annotation>

-      <appInfo>

-         <meta.section type="apiInfo"/>

-      </appInfo>

-      <documentation>

-         

-      </documentation>

-   </annotation>

 

-   <annotation>

-      <appInfo>

-         <meta.section type="implementation"/>

-      </appInfo>

-      <documentation>

-         

-      </documentation>

-   </annotation>

 

    <annotation>

       <appInfo>

          <meta.section type="copyright"/>

       </appInfo>

       <documentation>

-         Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br&gt;
+         Copyright (c) 2000, 2010 IBM Corporation and others.&lt;br&gt;

 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 &lt;a

 href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;

-     </documentation>

+      </documentation>

    </annotation>

 

 </schema>