Merge remote-tracking branch 'origin/master' into BETA_JAVA15

Change-Id: I9c673fa124e4fbad2caabc53b8ea3636a81023b5
diff --git a/org.eclipse.jdt.debug.tests/testprograms/ModelPresentationTests.java b/org.eclipse.jdt.debug.tests/testprograms/ModelPresentationTests.java
new file mode 100644
index 0000000..e8d8fa8
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/testprograms/ModelPresentationTests.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ *  Copyright (c) 2020 Julian Honnen
+ *
+ *  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/
+ *
+ *  SPDX-License-Identifier: EPL-2.0
+ *
+ *  Contributors:
+ *     Julian Honnen <julian.honnen@vector.com> - initial API and implementation
+ *******************************************************************************/
+
+public class ModelPresentationTests {
+
+	public static void main(String[] args) {
+		Object stringArray = new String[0];
+		System.out.println(stringArray);
+	}
+
+}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index 98a5c47..e16bd72 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -206,7 +206,7 @@
 			"org.eclipse.debug.tests.targets.HcrClass9", "TestContributedStepFilterClass", "TerminateAll_01", "TerminateAll_02", "StepResult1",
 			"StepResult2", "StepResult3", "StepUncaught", "TriggerPoint_01", "BulkThreadCreationTest", "MethodExitAndException",
 			"Bug534319earlyStart", "Bug534319lateStart", "Bug534319singleThread", "Bug534319startBetwen", "MethodCall", "Bug538303", "Bug540243",
-			"OutSync", "OutSync2", "ConsoleOutputUmlaut", "ErrorRecurrence" };
+			"OutSync", "OutSync2", "ConsoleOutputUmlaut", "ErrorRecurrence", "ModelPresentationTests" };
 
 	/**
 	 * the default timeout
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
index 10086fb..28d8701 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
@@ -104,7 +104,6 @@
 import org.eclipse.jdt.debug.tests.launching.LaunchTests;
 import org.eclipse.jdt.debug.tests.launching.LaunchesTests;
 import org.eclipse.jdt.debug.tests.launching.LongClassPathTests;
-import org.eclipse.jdt.debug.tests.launching.LongModulePathTests;
 import org.eclipse.jdt.debug.tests.launching.MigrationDelegateTests;
 import org.eclipse.jdt.debug.tests.launching.PListParserTests;
 import org.eclipse.jdt.debug.tests.launching.ProjectClasspathVariableTests;
@@ -329,9 +328,10 @@
 		// long classpath tests
 		addTest(new TestSuite(ClasspathShortenerTests.class));
 		addTest(LongClassPathTests.suite());
-		if (JavaProjectHelper.isJava9Compatible()) {
-			addTest(new TestSuite(LongModulePathTests.class));
-		}
+		// Disabled as failing see Bug 566228
+		/*
+		 * if (JavaProjectHelper.isJava9Compatible()) { addTest(new TestSuite(LongModulePathTests.class)); }
+		 */
 
 		// Breakpoints tests
 		addTest(new TestSuite(TypeNameBreakpointTests.class));
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
index bb8a361..229a6ca 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
@@ -13,9 +13,6 @@
  *******************************************************************************/
 package org.eclipse.jdt.debug.tests.core;
 
-import java.io.File;
-import java.io.OutputStream;
-
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.DebugPlugin;
@@ -68,20 +65,10 @@
 	 * @throws Exception
 	 */
 	public void testAlreadyTerminatedProcess() throws Exception {
-		Process process;
 		if (Platform.getOS().equals(Platform.OS_LINUX)) {
-			// printing env command
-			{
-				Process p = Runtime.getRuntime().exec("env");
-				OutputStream processOut = p.getOutputStream();
-				Thread.sleep(500);
-				processOut.flush();
-
-			}
-			process = DebugPlugin.exec(new String[] { "java" }, new File("/tmp"));
-		} else {
-			process = DebugPlugin.exec(new String[] { "java" }, null);
+			return;
 		}
+		Process process = DebugPlugin.exec(new String[]{"java"}, null);
 
 		boolean terminated = false;
 		int value = -1;
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java
index 467029e..d580df3 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java
@@ -38,7 +38,6 @@
 import org.eclipse.jdt.debug.core.IJavaThread;
 import org.eclipse.jdt.debug.testplugin.JavaProjectHelper;
 import org.eclipse.jdt.debug.tests.AbstractDebugTest;
-import org.eclipse.jdt.debug.tests.TestUtil;
 import org.eclipse.jdt.internal.launching.LaunchingPlugin;
 import org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathSupport;
 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
@@ -82,8 +81,8 @@
 	/*
 	 * When JVM > 9, an argument file for the modulepath is created when modulepath is too long
 	 */
+
 	public void testVeryLongModulepathWithArgumentFile() throws Exception {
-		// Disabled for OS other than Win due to Bug 561967
 		if (!Platform.getOS().equals(Platform.OS_WIN32)) {
 			return;
 		}
@@ -94,8 +93,7 @@
 		launchConfiguration = createLaunchConfigurationStopInMain(javaProject, MAIN_TYPE_NAME);
 		int minModulePathLength = 300000;
 		setLongModulepath(javaProject, minModulePathLength);
-		TestUtil.waitForJobs("testVeryLongModulePath", 100, 10000);
-		TestUtil.runEventLoop();
+		waitForBuild();
 
 		// When
 		thread = launchAndSuspend(launchConfiguration);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java
index 7a7ead3..b996ff5 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2020 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -13,8 +13,14 @@
  *******************************************************************************/
 package org.eclipse.jdt.debug.tests.ui.presentation;
 
+import org.eclipse.debug.ui.IDebugModelPresentation;
 import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaStackFrame;
+import org.eclipse.jdt.debug.core.IJavaThread;
 import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
 import org.eclipse.jdt.debug.tests.AbstractDebugTest;
 import org.eclipse.jdt.internal.debug.ui.JDIModelPresentation;
 
@@ -136,4 +142,33 @@
 			pres.dispose();
 		}
 	}
