Skip to content

Commit

Permalink
Merge pull request #428 from eclipse-jdt/BETA_JAVA19
Browse files Browse the repository at this point in the history
JDT Core Beta java19 to master
  • Loading branch information
sravanlakkimsetti authored Sep 21, 2022
2 parents ecd24c4 + 8753c03 commit 5fd2839
Show file tree
Hide file tree
Showing 72 changed files with 214 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.compiler;singleton:=true
Bundle-Version: 3.12.2000.qualifier
Bundle-Version: 3.12.2050.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests.compiler,
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.core.tests.compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.core.tests.compiler</artifactId>
<version>3.12.2000-SNAPSHOT</version>
<version>3.12.2050-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
* Jesper Steen Møller <[email protected]> - Contributions for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down Expand Up @@ -1548,4 +1544,27 @@ public void test44() {
"Pattern of type long is not compatible with type int\n" +
"----------\n");
}
public void test45() {
runNegativeTest(new String[] {
"X.java",
"@SuppressWarnings(\"preview\")\n"
+ "public class X {\n"
+ " static void print(Object r) {\n"
+ " switch (r) {\n"
+ " case Rectangle r1 when (r instanceof (Rectangle(ColoredPoint upperLeft2, ColoredPoint lowerRight) r2)):\n"
+ " System.out.println(r2);// error should not be reported here\n"
+ " break;\n"
+ " }\n"
+ " }\n"
+ "}\n"
+ "record ColoredPoint() {}\n"
+ "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {} "
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
" switch (r) {\n" +
" ^\n" +
"An enhanced switch statement should be exhaustive; a default label expected\n" +
"----------\n");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.dom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15947,8 +15947,9 @@ public void testBug567016() {
/**
* https://bugs.eclipse.org/573949 - [17][switch pattern][formatter] JEP 406 changes
*/
public void _testBug573949() {
public void testBug573949() {
setComplianceLevel(CompilerOptions.VERSION_19);
this.formatterOptions.put(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
String source =
"public class X {\n" +
" private static void foo(Object o) {\n" +
Expand All @@ -15960,7 +15961,7 @@ public void _testBug573949() {
"\n" +
"static void testTriangle(Shape s) {\n" +
" switch (s) {\n" +
" case Triangle t&&(t.calculateArea() > 100) ->\n" +
" case Triangle t when t.calculateArea() > 100 ->\n" +
" System.out.println(\"Large triangle\");\n" +
" default ->\n" +
" System.out.println(\"A shape, possibly a small triangle\");\n" +
Expand All @@ -15980,7 +15981,7 @@ public void _testBug573949() {
"\n" +
" static void testTriangle(Shape s) {\n" +
" switch (s) {\n" +
" case Triangle t && (t.calculateArea() > 100) -> System.out.println(\"Large triangle\");\n" +
" case Triangle t when t.calculateArea() > 100 -> System.out.println(\"Large triangle\");\n" +
" default -> System.out.println(\"A shape, possibly a small triangle\");\n" +
" }\n" +
" }\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down Expand Up @@ -427,4 +423,43 @@ public void test010() throws JavaModelException {
requestor.getResults());

}
//content assist ArrayStoreException fix
//https://github.com/eclipse-jdt/eclipse.jdt.core/issues/345
public void test011() throws JavaModelException {
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/Completion/src/X.java",
"@SuppressWarnings(\"preview\")"
+ "public class X {\n"
+ " public static void printLowerRight(Rectangle r) {\n"
+ " int res = switch(r) {\n"
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ " ColoredPoint lr) r1 -> {\n"
+ " fals "
+ " yield 1; \n"
+ " } \n"
+ " default -> 0;\n"
+ " }; \n"
+ " \n"
+ " }\n"
+ " public static void main(String[] args) {\n"
+ " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ " }\n"
+ "}\n"
+ "record Point(int x, int y) {}\n"
+ "enum Color { RED, GREEN, BLUE }\n"
+ "record ColoredPoint(Point p, Color c) {}\n"
+ "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
);
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
requestor.allowAllRequiredProposals();
String str = this.workingCopies[0].getSource();
String completeBehind = "fals";
int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
assertResults("false[KEYWORD]{false, null, null, false, null, 52}",
requestor.getResults());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand Down
Loading

0 comments on commit 5fd2839

Please sign in to comment.