update jdt.core to S4_15_0_RC2
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
index d19a622..ab82756 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
@@ -28,6 +28,7 @@
import junit.framework.Test;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.JavacTestOptions.Excuse;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -18085,7 +18086,9 @@
runner.runConformTest();
}
public void testBug560310() {
- runConformTestWithLibs(
+ Runner runner = new Runner();
+ runner.customOptions = getCompilerOptions();
+ runner.testFiles =
new String[] {
"confusing/Confusing.java",
"package confusing;\n" +
@@ -18106,17 +18109,22 @@
" }\n" +
" }\n" +
"}\n"
- },
- getCompilerOptions(),
+ };
+ runner.classLibraries = this.LIBS;
+ runner.javacTestOptions = Excuse.EclipseHasSomeMoreWarnings;
+ runner.expectedCompilerLog =
"----------\n" +
"1. INFO in confusing\\Confusing.java (at line 15)\n" +
" unannotated(list);\n" +
" ^^^^\n" +
"Unsafe null type conversion (type annotations): The value of type \'ArrayList<@NonNull String>\' is made accessible using the less-annotated type \'ArrayList<String>\'\n" +
- "----------\n");
+ "----------\n";
+ runner.runWarningTest();
}
public void testBug560310try_finally() {
- runConformTestWithLibs(
+ Runner runner = new Runner();
+ runner.customOptions = getCompilerOptions();
+ runner.testFiles =
new String[] {
"confusing/Confusing.java",
"package confusing;\n" +
@@ -18139,8 +18147,10 @@
" }\n" +
" }\n" +
"}\n"
- },
- getCompilerOptions(),
+ };
+ runner.classLibraries = this.LIBS;
+ runner.javacTestOptions = Excuse.EclipseHasSomeMoreWarnings;
+ runner.expectedCompilerLog =
"----------\n" +
"1. INFO in confusing\\Confusing.java (at line 15)\n" +
" unannotated(list);\n" +
@@ -18151,6 +18161,7 @@
" unannotated(list);\n" +
" ^^^^\n" +
"Unsafe null type conversion (type annotations): The value of type \'ArrayList<@NonNull String>\' is made accessible using the less-annotated type \'ArrayList<String>\'\n" +
- "----------\n");
+ "----------\n";
+ runner.runWarningTest();
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
index 9222fb7..d28869f 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
@@ -5885,6 +5885,23 @@
"",
options);
}
+public void testBug560460() {
+ if (this.complianceLevel < ClassFileConstants.JDK1_7) return; // uses try-with-resources
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "import java.util.*;\n" +
+ "public class X {\n" +
+ " Scanner m(String source) {\n" +
+ " return new Scanner(source).useDelimiter(\"foobar\");\n" +
+ " }\n" +
+ "}\n"
+ },
+ options);
+}
public void testBug463320_comment19() {
Map options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
index 8c98176..74f08d4 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 IBM Corporation and others.
+ * Copyright (c) 2019, 2020 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
@@ -48,6 +48,9 @@
defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
return defaultOptions;
}
+ protected void runConformTestWithJavac(String[] testFiles, String expectedOutput) {
+ runConformTest(testFiles, expectedOutput, getCompilerOptions(), new String[] {"--enable-preview"});
+ }
@Override
protected void runConformTest(String[] testFiles, String expectedOutput) {
@@ -3540,4 +3543,141 @@
},
"0");
}
-}
\ No newline at end of file
+ public void testConversion1() {
+ runConformTestWithJavac(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int i = 0;\n" +
+ " private static String typeName(byte arg){ return \"byte\"; }\n" +
+ " private static String typeName(char arg){ return \"char\"; }\n" +
+ " private static String typeName(short arg){ return \"short\"; }\n" +
+ " private static String typeName(int arg){ return \"int\"; }\n" +
+ " private static String typeName(float arg){ return \"float\"; }\n" +
+ " private static String typeName(long arg){ return \"long\"; }\n" +
+ " private static String typeName(double arg){ return \"double\"; }\n" +
+ " private static String typeName(String arg){ return \"String\"; }\n" +
+ " public static void main(String[] args) {\n" +
+ " byte v1 = (byte)0;\n" +
+ " char v2 = ' ';\n" +
+ " var v = switch(i+1){\n" +
+ " case 1 -> v2;\n" +
+ " case 5 -> v1;\n" +
+ " default -> v2;\n" +
+ " };\n" +
+ " System.out.print(typeName(v));\n" +
+ " }\n" +
+ "}\n"
+ },
+ "int");
+ }
+ public void testConversion2() {
+ runConformTestWithJavac(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int i = 0;\n" +
+ " private static String typeName(byte arg){ return \"byte\"; }\n" +
+ " private static String typeName(char arg){ return \"char\"; }\n" +
+ " private static String typeName(short arg){ return \"short\"; }\n" +
+ " private static String typeName(int arg){ return \"int\"; }\n" +
+ " private static String typeName(float arg){ return \"float\"; }\n" +
+ " private static String typeName(long arg){ return \"long\"; }\n" +
+ " private static String typeName(double arg){ return \"double\"; }\n" +
+ " private static String typeName(String arg){ return \"String\"; }\n" +
+ " public static void main(String[] args) {\n" +
+ " long v1 = 0L;\n" +
+ " double v2 = 0.;\n" +
+ " var v = switch(i+1){\n" +
+ " case 1 -> v2;\n" +
+ " case 5 -> v1;\n" +
+ " default -> v2;\n" +
+ " };\n" +
+ " System.out.print(typeName(v));\n" +
+ " }\n" +
+ "}\n"
+ },
+ "double");
+ }
+ public void testConversion3() {
+ runConformTestWithJavac(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int i = 0;\n" +
+ " private static String typeName(byte arg){ return \"byte\"; }\n" +
+ " private static String typeName(char arg){ return \"char\"; }\n" +
+ " private static String typeName(short arg){ return \"short\"; }\n" +
+ " private static String typeName(int arg){ return \"int\"; }\n" +
+ " private static String typeName(float arg){ return \"float\"; }\n" +
+ " private static String typeName(long arg){ return \"long\"; }\n" +
+ " private static String typeName(double arg){ return \"double\"; }\n" +
+ " private static String typeName(String arg){ return \"String\"; }\n" +
+ " public static void main(String[] args) {\n" +
+ " long v1 = 0L;\n" +
+ " float v2 = 0.f;\n" +
+ " var v = switch(i+1){\n" +
+ " case 1 -> v2;\n" +
+ " case 5 -> v1;\n" +
+ " default -> v2;\n" +
+ " };\n" +
+ " System.out.print(typeName(v));\n" +
+ " }\n" +
+ "}\n"
+ },
+ "float");
+ }
+ public void testConversion4() {
+ runConformTestWithJavac(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int i = 0;\n" +
+ " private static String typeName(byte arg){ return \"byte\"; }\n" +
+ " private static String typeName(char arg){ return \"char\"; }\n" +
+ " private static String typeName(short arg){ return \"short\"; }\n" +
+ " private static String typeName(int arg){ return \"int\"; }\n" +
+ " private static String typeName(float arg){ return \"float\"; }\n" +
+ " private static String typeName(long arg){ return \"long\"; }\n" +
+ " private static String typeName(double arg){ return \"double\"; }\n" +
+ " private static String typeName(String arg){ return \"String\"; }\n" +
+ " public static void main(String[] args) {\n" +
+ " short v1 = 0;\n" +
+ " char v2 = ' ';\n" +
+ " var v = switch(i+1){\n" +
+ " case 1 -> v2;\n" +
+ " case 5 -> v1;\n" +
+ " default -> v2;\n" +
+ " };\n" +
+ " System.out.print(typeName(v));\n" +
+ " }\n" +
+ "}\n"
+ },
+ "int");
+ }
+ public void testConversion5() {
+ runConformTestWithJavac(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int i = 0;\n" +
+ " private static String typeName(char arg){ return \"char\"; }\n" +
+ " private static String typeName(int arg){ return \"int\"; }\n" +
+ " private static String typeName(float arg){ return \"float\"; }\n" +
+ " private static String typeName(long arg){ return \"long\"; }\n" +
+ " private static String typeName(double arg){ return \"double\"; }\n" +
+ " private static String typeName(String arg){ return \"String\"; }\n" +
+ " public static void main(String[] args) {\n" +
+ " char v1 = 'a';\n" +
+ " var v = switch(i+1){\n" +
+ " case 1 -> 200;\n" +
+ " case 5 -> v1;\n" +
+ " default -> v1;\n" +
+ " };\n" +
+ " System.out.print(typeName(v));\n" +
+ " }\n" +
+ "}\n"
+ },
+ "char");
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java
index 679e6a0..5a41713 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1920,6 +1920,32 @@
deleteFile("/P/src/X.java");
}
}
+@SuppressWarnings("deprecation")
+public void testBug543073_001() throws CoreException {
+ try {
+ this.createFile(
+ "/P/src/X.java",
+ "public enum X {\n" +
+ " Z, A, C, B;\n" +
+ "}"
+ );
+ String expectedResult =
+ "public enum X {\n" +
+ " Z, A, C, B;\n" +
+ "}";
+ sortUnit(AST_INTERNAL_JLS10, this.getCompilationUnit("/P/src/X.java"), expectedResult, false, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ BodyDeclaration bodyDeclaration1 = (BodyDeclaration) o1;
+ BodyDeclaration bodyDeclaration2 = (BodyDeclaration) o2;
+ final int sourceStart1 = ((Integer) bodyDeclaration1.getProperty(CompilationUnitSorter.RELATIVE_ORDER)).intValue();
+ final int sourceStart2 = ((Integer) bodyDeclaration2.getProperty(CompilationUnitSorter.RELATIVE_ORDER)).intValue();
+ return sourceStart1 - sourceStart2;
+ }
+ });
+ } finally {
+ deleteFile("/P/src/X.java");
+ }
+}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=113722
public void test030() throws CoreException {
try {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
index b524448..2a11bb0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2018, 2019 IBM Corporation and others.
+ * Copyright (c) 2018, 2020 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
@@ -57,7 +57,7 @@
static {
type_map = new HashMap<TypeBinding, TypeBinding[]>();
- type_map.put(TypeBinding.CHAR, new TypeBinding[] {TypeBinding.CHAR, TypeBinding.BYTE, TypeBinding.INT});
+ type_map.put(TypeBinding.CHAR, new TypeBinding[] {TypeBinding.CHAR, TypeBinding.INT});
type_map.put(TypeBinding.SHORT, new TypeBinding[] {TypeBinding.SHORT, TypeBinding.BYTE, TypeBinding.INT});
type_map.put(TypeBinding.BYTE, new TypeBinding[] {TypeBinding.BYTE, TypeBinding.INT});
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
index c553d38..67cf763 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -329,7 +329,8 @@
new char[][] {JAVA, NIO, CHANNELS, "SelectableChannel".toCharArray() }, //$NON-NLS-1$
new char[][] {JAVA, NIO, CHANNELS, "Selector".toCharArray() }, //$NON-NLS-1$
new char[][] {JAVA, NIO, CHANNELS, "ServerSocketChannel".toCharArray() }, //$NON-NLS-1$
- new char[][] {JAVA, UTIL, "Formatter".toCharArray() } //$NON-NLS-1$
+ new char[][] {JAVA, UTIL, "Formatter".toCharArray() }, //$NON-NLS-1$
+ new char[][] {JAVA, UTIL, "Scanner".toCharArray() }, //$NON-NLS-1$
};
// different assertion utilities:
diff --git a/org.eclipse.jdt.core/forceQualifierUpdate.txt b/org.eclipse.jdt.core/forceQualifierUpdate.txt
index 12cc70d..2158440 100644
--- a/org.eclipse.jdt.core/forceQualifierUpdate.txt
+++ b/org.eclipse.jdt.core/forceQualifierUpdate.txt
@@ -1,9 +1,5 @@
-# To force a version qualifier update, add the bug here
-Bug 403352 - Update all parent versions to match our build stream
-Bug 407853 - ECJ download misses legal file (about.html)
-Bug 407852 - ECJ source download is not correct
-Bug 408447 - compiler (log message) needs updating for copyright and bundle_qualifier
Several bundles changed and need to be touched
-Bug 418646 - org.eclipse.jdt.core does not provide an artifact with classifier 'antadapter'Bug 436266 - Use RC3 (plus) version of JDT compiler to build RC4
+Bug 418646 - org.eclipse.jdt.core does not provide an artifact with classifier 'antadapter'
Bug 436266 - Use RC3 (plus) version of JDT compiler to build RC4
-Bug 551547 - The library org.eclipse.jdt.core.compiler.batch_*.jar should be signed
\ No newline at end of file
+Bug 551547 - The library org.eclipse.jdt.core.compiler.batch_*.jar should be signed
+Bug 549687 - Local ecj build has a SHA-256 digest error for org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.class
\ No newline at end of file
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/CompilationUnitSorter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/CompilationUnitSorter.java
index c4a9429..19b2f07 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/CompilationUnitSorter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/CompilationUnitSorter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,6 +57,9 @@
case AST.JLS8 :
case AST.JLS9 :
case AST.JLS10 :
+ case AST.JLS11 :
+ case AST.JLS12 :
+ case AST.JLS13 :
break;
default :
throw new IllegalArgumentException();