update jdt.core to S-4.9M2-201808012000
diff --git a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
index 4bae537..9b2ad19 100644
--- a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
+++ b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
@@ -66,7 +66,7 @@
id="org.eclipse.jdt.core"
download-size="5614"
install-size="5614"
- version="3.14.100.OTDT_r271_qualifier"
+ version="3.15.0.OTDT_r271_qualifier"
unpack="false"/>
</feature>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
index eaf48b2..11b2fa1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
@@ -14387,4 +14387,91 @@
"}\n"
});
}
+public void testBug536978_comment2() {
+ runNegativeTest(
+ new String[] {
+ "SimpleDemo.java",
+ "abstract interface AbstractResult {\n" +
+ " public abstract int test();\n" +
+ "}\n" +
+ "\n" +
+ "abstract class AbstractDemo<Request extends AbstractResult, Response extends AbstractResult> {\n" +
+ " protected abstract Response test(Request request);\n" +
+ "}\n" +
+ "\n" +
+ "interface SimpleResult extends AbstractResult {};\n" +
+ "\n" +
+ "class Result1 implements SimpleResult {\n" +
+ " public int test() { return 1; }\n" +
+ "}\n" +
+ "class OtherResult implements AbstractResult {\n" +
+ " public int test() { return 2; }\n" +
+ "}\n" +
+ "\n" +
+ "public class SimpleDemo<Request extends AbstractResult, Response extends AbstractResult> \n" +
+ "extends AbstractDemo<Request, Response> {\n" +
+ "\n" +
+ " @Override\n" +
+ " protected SimpleResult test(AbstractResult request) {\n" +
+ " return new Result1();\n" +
+ " }\n" +
+ " \n" +
+ " public static void main(String... args) {\n" +
+ " AbstractDemo<OtherResult,OtherResult> demo = new SimpleDemo<OtherResult,OtherResult>();\n" +
+ " OtherResult result = demo.test(new OtherResult());\n" +
+ " }\n" +
+ "\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in SimpleDemo.java (at line 22)\n" +
+ " protected SimpleResult test(AbstractResult request) {\n" +
+ " ^^^^^^^^^^^^\n" +
+ "The return type is incompatible with AbstractDemo<Request,Response>.test(Request)\n" +
+ "----------\n");
+}
+public void testBug536978_comment5() {
+ runConformTest(
+ new String[] {
+ "SimpleDemo.java",
+ "\n" +
+ "abstract interface AbstractResult {\n" +
+ " public abstract int test();\n" +
+ "}\n" +
+ "\n" +
+ "abstract class AbstractDemo<Request extends AbstractResult, Response extends AbstractResult> {\n" +
+ " protected abstract Response test(Request request);\n" +
+ "\n" +
+ "}\n" +
+ "\n" +
+ "class Result1 implements AbstractResult {\n" +
+ " public int test() {\n" +
+ " return 1;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class OtherResult implements AbstractResult {\n" +
+ " public int test() {\n" +
+ " return 2;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "public class SimpleDemo<Request extends AbstractResult, Response extends AbstractResult> extends AbstractDemo<Request, Response> {\n" +
+ " @Override @SuppressWarnings(\"unchecked\")\n" +
+ " protected AbstractResult test(AbstractResult request) {\n" +
+ " return new Result1();\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String... args) {\n" +
+ " AbstractDemo<OtherResult, OtherResult> demo = new SimpleDemo<OtherResult, OtherResult>();\n" +
+ " try {\n" +
+ " OtherResult result = demo.test(new OtherResult());\n" +
+ " } catch (ClassCastException e) {\n" +
+ " System.out.println(e.getMessage());\n" + // omit the stack trace for test robustness
+ " }\n" +
+ " }\n" +
+ "}\n"
+ },
+ "Result1 cannot be cast to OtherResult");
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
index dacaf3a..687a381 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
@@ -14179,4 +14179,84 @@
String input = getCompilationUnit("Formatter", "", "test128653", "in.java").getSource();
formatSource(input, getCompilationUnit("Formatter", "", "test128653", "I_out.java").getSource());
}
+
+/**
+ * https://bugs.eclipse.org/104910 - [formatter] add "keep simple for/while on one line" option
+ */
+public void testBug104910a() throws JavaModelException {
+ this.formatterPrefs.keep_simple_for_body_on_same_line = true;
+ String input = getCompilationUnit("Formatter", "", "test104910", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test104910", "A_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/104910 - [formatter] add "keep simple for/while on one line" option
+ */
+public void testBug104910b() throws JavaModelException {
+ this.formatterPrefs.keep_simple_while_body_on_same_line = true;
+ String input = getCompilationUnit("Formatter", "", "test104910", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test104910", "B_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/104910 - [formatter] add "keep simple for/while on one line" option
+ */
+public void testBug104910c() throws JavaModelException {
+ this.formatterPrefs.keep_simple_do_while_body_on_same_line = true;
+ String input = getCompilationUnit("Formatter", "", "test104910", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test104910", "C_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/104910 - [formatter] add "keep simple for/while on one line" option
+ */
+public void testBug104910d() throws JavaModelException {
+ this.formatterPrefs.keep_simple_for_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_do_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_if_on_one_line = true;
+ this.formatterPrefs.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT + Alignment.M_FORCE;
+ this.formatterPrefs.alignment_for_compact_loop = Alignment.M_ONE_PER_LINE_SPLIT + Alignment.M_FORCE;
+ this.formatterPrefs.use_tabs_only_for_leading_indentations = true;
+ String input = getCompilationUnit("Formatter", "", "test104910", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test104910", "D_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/104910 - [formatter] add "keep simple for/while on one line" option
+ */
+public void testBug104910e() throws JavaModelException {
+ this.formatterPrefs.keep_simple_for_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_do_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_if_on_one_line = true;
+ this.formatterPrefs.use_tabs_only_for_leading_indentations = true;
+ this.formatterPrefs.page_width = 55;
+ String input = getCompilationUnit("Formatter", "", "test104910", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test104910", "E_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/104910 - [formatter] add "keep simple for/while on one line" option
+ */
+public void testBug104910f() throws JavaModelException {
+ this.formatterPrefs.keep_simple_for_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_do_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_if_on_one_line = true;
+ this.formatterPrefs.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT + Alignment.M_FORCE + Alignment.M_INDENT_ON_COLUMN;
+ this.formatterPrefs.alignment_for_compact_loop = Alignment.M_ONE_PER_LINE_SPLIT + Alignment.M_FORCE + Alignment.M_INDENT_ON_COLUMN;
+ this.formatterPrefs.use_tabs_only_for_leading_indentations = true;
+ String input = getCompilationUnit("Formatter", "", "test104910", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test104910", "F_out.java").getSource());
+}
+/**
+ * https://bugs.eclipse.org/104910 - [formatter] add "keep simple for/while on one line" option
+ */
+public void testBug104910g() throws JavaModelException {
+ this.formatterPrefs.keep_simple_for_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_do_while_body_on_same_line = true;
+ this.formatterPrefs.keep_simple_if_on_one_line = true;
+ this.formatterPrefs.alignment_for_compact_if = Alignment.M_NO_ALIGNMENT;
+ this.formatterPrefs.page_width = 40;
+ String input = getCompilationUnit("Formatter", "", "test104910", "in.java").getSource();
+ formatSource(input, getCompilationUnit("Formatter", "", "test104910", "G_out.java").getSource());
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test056/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test056/A_out.java
index 114b3f5..e900439 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test056/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test056/A_out.java
@@ -1,2 +1,2 @@
-if (true) ;
+if (true);
else System.out.println();
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/A_out.java
new file mode 100644
index 0000000..227548b
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/A_out.java
@@ -0,0 +1,63 @@
+public class A {
+ void f() {
+ if (one != 1)
+ doSomething();
+
+ for (int i = 0; i < list.size(); i++) list.get(i).print();
+
+ for (Printer printer : list) printer.print(myDocument);
+
+ while (!queue.isEmpty())
+ consume(queue.remove());
+
+ do
+ list.add(createElement());
+ while (list.size() < 100);
+
+ /* */while /* */ (condition)
+ /* */ doSomething();
+ /* */do
+ /* */createElement();
+ /* */ while/* */ (condition);
+ /* */
+ /* */ for /* */ (String s : strings) /* */ System.out.println(s);
+
+ while (!queue.isEmpty())
+ for (String s : queue.remove()) if (!s.isEmpty())
+ print(s);
+ for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) sum += i * j;
+ while (x-- > 0)
+ while (y-- > 0)
+ drawPoint(x, y);
+ do
+ for (String s : queue.remove()) if (!s.isEmpty())
+ print(s);
+ while (!queue.isEmpty());
+
+ while (!queue.isEmpty()) {
+ for (String s : queue.remove()) if (!s.isEmpty())
+ print(s);
+ }
+ ;
+ for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) {
+ sum += i * j;
+ }
+ while (x-- > 0) {
+ while (y-- > 0)
+ while (z-- > 0)
+ drawPoint(x, y, z);
+ }
+ do
+ for (String s : queue.remove()) {
+ if (!s.isEmpty())
+ print(s);
+ }
+ while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccc())
+ ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff();
+ do
+ aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccccc();
+ while (ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/B_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/B_out.java
new file mode 100644
index 0000000..bef0065
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/B_out.java
@@ -0,0 +1,65 @@
+public class A {
+ void f() {
+ if (one != 1)
+ doSomething();
+
+ for (int i = 0; i < list.size(); i++)
+ list.get(i).print();
+
+ for (Printer printer : list)
+ printer.print(myDocument);
+
+ while (!queue.isEmpty()) consume(queue.remove());
+
+ do
+ list.add(createElement());
+ while (list.size() < 100);
+
+ /* */while /* */ (condition) /* */ doSomething();
+ /* */do
+ /* */createElement();
+ /* */ while/* */ (condition);
+ /* */
+ /* */ for /* */ (String s : strings)
+ /* */ System.out.println(s);
+
+ while (!queue.isEmpty()) for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++)
+ sum += i * j;
+ while (x-- > 0) while (y-- > 0) drawPoint(x, y);
+ do
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ while (!queue.isEmpty());
+
+ while (!queue.isEmpty()) {
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ }
+ ;
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) {
+ sum += i * j;
+ }
+ while (x-- > 0) {
+ while (y-- > 0) while (z-- > 0) drawPoint(x, y, z);
+ }
+ do
+ for (String s : queue.remove()) {
+ if (!s.isEmpty())
+ print(s);
+ }
+ while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccc())
+ ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff();
+ do
+ aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccccc();
+ while (ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/C_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/C_out.java
new file mode 100644
index 0000000..fdb9560
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/C_out.java
@@ -0,0 +1,65 @@
+public class A {
+ void f() {
+ if (one != 1)
+ doSomething();
+
+ for (int i = 0; i < list.size(); i++)
+ list.get(i).print();
+
+ for (Printer printer : list)
+ printer.print(myDocument);
+
+ while (!queue.isEmpty())
+ consume(queue.remove());
+
+ do list.add(createElement()); while (list.size() < 100);
+
+ /* */while /* */ (condition)
+ /* */ doSomething();
+ /* */do/* */createElement();/* */ while/* */ (condition);
+ /* */
+ /* */ for /* */ (String s : strings)
+ /* */ System.out.println(s);
+
+ while (!queue.isEmpty())
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++)
+ sum += i * j;
+ while (x-- > 0)
+ while (y-- > 0)
+ drawPoint(x, y);
+ do for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ while (!queue.isEmpty());
+
+ while (!queue.isEmpty()) {
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ }
+ ;
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) {
+ sum += i * j;
+ }
+ while (x-- > 0) {
+ while (y-- > 0)
+ while (z-- > 0)
+ drawPoint(x, y, z);
+ }
+ do for (String s : queue.remove()) {
+ if (!s.isEmpty())
+ print(s);
+ }
+ while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccc())
+ ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff();
+ do aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccccc();
+ while (ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/D_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/D_out.java
new file mode 100644
index 0000000..d50db34
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/D_out.java
@@ -0,0 +1,67 @@
+public class A {
+ void f() {
+ if (one != 1)
+ doSomething();
+
+ for (int i = 0; i < list.size(); i++)
+ list.get(i).print();
+
+ for (Printer printer : list)
+ printer.print(myDocument);
+
+ while (!queue.isEmpty())
+ consume(queue.remove());
+
+ do list.add(createElement());
+ while (list.size() < 100);
+
+ /* */while /* */ (condition)
+ /* */ doSomething();
+ /* */do/* */createElement();
+ /* */ while/* */ (condition);
+ /* */
+ /* */ for /* */ (String s : strings)
+ /* */ System.out.println(s);
+
+ while (!queue.isEmpty())
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++)
+ sum += i * j;
+ while (x-- > 0)
+ while (y-- > 0)
+ drawPoint(x, y);
+ do for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ while (!queue.isEmpty());
+
+ while (!queue.isEmpty()) {
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ }
+ ;
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) {
+ sum += i * j;
+ }
+ while (x-- > 0) {
+ while (y-- > 0)
+ while (z-- > 0)
+ drawPoint(x, y, z);
+ }
+ do for (String s : queue.remove()) {
+ if (!s.isEmpty())
+ print(s);
+ }
+ while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccc())
+ ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff();
+ do aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccccc();
+ while (ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/E_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/E_out.java
new file mode 100644
index 0000000..8a9980b
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/E_out.java
@@ -0,0 +1,65 @@
+public class A {
+ void f() {
+ if (one != 1) doSomething();
+
+ for (int i = 0; i < list.size(); i++)
+ list.get(i).print();
+
+ for (Printer printer : list)
+ printer.print(myDocument);
+
+ while (!queue.isEmpty())
+ consume(queue.remove());
+
+ do list.add(createElement());
+ while (list.size() < 100);
+
+ /* */while /* */ (condition)
+ /* */ doSomething();
+ /* */do/* */createElement();
+ /* */ while/* */ (condition);
+ /* */
+ /* */ for /* */ (String s : strings)
+ /* */ System.out.println(s);
+
+ while (!queue.isEmpty())
+ for (String s : queue.remove())
+ if (!s.isEmpty()) print(s);
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) sum += i * j;
+ while (x-- > 0)
+ while (y-- > 0) drawPoint(x, y);
+ do for (String s : queue.remove())
+ if (!s.isEmpty()) print(s);
+ while (!queue.isEmpty());
+
+ while (!queue.isEmpty()) {
+ for (String s : queue.remove())
+ if (!s.isEmpty()) print(s);
+ }
+ ;
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) {
+ sum += i * j;
+ }
+ while (x-- > 0) {
+ while (y-- > 0)
+ while (z-- > 0) drawPoint(x, y, z);
+ }
+ do for (String s : queue.remove()) {
+ if (!s.isEmpty()) print(s);
+ }
+ while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa
+ .bbbbbbbbbbbbbbbbbbb()
+ .cccccccccccccccccccccc())
+ ddddddddddddddddddddd.eeeeeeeeeeeeeeeee()
+ .fffffffffffffffffffff();
+ do aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb()
+ .cccccccccccccccccccccccc();
+ while (ddddddddddddddddddddd
+ .eeeeeeeeeeeeeeeee()
+ .fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/F_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/F_out.java
new file mode 100644
index 0000000..ba6cb7f
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/F_out.java
@@ -0,0 +1,71 @@
+public class A {
+ void f() {
+ if (one != 1)
+ doSomething();
+
+ for (int i = 0; i < list.size(); i++)
+ list.get(i).print();
+
+ for (Printer printer : list)
+ printer.print(myDocument);
+
+ while (!queue.isEmpty())
+ consume(queue.remove());
+
+ do list.add(createElement());
+ while (list.size() < 100);
+
+ /* */while /* */ (condition)
+ /* */ doSomething();
+ /* */do/* */createElement();
+ /* */ while/* */ (condition);
+ /* */
+ /* */ for /* */ (String s : strings)
+ /* */ System.out.println(s);
+
+ while (!queue.isEmpty())
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++)
+ sum += i * j;
+ while (x-- > 0)
+ while (y-- > 0)
+ drawPoint(x, y);
+ do for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ while (!queue.isEmpty());
+
+ while (!queue.isEmpty()) {
+ for (String s : queue.remove())
+ if (!s.isEmpty())
+ print(s);
+ }
+ ;
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) {
+ sum += i * j;
+ }
+ while (x-- > 0) {
+ while (y-- > 0)
+ while (z-- > 0)
+ drawPoint(x, y, z);
+ }
+ do for (String s : queue.remove()) {
+ if (!s.isEmpty())
+ print(s);
+ }
+ while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccc())
+ ddddddddddddddddddddd
+ .eeeeeeeeeeeeeeeee()
+ .fffffffffffffffffffff();
+ do aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccccc();
+ while (ddddddddddddddddddddd
+ .eeeeeeeeeeeeeeeee()
+ .fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/G_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/G_out.java
new file mode 100644
index 0000000..e6f0e49
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/G_out.java
@@ -0,0 +1,76 @@
+public class A {
+ void f() {
+ if (one != 1) doSomething();
+
+ for (int i = 0; i < list
+ .size(); i++)
+ list.get(i).print();
+
+ for (Printer printer : list)
+ printer.print(myDocument);
+
+ while (!queue.isEmpty())
+ consume(queue.remove());
+
+ do list.add(createElement());
+ while (list.size() < 100);
+
+ /* */while /* */ (condition)
+ /* */ doSomething();
+ /* */do/* */createElement();
+ /* */ while/* */ (condition);
+ /* */
+ /* */ for /* */ (String s : strings)
+ /* */ System.out.println(s);
+
+ while (!queue.isEmpty())
+ for (String s : queue
+ .remove())
+ if (!s.isEmpty()) print(
+ s);
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++)
+ sum += i * j;
+ while (x-- > 0) while (y-- > 0)
+ drawPoint(x, y);
+ do for (String s : queue
+ .remove())
+ if (!s.isEmpty()) print(s);
+ while (!queue.isEmpty());
+
+ while (!queue.isEmpty()) {
+ for (String s : queue
+ .remove())
+ if (!s.isEmpty()) print(
+ s);
+ }
+ ;
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++) {
+ sum += i * j;
+ }
+ while (x-- > 0) {
+ while (y-- > 0)
+ while (z-- > 0)
+ drawPoint(x, y, z);
+ }
+ do for (String s : queue
+ .remove()) {
+ if (!s.isEmpty()) print(s);
+ }
+ while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa
+ .bbbbbbbbbbbbbbbbbbb()
+ .cccccccccccccccccccccc())
+ ddddddddddddddddddddd
+ .eeeeeeeeeeeeeeeee()
+ .fffffffffffffffffffff();
+ do aaaaaaaaaaaaaaaaaaaaaa
+ .bbbbbbbbbbbbbbbbbbb()
+ .cccccccccccccccccccccccc();
+ while (ddddddddddddddddddddd
+ .eeeeeeeeeeeeeeeee()
+ .fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/in.java
new file mode 100644
index 0000000..822d104
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test104910/in.java
@@ -0,0 +1,31 @@
+public class A {
+ void f() {
+ if(one != 1) doSomething();
+
+ for(int i = 0; i < list.size(); i++) list.get(i).print();
+
+ for(Printer printer : list) printer.print(myDocument);
+
+ while(!queue.isEmpty()) consume(queue.remove());
+
+ do list.add(createElement()); while (list.size() < 100);
+
+ /* */while /* */ (condition) /* */ doSomething();
+ /* */do/* */createElement();/* */while/* */(condition);
+ /* */
+ /* */ for /* */ (String s : strings) /* */ System.out.println(s);
+
+ while(!queue.isEmpty()) for (String s : queue.remove()) if (!s.isEmpty()) print(s);
+ for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) sum += i * j;
+ while(x --> 0) while (y --> 0) drawPoint(x,y);
+ do for (String s : queue.remove()) if (!s.isEmpty()) print(s); while (!queue.isEmpty());
+
+ while(!queue.isEmpty()) { for (String s : queue.remove()) if (!s.isEmpty()) print(s); };
+ for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) { sum += i * j; }
+ while(x --> 0) { while (y --> 0) while (z --> 0) drawPoint(x,y,z); }
+ do for (String s : queue.remove()) { if (!s.isEmpty()) print(s); } while (!queue.isEmpty());
+
+ while (aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccc()) ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff();
+ do aaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb().cccccccccccccccccccccccc(); while (ddddddddddddddddddddd.eeeeeeeeeeeeeeeee().fffffffffffffffffffff());
+ }
+}
diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
index 1e26efd..f652959 100644
--- a/org.eclipse.jdt.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.14.100.OTDT_r271_qualifier
+Bundle-Version: 3.15.0.OTDT_r271_qualifier
Bundle-Activator: org.eclipse.jdt.core.JavaCore
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
index 60efae1..93c217f 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -180,6 +180,17 @@
public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = JavaCore.PLUGIN_ID + ".formatter.alignment_for_compact_if"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option for alignment of compact loops
+ * - option id: "org.eclipse.jdt.core.formatter.alignment_for_compact_loops"
+ * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
+ * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
+ * </pre>
+ * @see #createAlignmentValue(boolean, int, int)
+ * @since 3.15
+ */
+ public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_LOOP = JavaCore.PLUGIN_ID + ".formatter.alignment_for_compact_loops"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option for alignment of conditional expression
* - option id: "org.eclipse.jdt.core.formatter.alignment_for_conditional_expression"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
@@ -3920,6 +3931,43 @@
/**
* <pre>
+ * FORMATTER / Option to keep a simple 'for' loop body on the same line
+ * - option id: "org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
+ * </pre>
+ * @see #TRUE
+ * @see #FALSE
+ * @since 3.15
+ */
+ public static final String FORMATTER_KEEP_SIMPLE_FOR_BODY_ON_SAME_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_simple_for_body_on_same_line";//$NON-NLS-1$
+ /**
+ * <pre>
+ * FORMATTER / Option to keep a simple 'while' loop body on the same line
+ * - option id: "org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
+ * </pre>
+ * @see #TRUE
+ * @see #FALSE
+ * @since 3.15
+ */
+ public static final String FORMATTER_KEEP_SIMPLE_WHILE_BODY_ON_SAME_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_simple_while_body_on_same_line";//$NON-NLS-1$
+ /**
+ * <pre>
+ * FORMATTER / Option to keep a simple 'do-while' loop body on the same line
+ * - option id: "org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
+ * </pre>
+ * @see #TRUE
+ * @see #FALSE
+ * @since 3.15
+ */
+ public static final String FORMATTER_KEEP_SIMPLE_DO_WHILE_BODY_ON_SAME_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_simple_do_while_body_on_same_line";//$NON-NLS-1$
+
+ /**
+ * <pre>
* FORMATTER / Option to specify the length of the page. Beyond this length, the formatter will try to split the code
* - option id: "org.eclipse.jdt.core.formatter.lineSplit"
* - possible values: "<n>", where n is zero or a positive integer
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
index b561fe0..2459187 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
@@ -127,6 +127,7 @@
public int alignment_for_assignment;
public int alignment_for_binary_expression;
public int alignment_for_compact_if;
+ public int alignment_for_compact_loop;
public int alignment_for_conditional_expression;
public int alignment_for_enum_constants;
public int alignment_for_expressions_in_array_initializer;
@@ -422,6 +423,9 @@
public boolean keep_empty_array_initializer_on_one_line;
public boolean keep_simple_if_on_one_line;
public boolean keep_then_statement_on_same_line;
+ public boolean keep_simple_for_body_on_same_line;
+ public boolean keep_simple_while_body_on_same_line;
+ public boolean keep_simple_do_while_body_on_same_line;
public boolean never_indent_block_comments_on_first_column;
public boolean never_indent_line_comments_on_first_column;
public int number_of_empty_lines_to_preserve;
@@ -466,6 +470,7 @@
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT, getAlignment(this.alignment_for_assignment));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION, getAlignment(this.alignment_for_binary_expression));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF, getAlignment(this.alignment_for_compact_if));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_LOOP, getAlignment(this.alignment_for_compact_loop));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION, getAlignment(this.alignment_for_conditional_expression));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS, getAlignment(this.alignment_for_enum_constants));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER, getAlignment(this.alignment_for_expressions_in_array_initializer));
@@ -745,6 +750,9 @@
options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, this.keep_empty_array_initializer_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE, this.keep_simple_if_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE, this.keep_then_statement_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_FOR_BODY_ON_SAME_LINE, this.keep_simple_for_body_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_WHILE_BODY_ON_SAME_LINE, this.keep_simple_while_body_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_DO_WHILE_BODY_ON_SAME_LINE, this.keep_simple_do_while_body_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_NEVER_INDENT_BLOCK_COMMENTS_ON_FIRST_COLUMN, this.never_indent_block_comments_on_first_column ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN, this.never_indent_line_comments_on_first_column ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, Integer.toString(this.number_of_empty_lines_to_preserve));
@@ -876,6 +884,10 @@
this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
}
}
+ final Object alignmentForCompactLoopOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_LOOP);
+ if (alignmentForCompactLoopOption != null)
+ this.alignment_for_compact_loop = toInt(alignmentForCompactLoopOption, Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE);
+
final Object alignmentForConditionalExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
if (alignmentForConditionalExpressionOption != null) {
try {
@@ -2205,6 +2217,18 @@
if (keepThenStatementOnSameLineOption != null) {
this.keep_then_statement_on_same_line = DefaultCodeFormatterConstants.TRUE.equals(keepThenStatementOnSameLineOption);
}
+ final Object keepSimpleForBodyOnSameLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_FOR_BODY_ON_SAME_LINE);
+ if (keepSimpleForBodyOnSameLineOption != null) {
+ this.keep_simple_for_body_on_same_line = DefaultCodeFormatterConstants.TRUE.equals(keepSimpleForBodyOnSameLineOption);
+ }
+ final Object keepSimpleWhileBodyOnSameLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_WHILE_BODY_ON_SAME_LINE);
+ if (keepSimpleWhileBodyOnSameLineOption != null) {
+ this.keep_simple_while_body_on_same_line = DefaultCodeFormatterConstants.TRUE.equals(keepSimpleWhileBodyOnSameLineOption);
+ }
+ final Object keepSimpleDoWhileBodyOnSameLineOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_DO_WHILE_BODY_ON_SAME_LINE);
+ if (keepSimpleDoWhileBodyOnSameLineOption != null) {
+ this.keep_simple_do_while_body_on_same_line = DefaultCodeFormatterConstants.TRUE.equals(keepSimpleDoWhileBodyOnSameLineOption);
+ }
final Object neverIndentBlockCommentOnFirstColumnOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_NEVER_INDENT_BLOCK_COMMENTS_ON_FIRST_COLUMN);
if (neverIndentBlockCommentOnFirstColumnOption != null) {
this.never_indent_block_comments_on_first_column = DefaultCodeFormatterConstants.TRUE.equals(neverIndentBlockCommentOnFirstColumnOption);
@@ -2460,6 +2484,7 @@
this.alignment_for_assignment = Alignment.M_NO_ALIGNMENT;
this.alignment_for_binary_expression = Alignment.M_COMPACT_SPLIT;
this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
+ this.alignment_for_compact_loop = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
this.alignment_for_conditional_expression = Alignment.M_ONE_PER_LINE_SPLIT;
this.alignment_for_enum_constants = Alignment.M_NO_ALIGNMENT;
this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
@@ -2737,6 +2762,9 @@
this.keep_empty_array_initializer_on_one_line = false;
this.keep_simple_if_on_one_line = false;
this.keep_then_statement_on_same_line = false;
+ this.keep_simple_for_body_on_same_line = false;
+ this.keep_simple_while_body_on_same_line = false;
+ this.keep_simple_do_while_body_on_same_line = false;
this.never_indent_block_comments_on_first_column = false;
this.never_indent_line_comments_on_first_column = false;
this.number_of_empty_lines_to_preserve = 1;
@@ -2777,6 +2805,7 @@
this.alignment_for_assignment = Alignment.M_NO_ALIGNMENT;
this.alignment_for_binary_expression = Alignment.M_COMPACT_SPLIT;
this.alignment_for_compact_if = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_compact_loop = Alignment.M_COMPACT_SPLIT;
this.alignment_for_conditional_expression = Alignment.M_NEXT_PER_LINE_SPLIT;
this.alignment_for_enum_constants = Alignment.M_COMPACT_SPLIT;
this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
@@ -3054,6 +3083,9 @@
this.keep_empty_array_initializer_on_one_line = false;
this.keep_simple_if_on_one_line = false;
this.keep_then_statement_on_same_line = false;
+ this.keep_simple_for_body_on_same_line = false;
+ this.keep_simple_while_body_on_same_line = false;
+ this.keep_simple_do_while_body_on_same_line = false;
this.never_indent_block_comments_on_first_column = false;
this.never_indent_line_comments_on_first_column = false;
this.number_of_empty_lines_to_preserve = 1;
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
index e86b6fb..41547ee 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2015 Mateusz Matela and others.
+ * Copyright (c) 2014, 2018 Mateusz Matela and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -390,9 +390,11 @@
@Override
public boolean visit(DoStatement node) {
Statement body = node.getBody();
- handleLoopBody(body);
+ boolean sameLine = this.options.keep_simple_do_while_body_on_same_line;
+ if (!sameLine)
+ handleLoopBody(body);
if (this.options.insert_new_line_before_while_in_do_statement
- || (!(body instanceof Block) && !(body instanceof EmptyStatement))) {
+ || (!(body instanceof Block) && !(body instanceof EmptyStatement) && !sameLine)) {
Token whileToken = this.tm.firstTokenBefore(node.getExpression(), TokenNamewhile);
whileToken.breakBefore();
}
@@ -556,7 +558,8 @@
@Override
public boolean visit(WhileStatement node) {
- handleLoopBody(node.getBody());
+ if (!this.options.keep_simple_while_body_on_same_line)
+ handleLoopBody(node.getBody());
int lParen = this.tm.firstIndexIn(node, TokenNameLPAREN);
int rParen = this.tm.firstIndexAfter(node.getExpression(), TokenNameRPAREN);
@@ -566,7 +569,8 @@
@Override
public boolean visit(ForStatement node) {
- handleLoopBody(node.getBody());
+ if (!this.options.keep_simple_for_body_on_same_line)
+ handleLoopBody(node.getBody());
int lParen = this.tm.firstIndexIn(node, TokenNameLPAREN);
int rParen = this.tm.firstIndexBefore(node.getBody(), TokenNameRPAREN);
@@ -576,7 +580,8 @@
@Override
public boolean visit(EnhancedForStatement node) {
- handleLoopBody(node.getBody());
+ if (!this.options.keep_simple_for_body_on_same_line)
+ handleLoopBody(node.getBody());
int lParen = this.tm.firstIndexIn(node, TokenNameLPAREN);
int rParen = this.tm.firstIndexBefore(node.getBody(), TokenNameRPAREN);
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
index 8b7308d..fbf400e 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2016 Mateusz Matela and others.
+ * Copyright (c) 2014, 2018 Mateusz Matela and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,6 +41,7 @@
import org.eclipse.jdt.core.dom.CreationReference;
import org.eclipse.jdt.core.dom.Dimension;
import org.eclipse.jdt.core.dom.DoStatement;
+import org.eclipse.jdt.core.dom.EmptyStatement;
import org.eclipse.jdt.core.dom.EnhancedForStatement;
import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
import org.eclipse.jdt.core.dom.EnumDeclaration;
@@ -371,6 +372,7 @@
this.options.insert_space_after_opening_paren_in_while);
handleTokenBefore(node.getBody(), TokenNameRPAREN, this.options.insert_space_before_closing_paren_in_while,
false);
+ handleLoopBody(node.getBody());
return true;
}
@@ -572,16 +574,14 @@
this.options.insert_space_after_opening_paren_in_if);
Statement thenStatement = node.getThenStatement();
- int closingParenIndex = this.tm.firstIndexBefore(thenStatement, TokenNameRPAREN);
- handleToken(this.tm.get(closingParenIndex), this.options.insert_space_before_closing_paren_in_if,
- /* space before then statement may be needed if it will stay on the same line */
- !(thenStatement instanceof Block) && !this.tm.get(closingParenIndex + 1).isComment());
+ handleTokenBefore(thenStatement, TokenNameRPAREN, this.options.insert_space_before_closing_paren_in_if, false);
if (thenStatement instanceof Block && this.tm.isGuardClause((Block) thenStatement)) {
handleToken(thenStatement, TokenNameLBRACE, false, true);
this.tm.lastTokenIn(node, TokenNameRBRACE).spaceBefore();
}
+ handleLoopBody(thenStatement);
handleSemicolon(thenStatement);
return true;
}
@@ -605,6 +605,8 @@
handleTokenBefore(node.getBody(), TokenNameSEMICOLON,
this.options.insert_space_before_semicolon_in_for && !part2Empty,
this.options.insert_space_after_semicolon_in_for && !part3Empty);
+
+ handleLoopBody(node.getBody());
return true;
}
@@ -630,6 +632,7 @@
this.options.insert_space_before_closing_paren_in_for, false);
handleTokenAfter(node.getParameter(), TokenNameCOLON, this.options.insert_space_before_colon_in_for,
this.options.insert_space_after_colon_in_for);
+ handleLoopBody(node.getBody());
return true;
}
@@ -1152,6 +1155,15 @@
}
}
+ private void handleLoopBody(Statement loopBody) {
+ /* space before body statement may be needed if it will stay on the same line */
+ int firstTokenIndex = this.tm.firstIndexIn(loopBody, -1);
+ if (!(loopBody instanceof Block) && !(loopBody instanceof EmptyStatement)
+ && !this.tm.get(firstTokenIndex - 1).isComment()) {
+ this.tm.get(firstTokenIndex).spaceBefore();
+ }
+ }
+
public void finishUp() {
this.tm.traverse(0, new TokenTraverser() {
boolean isPreviousJIDP = false;
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
index 011b8cc..6ccf535 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
@@ -652,7 +652,8 @@
if (policy.indentOnColumn) {
wrapIndent = this.tm.getPositionInLine(policy.wrapParentIndex);
wrapIndent += this.tm.getLength(wrapParent, wrapIndent);
- if (wrapParent.isSpaceAfter() || this.tm.get(policy.wrapParentIndex + 1).isSpaceBefore())
+ Token next = this.tm.get(policy.wrapParentIndex + 1);
+ if (wrapParent.isSpaceAfter() || (next.isSpaceBefore() && !next.isComment()))
wrapIndent++;
}
wrapIndent += policy.extraIndent;
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
index 536675f..4e1c2f0 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
@@ -37,6 +37,7 @@
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamethis;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamethrows;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameto;
+import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamewhile;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamewith;
import java.util.ArrayList;
@@ -58,6 +59,8 @@
import org.eclipse.jdt.core.dom.ConditionalExpression;
import org.eclipse.jdt.core.dom.ConstructorInvocation;
import org.eclipse.jdt.core.dom.CreationReference;
+import org.eclipse.jdt.core.dom.DoStatement;
+import org.eclipse.jdt.core.dom.EnhancedForStatement;
import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.ExportsDirective;
@@ -97,6 +100,7 @@
import org.eclipse.jdt.core.dom.VariableDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.jdt.core.dom.WhileStatement;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions.Alignment;
@@ -651,27 +655,10 @@
@Override
public boolean visit(IfStatement node) {
- Statement thenStatement = node.getThenStatement();
- Statement elseStatement = node.getElseStatement();
- if (!(thenStatement instanceof Block)) {
- boolean keepThenOnSameLine = this.options.keep_then_statement_on_same_line
- || (this.options.keep_simple_if_on_one_line && elseStatement == null);
- if (keepThenOnSameLine) {
- this.wrapIndexes.add(this.tm.firstIndexIn(thenStatement, -1));
- this.wrapParentIndex = this.tm.firstIndexAfter(node.getExpression(), TokenNameRPAREN);
- this.wrapGroupEnd = this.tm.lastIndexIn(thenStatement, -1);
- handleWrap(this.options.alignment_for_compact_if, node);
- }
- }
- if (elseStatement != null && !(elseStatement instanceof Block) && !(elseStatement instanceof IfStatement)) {
- if (this.options.keep_else_statement_on_same_line) {
- int elseIndex = this.tm.firstIndexIn(elseStatement, -1);
- this.wrapIndexes.add(elseIndex);
- this.wrapParentIndex = this.tm.firstIndexAfter(node.getExpression(), TokenNameRPAREN);
- this.wrapGroupEnd = this.tm.lastIndexIn(elseStatement, -1);
- handleWrap(this.options.alignment_for_compact_if, node);
- }
- }
+ boolean keepThenOnSameLine = this.options.keep_then_statement_on_same_line
+ || (this.options.keep_simple_if_on_one_line && node.getElseStatement() == null);
+ if (keepThenOnSameLine)
+ handleSimpleLoop(node.getThenStatement(), this.options.alignment_for_compact_if);
return true;
}
@@ -688,12 +675,63 @@
if (!this.wrapIndexes.isEmpty()) {
this.wrapParentIndex = this.tm.firstIndexIn(node, TokenNameLPAREN);
this.wrapGroupEnd = this.tm.firstIndexBefore(node.getBody(), TokenNameRPAREN);
- handleWrap(this.options.alignment_for_expressions_in_for_loop_header, node);
+ handleWrap(this.options.alignment_for_expressions_in_for_loop_header);
}
+ if (this.options.keep_simple_for_body_on_same_line)
+ handleSimpleLoop(node.getBody(), this.options.alignment_for_compact_loop);
return true;
}
@Override
+ public boolean visit(EnhancedForStatement node) {
+ if (this.options.keep_simple_for_body_on_same_line)
+ handleSimpleLoop(node.getBody(), this.options.alignment_for_compact_loop);
+ return true;
+ }
+
+ @Override
+ public boolean visit(WhileStatement node) {
+ if (this.options.keep_simple_while_body_on_same_line)
+ handleSimpleLoop(node.getBody(), this.options.alignment_for_compact_loop);
+ return true;
+ }
+
+ private void handleSimpleLoop(Statement body, int wrappingOption) {
+ if (!(body instanceof Block)) {
+ this.wrapIndexes.add(this.tm.firstIndexIn(body, -1));
+ this.wrapParentIndex = this.tm.firstIndexBefore(body, TokenNameRPAREN);
+ this.wrapGroupEnd = this.tm.lastIndexIn(body, -1);
+ handleWrap(wrappingOption, body.getParent());
+
+ body.accept(new ASTVisitor() {
+ @Override
+ public boolean visit(Block node) {
+ forceContinuousWrapping(node, WrapPreparator.this.tm.firstIndexIn(node, -1));
+ return false;
+ }
+ });
+ }
+ }
+
+ @Override
+ public void endVisit(DoStatement node) {
+ if (this.options.keep_simple_do_while_body_on_same_line && !(node.getBody() instanceof Block)) {
+ int whileIndex = this.tm.firstIndexAfter(node.getBody(), TokenNamewhile);
+ this.wrapIndexes.add(whileIndex);
+ this.wrapParentIndex = this.tm.lastIndexIn(node.getBody(), -1);
+ this.wrapGroupEnd = this.tm.lastIndexIn(node, -1);
+
+ int alignment = this.options.alignment_for_compact_loop;
+ for (int i = this.tm.firstIndexIn(node, -1) + 1; i < whileIndex; i++) {
+ Token token = this.tm.get(i);
+ if (token.getLineBreaksBefore() > 0 || token.getLineBreaksAfter() > 0)
+ alignment |= Alignment.M_FORCE;
+ }
+ handleWrap(alignment, node);
+ }
+ }
+
+ @Override
public boolean visit(TryStatement node) {
prepareElementsList(node.resources(), TokenNameSEMICOLON, TokenNameLPAREN);
handleWrap(this.options.alignment_for_resources_in_try);
@@ -854,7 +892,7 @@
* Makes sure all new lines within given node will have wrap policy so that
* wrap executor will fix their indentation if necessary.
*/
- private void forceContinuousWrapping(ASTNode node, int parentIndex) {
+ void forceContinuousWrapping(ASTNode node, int parentIndex) {
int parentIndent = this.tm.get(parentIndex).getIndent();
int indentChange = -parentIndent;
int lineStart = this.tm.findFirstTokenInLine(parentIndex);
@@ -1017,9 +1055,13 @@
if (!this.options.indent_body_declarations_compare_to_enum_declaration_header)
extraIndent--;
isAlreadyWrapped = isFirst;
- } else if (parentNode instanceof IfStatement) {
+ } else if (parentNode instanceof IfStatement || parentNode instanceof ForStatement
+ || parentNode instanceof EnhancedForStatement || parentNode instanceof WhileStatement) {
extraIndent = 1;
this.wrapParentIndex = this.tm.firstIndexIn(parentNode, -1); // only if !indoentOnColumn
+ } else if (parentNode instanceof DoStatement) {
+ extraIndent = 0;
+ this.wrapParentIndex = this.tm.firstIndexIn(parentNode, -1); // only if !indoentOnColumn
} else if ((wrappingOption & Alignment.M_INDENT_BY_ONE) != 0) {
extraIndent = 1;
} else if (parentNode instanceof ArrayInitializer) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java
index 5629858..7c38d53 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java
@@ -617,7 +617,7 @@
* In the latter case the corresponding module description of the
* location referenced by that classpath entry is returned.
*
- * @return the <code>IModuleDescription</code> this project represents.
+ * @return the <code>IModule</code> this project represents.
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource
* @since 3.14
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
index 81024a3..51e60cf 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -29,6 +29,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -385,6 +386,27 @@
return this;
}
+
+ public ClasspathEntry withExtraAttributeRemoved(String attrName) {
+ IClasspathAttribute[] changedAttributes = Arrays.stream(this.getExtraAttributes())
+ .filter(a -> !a.getName().equals(attrName)).toArray(IClasspathAttribute[]::new);
+ return new ClasspathEntry(
+ this.getContentKind(),
+ this.getEntryKind(),
+ this.getPath(),
+ this.getInclusionPatterns(),
+ this.getExclusionPatterns(),
+ this.getSourceAttachmentPath(),
+ this.getSourceAttachmentRootPath(),
+ this.getOutputLocation(),
+ this.getReferencingEntry(),
+ this.isExported(),
+ this.getAccessRules(),
+ this.combineAccessRules(),
+ changedAttributes);
+ }
+
+
private IAccessRule[] combine(IAccessRule[] referringRules, IAccessRule[] rules, boolean combine) {
if (!combine) return rules;
if (rules == null || rules.length == 0) return referringRules;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
index d49b14f..c9b93e1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -528,14 +528,8 @@
*/
private void computeExpandedClasspath(
ClasspathEntry referringEntry,
- HashSet rootIDs,
- ObjectVector accumulatedEntries, boolean excludeTestCode) throws JavaModelException {
-
- String projectRootId = rootID();
- if (rootIDs.contains(projectRootId)){
- return; // break cycles if any
- }
- rootIDs.add(projectRootId);
+ HashMap<String, Boolean> rootIDs,
+ ArrayList<ClasspathEntry> accumulatedEntries, boolean excludeTestCode) throws JavaModelException {
IClasspathEntry[] resolvedClasspath = getResolvedClasspath();
@@ -548,69 +542,58 @@
}
if (isInitialProject || entry.isExported()){
String rootID = entry.rootID();
- if (rootIDs.contains(rootID)) {
- continue;
- }
- // combine restrictions along the project chain
- ClasspathEntry combinedEntry = entry.combineWith(referringEntry);
- accumulatedEntries.add(combinedEntry);
// recurse in project to get all its indirect exports (only consider exported entries from there on)
if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
+ boolean nestedWithoutTestCode = excludeTestCode || entry.isWithoutTestCode();
+ Boolean previousValue = rootIDs.get(rootID);
+ ClasspathEntry combinedEntry;
+ if (previousValue == Boolean.FALSE) {
+ continue; // already handled including test code
+ } else if (previousValue == Boolean.TRUE) {
+ // project was already handled, but without test code.
+ if (nestedWithoutTestCode) {
+ continue;
+ } else {
+ // find the existing entry and update it.
+ rootIDs.put(rootID, Boolean.FALSE);
+ for (int j = 0; j < accumulatedEntries.size(); j++) {
+ // it is unclear how oldEntry and combinedEntry could be merged.
+ // main code compilation should remain untouched as far as possible,
+ // so take all settings from oldEntry and just remove WITHOUT_TEST_CODE
+ ClasspathEntry oldEntry = accumulatedEntries.get(j);
+ if (oldEntry.rootID().equals(rootID)) {
+ accumulatedEntries.set(j, oldEntry.withExtraAttributeRemoved(IClasspathAttribute.WITHOUT_TEST_CODE));
+ break;
+ }
+ }
+ // combine restrictions along the project chain
+ combinedEntry = entry.combineWith(referringEntry);
+ }
+ } else {
+ rootIDs.put(rootID, nestedWithoutTestCode);
+ // combine restrictions along the project chain
+ combinedEntry = entry.combineWith(referringEntry);
+ accumulatedEntries.add(combinedEntry);
+ }
IResource member = workspaceRoot.findMember(entry.getPath());
if (member != null && member.getType() == IResource.PROJECT){ // double check if bound to project (23977)
IProject projRsc = (IProject) member;
if (JavaProject.hasJavaNature(projRsc)) {
JavaProject javaProject = (JavaProject) JavaCore.create(projRsc);
- javaProject.computeExpandedClasspath(
- combinedEntry,
- rootIDs,
- accumulatedEntries, excludeTestCode || entry.isWithoutTestCode());
+ javaProject.computeExpandedClasspath(
+ combinedEntry,
+ rootIDs,
+ accumulatedEntries, nestedWithoutTestCode);
}
}
} else {
- rootIDs.add(rootID);
- }
- } else {
- if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
- computeExpandedClasspathFromModularProject(rootIDs, accumulatedEntries, excludeTestCode, workspaceRoot);
- }
- }
- }
- }
-
- private void computeExpandedClasspathFromModularProject(HashSet rootIDs,
- ObjectVector accumulatedEntries, boolean excludeTestCode, IWorkspaceRoot workspaceRoot)
- throws JavaModelException {
- IModuleDescription referring = this.getModuleDescription();
- if (referring == null)
- return;
- IClasspathEntry[] resolvedClasspath = getResolvedClasspath();
- for (IClasspathEntry iEntry : resolvedClasspath) {
- ClasspathEntry entry = (ClasspathEntry) iEntry;
- if (iEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT && entry.isModular()) {
- String rootID = entry.rootID();
- if (rootIDs.contains(rootID)) {
- continue;
- }
- rootIDs.add(rootID);
- IModuleDescription referred = null;
- IResource member = workspaceRoot.findMember(iEntry.getPath());
- JavaProject referredProject = null;
- if (member != null && member.getType() == IResource.PROJECT) {
- IProject projRsc = (IProject) member;
- referredProject = (JavaProject) JavaCore.create(projRsc);
- referred = referredProject.getModuleDescription();
- if (referred != null) {
- IModule module = NameLookup.getModuleDescriptionInfo(referring);
- IModuleReference[] requires = module.requires();
- for (IModuleReference req : requires) {
- if (CharOperation.equals(req.name(), referred.getElementName().toCharArray())) {
- accumulatedEntries.add(entry);
- }
- }
+ if (!rootIDs.containsKey(rootID)) {
+ // combine restrictions along the project chain
+ ClasspathEntry combinedEntry = entry.combineWith(referringEntry);
+ accumulatedEntries.add(combinedEntry);
+ rootIDs.put(rootID, excludeTestCode); // value actually doesn't matter for non-projects
}
- referredProject.computeExpandedClasspathFromModularProject(rootIDs, accumulatedEntries, excludeTestCode, workspaceRoot);
}
}
}
@@ -2003,11 +1986,13 @@
}
public IClasspathEntry[] getExpandedClasspath(boolean excludeTestCode) throws JavaModelException {
- ObjectVector accumulatedEntries = new ObjectVector();
- computeExpandedClasspath(null, new HashSet(5), accumulatedEntries, excludeTestCode);
+ ArrayList<ClasspathEntry> accumulatedEntries = new ArrayList<>();
+ HashMap<String,Boolean> rootIDs = new HashMap<>(5);
+ rootIDs.put(this.rootID(), excludeTestCode);
+ computeExpandedClasspath(null, rootIDs, accumulatedEntries, excludeTestCode);
IClasspathEntry[] expandedPath = new IClasspathEntry[accumulatedEntries.size()];
- accumulatedEntries.copyInto(expandedPath);
+ accumulatedEntries.toArray(expandedPath);
return expandedPath;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java
index 42e06ad..5de9cf4 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java
@@ -11,6 +11,7 @@
package org.eclipse.jdt.internal.core.builder;
import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
@@ -67,6 +68,35 @@
return Util.isExcluded(resource, this.inclusionPatterns, this.exclusionPatterns);
return false;
}
+@Override
+String[] directoryList(String qualifiedPackageName) {
+ String[] dirList = (String[]) this.directoryCache.get(qualifiedPackageName);
+ if (dirList != null) return dirList;
+
+ try {
+ IResource container = this.binaryFolder.findMember(qualifiedPackageName); // this is a case-sensitive check
+ if (container instanceof IContainer) {
+ IResource[] members = ((IContainer) container).members();
+ dirList = new String[members.length];
+ int index = 0;
+ for (int i = 0, l = members.length; i < l; i++) {
+ IResource m = members[i];
+ String name = m.getName();
+ if (m.getType() == IResource.FILE && org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(name)) {
+ // add exclusion pattern check here if we want to hide .class files
+ dirList[index++] = name;
+ }
+ }
+ if (index < dirList.length)
+ System.arraycopy(dirList, 0, dirList = new String[index], 0, index);
+ this.directoryCache.put(qualifiedPackageName, dirList);
+ return dirList;
+ }
+ } catch(CoreException ignored) {
+ // ignore
+ }
+ return null;
+}
@Override
public String toString() {
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index 10fad74..f44c277 100644
--- a/org.eclipse.jdt.core/pom.xml
+++ b/org.eclipse.jdt.core/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2016 Eclipse Foundation and others.
+ Copyright (c) 2012, 2018 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
- <version>3.14.100-SNAPSHOT</version>
+ <version>3.15.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java
index e7ba69d..8297215 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java
@@ -59,6 +59,7 @@
// start of try-block:
InsnList newInstructions = new InsnList();
+
LabelNode start = new LabelNode();
newInstructions.add(start);
Type[] args = Type.getArgumentTypes(method.desc);
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java
index 86cc1c0..f6b0279 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java
@@ -19,6 +19,7 @@
import org.eclipse.objectteams.otredyn.transformer.names.ConstantMembers;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
+import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LabelNode;
@@ -47,6 +48,11 @@
}
@Override
+ protected void addPreSwitchInstructions(MethodNode method) {
+ super.addPreSwitchInstructions(method);
+ }
+
+ @Override
protected void addInstructionForDefaultLabel(MethodNode method) {
gotoLabel = new LabelNode();
method.instructions.add(new JumpInsnNode(Opcodes.GOTO, gotoLabel));
diff --git a/releng/map/otdt.map.in b/releng/map/otdt.map.in
index 13480fd..cc4b870 100644
--- a/releng/map/otdt.map.in
+++ b/releng/map/otdt.map.in
@@ -9,7 +9,7 @@
feature@org.eclipse.objectteams.otequinox.turbo=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=features/org.eclipse.objectteams.otequinox.turbo.feature,tag=builds/201506091717
!-- Also don't use version numbers for those plugins that hold the various otre jars: --
-plugin@org.eclipse.jdt.core,3.14.100.OTDT_r271_qualifier=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=org.eclipse.jdt.core
+plugin@org.eclipse.jdt.core,3.15.0.OTDT_r271_qualifier=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=org.eclipse.jdt.core
!next plug-in don't specify version so that org.eclipse.objectteams.runtime/customBuildCallbacks.xml will find the plug-in directory:
plugin@org.eclipse.objectteams.otdt=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt,tag=builds/201806120901