Bug 550687 - Merge remote-tracking branch 'origin/BETA_JAVA13'

Change-Id: I7a54e1517e1cf4daa5c27eed30f2491277455a70
diff --git a/org.eclipse.jdt.debug/.settings/.api_filters b/org.eclipse.jdt.debug/.settings/.api_filters
index 48f44b2..b6bdccf 100644
--- a/org.eclipse.jdt.debug/.settings/.api_filters
+++ b/org.eclipse.jdt.debug/.settings/.api_filters
@@ -1,5 +1,51 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <component id="org.eclipse.jdt.debug" version="2">
+    <resource path="eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java" type="org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler">
+        <filter comment="For Java 13" id="640712815">
+            <message_arguments>
+                <message_argument value="SwitchCase"/>
+                <message_argument value="ASTInstructionCompiler"/>
+                <message_argument value="expressions()"/>
+            </message_arguments>
+        </filter>
+        <filter comment="For Java 13" id="640712815">
+            <message_arguments>
+                <message_argument value="TextBlock"/>
+                <message_argument value="ASTInstructionCompiler"/>
+                <message_argument value="getEscapedValue()"/>
+            </message_arguments>
+        </filter>
+        <filter comment="For Java 13" id="642777099">
+            <message_arguments>
+                <message_argument value="ASTVisitor"/>
+                <message_argument value="ASTInstructionCompiler"/>
+                <message_argument value="endVisit(TextBlock)"/>
+            </message_arguments>
+        </filter>
+        <filter comment="Required to supoort Java 13." id="642777099">
+            <message_arguments>
+                <message_argument value="ASTVisitor"/>
+                <message_argument value="ASTInstructionCompiler"/>
+                <message_argument value="visit(SwitchExpression)"/>
+            </message_arguments>
+        </filter>
+        <filter comment="For Java 13" id="642777099">
+            <message_arguments>
+                <message_argument value="ASTVisitor"/>
+                <message_argument value="ASTInstructionCompiler"/>
+                <message_argument value="visit(TextBlock)"/>
+            </message_arguments>
+        </filter>
+    </resource>
+    <resource path="eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java" type="org.eclipse.jdt.internal.debug.eval.ast.engine.SourceBasedSourceGenerator">
+        <filter comment="For Java 13" id="642777099">
+            <message_arguments>
+                <message_argument value="ASTVisitor"/>
+                <message_argument value="SourceBasedSourceGenerator"/>
+                <message_argument value="visit(TextBlock)"/>
+            </message_arguments>
+        </filter>
+    </resource>
     <resource path="jdi/org/eclipse/jdi/Bootstrap.java" type="org.eclipse.jdi.Bootstrap">
         <filter comment="Additional filters for making the JDI interfaces officially internal" id="643842064">
             <message_arguments>
@@ -71,4 +117,22 @@
             </message_arguments>
         </filter>
     </resource>
+    <resource path="model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java" type="org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator">
+        <filter comment="For Java 13" id="642777099">
+            <message_arguments>
+                <message_argument value="ASTVisitor"/>
+                <message_argument value="ValidBreakpointLocationLocator"/>
+                <message_argument value="visit(TextBlock)"/>
+            </message_arguments>
+        </filter>
+    </resource>
+    <resource path="model/org/eclipse/jdt/internal/debug/core/hcr/MethodSearchVisitor.java" type="org.eclipse.jdt.internal.debug.core.hcr.MethodSearchVisitor">
+        <filter comment="For Java 13" id="642777099">
+            <message_arguments>
+                <message_argument value="ASTVisitor"/>
+                <message_argument value="MethodSearchVisitor"/>
+                <message_argument value="visit(TextBlock)"/>
+            </message_arguments>
+        </filter>
+    </resource>
 </component>
diff --git a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
index 12c6039..136b939 100644
--- a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
@@ -34,7 +34,7 @@
  org.eclipse.jdt.internal.debug.eval.ast.instructions;x-friends:="org.eclipse.jdt.debug.ui"
 Require-Bundle: org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
  org.eclipse.debug.core;bundle-version="[3.12.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.18.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.19.0,4.0.0)",
  org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
  org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)"
 Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java