+
+	/**
+	 * Tests displayVariableTypeNames option
+	 */
+	public void testShowTypeTest() throws Exception {
+		String typeName = "ModelPresentationTests";
+		IJavaLineBreakpoint bp = createLineBreakpoint(19, typeName);
+		JDIModelPresentation pres = new JDIModelPresentation();
+
+		IJavaThread thread = null;
+		try {
+			thread = launchToLineBreakpoint(typeName, bp);
+
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			IJavaVariable stringArrayVariable = findVariable(frame, "stringArray");
+			long id = ((IJavaObject) stringArrayVariable.getValue()).getUniqueId();
+
+			assertEquals("stringArray= String[0]  (id=" + id + ")", pres.getText(stringArrayVariable));
+
+			pres.setAttribute(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES, Boolean.TRUE);
+
+			assertEquals("String[] stringArray= String[0]  (id=" + id + ")", pres.getText(stringArrayVariable));
+
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+			pres.dispose();
+		}
+	}
 }
diff --git a/org.eclipse.jdt.debug.ui/forceQualifierUpdate.txt b/org.eclipse.jdt.debug.ui/forceQualifierUpdate.txt
index 3e80b00..c66c447 100644
--- a/org.eclipse.jdt.debug.ui/forceQualifierUpdate.txt
+++ b/org.eclipse.jdt.debug.ui/forceQualifierUpdate.txt
@@ -1,3 +1,4 @@
 # To force a version qualifier update, add the bug here
 Bug 522092 - Comparator errors from I20170909-0920
 Bug 530709 - Comparator errors in jdt debug and jdt ui in I20180204-2000
+Bug 566471 - I20200828-0150 - Comparator Errors Found
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
index 40d6292..3008731 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
@@ -1295,20 +1295,8 @@
 			javaValue = (IJavaValue) var.getValue();
 		} catch (DebugException e1) {
 		}
-		boolean showTypes= isShowVariableTypeNames();
 		StringBuilder buff= new StringBuilder();
-		String typeName= DebugUIMessages.JDIModelPresentation_unknown_type__2;
-		try {
-			typeName= var.getReferenceTypeName();
-			if (showTypes) {
-				typeName= getQualifiedName(typeName);
-			}
-		} catch (DebugException exception) {
-		}
-		if (showTypes) {
-			buff.append(typeName);
-			buff.append(' ');
-		}
+		appendTypeName(javaValue, buff);
 		buff.append(varLabel);
 
 		// add declaring type name if required
@@ -1333,6 +1321,22 @@
 		return buff.toString();
 	}
 
+	private void appendTypeName(IJavaValue javaValue, StringBuilder buff) {
+		if (!isShowVariableTypeNames()) {
+			return;
+		}
+
+		String typeName = DebugUIMessages.JDIModelPresentation_unknown_type__2;
+		try {
+			if (javaValue != null) {
+				typeName = getQualifiedName(javaValue.getReferenceTypeName());
+			}
+		} catch (DebugException exception) {
+		}
+		buff.append(typeName);
+		buff.append(' ');
+	}
+
 	/**
 	 * Returns text for the given value based on user preferences to display
 	 * toString() details.
diff --git a/org.eclipse.jdt.debug/forceQualifierUpdate.txt b/org.eclipse.jdt.debug/forceQualifierUpdate.txt
index 3993f2a..f05ac64 100644
--- a/org.eclipse.jdt.debug/forceQualifierUpdate.txt
+++ b/org.eclipse.jdt.debug/forceQualifierUpdate.txt
@@ -1,3 +1,4 @@
 # To force a version qualifier update, add the bug here
 Bug 530709 - Comparator errors in jdt debug and jdt ui in I20180204-2000
-Bug 534597 - Unanticipated comparator errors in I20180511-2000
\ No newline at end of file
+Bug 534597 - Unanticipated comparator errors in I20180511-2000
+Bug 566471 - I20200828-0150 - Comparator Errors Found
\ No newline at end of file