index 0efc008..4094284 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java
@@ -8,6 +8,7 @@
  *
  * SPDX-License-Identifier: EPL-2.0
  *
+ *
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *     Jesper Steen Moller - Bug 427089
@@ -1287,6 +1288,14 @@
 		storeInstruction();
 	}
 
+	@Override
+	public void endVisit(TextBlock node) {
+		if (!isActive() || hasErrors()) {
+			return;
+		}
+		storeInstruction();
+	}
+
 	/**
 	 * @see ASTVisitor#endVisit(SuperConstructorInvocation)
 	 */
@@ -3756,6 +3765,17 @@
 		return true;
 	}
 
+	@Override
+	public boolean visit(TextBlock node) {
+		if (!isActive()) {
+			return false;
+		}
+
+		push(new PushString(node.getEscapedValue()));
+		
+		return true;
+	}
+
 	/**
 	 * @see ASTVisitor#visit(SuperConstructorInvocation)
 	 */
@@ -3988,9 +4008,9 @@
 					storeInstruction(); // jump
 					statementsDefault = new ArrayList<>();
 				} else {
-					if (node.getAST().apiLevel() >= AST.JLS12) {
+					if (node.getAST().apiLevel() == AST.JLS13) {
 						for (Object expression : switchCase.expressions()) {
-							if (expression instanceof StringLiteral) {
+							if (expression instanceof StringLiteral || expression instanceof TextBlock) {
 								push(new SendMessage("equals", "(Ljava/lang/Object;)Z", 1, null, fCounter)); //$NON-NLS-1$ //$NON-NLS-2$
 							} else {
 								push(new EqualEqualOperator(Instruction.T_int, Instruction.T_int, true, fCounter));
@@ -4001,7 +4021,7 @@
 							storeInstruction(); // equal-equal
 						}
 					} else {
-						if (switchCase.getExpression() instanceof StringLiteral) {
+						if (switchCase.getExpression() instanceof StringLiteral || switchCase.getExpression() instanceof TextBlock) {
 							push(new SendMessage("equals", "(Ljava/lang/Object;)Z", 1, null, fCounter)); //$NON-NLS-1$ //$NON-NLS-2$
 						} else {
 							push(new EqualEqualOperator(Instruction.T_int, Instruction.T_int, true, fCounter));
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
index 914361f..cffaf52 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
@@ -8,6 +8,7 @@
  *
  * SPDX-License-Identifier: EPL-2.0
  *
+ *
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *     Jesper Steen Moller - bug 341232
@@ -103,6 +104,7 @@
 import org.eclipse.jdt.core.dom.SwitchStatement;
 import org.eclipse.jdt.core.dom.SynchronizedStatement;
 import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextBlock;
 import org.eclipse.jdt.core.dom.TextElement;
 import org.eclipse.jdt.core.dom.ThisExpression;
 import org.eclipse.jdt.core.dom.ThrowStatement;
@@ -1867,6 +1869,14 @@
 		return true;
 	}
 
+	@Override
+	public boolean visit(TextBlock node) {
+		if (rightTypeFound()) {
+			return false;
+		}
+		return true;
+	}
+
 	/**
 	 * @see ASTVisitor#visit(SuperConstructorInvocation)
 	 */
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
index cf21023..76cdc9a 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2016 IBM Corporation and others.
+ * Copyright (c) 2003, 2019 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -98,6 +98,7 @@
 import org.eclipse.jdt.core.dom.SwitchStatement;
 import org.eclipse.jdt.core.dom.SynchronizedStatement;
 import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextBlock;
 import org.eclipse.jdt.core.dom.TextElement;
 import org.eclipse.jdt.core.dom.ThisExpression;
 import org.eclipse.jdt.core.dom.ThrowStatement;
@@ -315,6 +316,7 @@
 		case ASTNode.CHARACTER_LITERAL:
 		case ASTNode.NUMBER_LITERAL:
 		case ASTNode.STRING_LITERAL:
+		case ASTNode.TEXT_BLOCK:
 			return true;
 		case ASTNode.SIMPLE_NAME:
 		case ASTNode.QUALIFIED_NAME:
@@ -1224,6 +1226,11 @@
 		return visit(node, true);
 	}
 
+	@Override
+	public boolean visit(TextBlock node) {
+		return visit(node, true);
+	}
+
 	/**
 	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SuperConstructorInvocation)
 	 */
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/MethodSearchVisitor.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/MethodSearchVisitor.java
index 7918756..e26a95b 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/MethodSearchVisitor.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/MethodSearchVisitor.java
@@ -91,6 +91,7 @@
 import org.eclipse.jdt.core.dom.SwitchStatement;
 import org.eclipse.jdt.core.dom.SynchronizedStatement;
 import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextBlock;
 import org.eclipse.jdt.core.dom.TextElement;
 import org.eclipse.jdt.core.dom.ThisExpression;
 import org.eclipse.jdt.core.dom.ThrowStatement;
@@ -527,6 +528,11 @@
 	}
 
 	@Override
+	public boolean visit(TextBlock node) {
+		return isSearching();
+	}
+
+	@Override
 	public boolean visit(SuperConstructorInvocation node) {
 		return isSearching();
 	}
diff --git a/org.eclipse.jdt.launching/META-INF/MANIFEST.MF b/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
index 6f7cf4e..7f3b49c 100644
--- a/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@
  org.eclipse.jdt.launching.sourcelookup.advanced,
  org.eclipse.jdt.launching.sourcelookup.containers
 Require-Bundle: org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.18.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.19.0,4.0.0)",
  org.eclipse.debug.core;bundle-version="[3.14.0,4.0.0)",
  org.eclipse.jdt.debug;bundle-version="[3.11.0,4.0.0)",
  org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)",
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java
index 286c12a..8197339 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java
@@ -232,6 +232,8 @@
 		String version = vMInstall.getJavaVersion();
 		if (version == null) {
 			return null;
+		} else if (version.startsWith(JavaCore.VERSION_13)) {
+			return JavaCore.VERSION_13;
 		} else if (version.startsWith(JavaCore.VERSION_12)) {
 			return JavaCore.VERSION_12;
 		} else if (version.startsWith(JavaCore.VERSION_11)) {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
index bb98cab..b550dbc 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
@@ -844,7 +844,9 @@
 	 */
 	public static URL getDefaultJavadocLocation(String version) {
 		try {
-			if (version.startsWith(JavaCore.VERSION_12)) {
+			if (version.startsWith(JavaCore.VERSION_13)) {
+				return new URL("https://docs.oracle.com/en/java/javase/13/docs/api/"); //$NON-NLS-1$
+			} else if (version.startsWith(JavaCore.VERSION_12)) {
 				return new URL("https://docs.oracle.com/en/java/javase/12/docs/api/"); //$NON-NLS-1$
 			} else if (version.startsWith(JavaCore.VERSION_11)) {
 				return new URL("https://docs.oracle.com/en/java/javase/11/docs/api/"); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java
index 991a5bc..fc0e141 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java
@@ -196,7 +196,9 @@
 
 	private String getExecutionEnvironmentCompliance(IExecutionEnvironment executionEnvironment) {
 		String desc = executionEnvironment.getId();
-		if (desc.indexOf(JavaCore.VERSION_12) != -1) {
+		if (desc.indexOf(JavaCore.VERSION_13) != -1) {
+			return JavaCore.VERSION_13;
+		} else if (desc.indexOf(JavaCore.VERSION_12) != -1) {
 			return JavaCore.VERSION_12;
 		} else if (desc.indexOf(JavaCore.VERSION_11) != -1) {
 			return JavaCore.VERSION_11;
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
index 121fab3..da73c99 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
@@ -41,6 +41,7 @@
 
 	// XXX: Note that this string is not yet standardized by OSGi, see http://wiki.osgi.org/wiki/Execution_Environment
 
+	private static final String JavaSE_13 = "JavaSE-13"; //$NON-NLS-1$
 	private static final String JavaSE_12 = "JavaSE-12"; //$NON-NLS-1$
 	private static final String JavaSE_11 = "JavaSE-11"; //$NON-NLS-1$
 	private static final String JavaSE_10_Plus = "JavaSE-10+"; //$NON-NLS-1$
@@ -89,6 +90,7 @@
 		mappings.put(JavaSE_10_Plus, new String[] { JavaSE_12 });
 		mappings.put(JavaSE_11, new String[] { JavaSE_10 });
 		mappings.put(JavaSE_12, new String[] { JavaSE_11 });
+		mappings.put(JavaSE_13, new String[] { JavaSE_12 });
 	}
 	@Override
 	public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
@@ -114,7 +116,9 @@
 					types = getTypes(CDC_FOUNDATION_1_1);
 				}
 			} else {
-				if (javaVersion.startsWith("12")) { //$NON-NLS-1$
+				if (javaVersion.startsWith("13")) { //$NON-NLS-1$
+					types = getTypes(JavaSE_13);
+				} else if (javaVersion.startsWith("12")) { //$NON-NLS-1$
 					types = getTypes(JavaSE_12);
 				} else if (javaVersion.startsWith("11")) { //$NON-NLS-1$
 					types = getTypes(JavaSE_11);
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
index 7f1a4d4..8b4d0cb 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
@@ -3327,8 +3327,11 @@
 				} else if (javaVersion.startsWith(JavaCore.VERSION_12)
 						&& (javaVersion.length() == JavaCore.VERSION_12.length() || javaVersion.charAt(JavaCore.VERSION_12.length()) == '.')) {
 					compliance = JavaCore.VERSION_12;
+				} else if (javaVersion.startsWith(JavaCore.VERSION_13)
+						&& (javaVersion.length() == JavaCore.VERSION_13.length() || javaVersion.charAt(JavaCore.VERSION_13.length()) == '.')) {
+					compliance = JavaCore.VERSION_13;
 				} else {
-					compliance = JavaCore.VERSION_12; // use latest by default
+					compliance = JavaCore.VERSION_13; // use latest by default
 				}
 
             	Hashtable<String, String> options= JavaCore.getOptions();
diff --git a/org.eclipse.jdt.launching/plugin.properties b/org.eclipse.jdt.launching/plugin.properties
index d56ec48..7983d1e 100644
--- a/org.eclipse.jdt.launching/plugin.properties
+++ b/org.eclipse.jdt.launching/plugin.properties
@@ -1,10 +1,14 @@
 ###############################################################################
-# Copyright (c) 2000, 2018 IBM Corporation and others.
+# Copyright (c) 2000, 2019 IBM Corporation and others.
 #
 # This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License 2.0
 # which accompanies this distribution, and is available at
 # https://www.eclipse.org/legal/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.
 #
 # SPDX-License-Identifier: EPL-2.0
 #
@@ -74,6 +78,7 @@
 environment.description.14 = Java Platform, Standard Edition 10
 environment.description.15 = Java Platform, Standard Edition 11
 environment.description.16 = Java Platform, Standard Edition 12
+environment.description.17 = Java Platform, Standard Edition 13
 
 classpathVariableInitializer.deprecated = Use the JRE System Library instead
 
diff --git a/org.eclipse.jdt.launching/plugin.xml b/org.eclipse.jdt.launching/plugin.xml
index 2e36a20..406b5c3 100644
--- a/org.eclipse.jdt.launching/plugin.xml
+++ b/org.eclipse.jdt.launching/plugin.xml
@@ -8,6 +8,10 @@
      which accompanies this distribution, and is available at
      https://www.eclipse.org/legal/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.
+     
      SPDX-License-Identifier: EPL-2.0
  
      Contributors:
@@ -333,10 +337,15 @@
             id="JavaSE-11"
             compliance="11">
       </environment>
-            <environment
+      <environment
             description="%environment.description.16"
             id="JavaSE-12"
             compliance="12">
+      </environment>
+      <environment
+            description="%environment.description.17"
+            id="JavaSE-13"
+            compliance="13">
       </environment>         
       <analyzer
             class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer"