Commit 1f5d9593 authored by Emmanuel Bourg's avatar Emmanuel Bourg

New upstream version 4.12

parent c1200d9b
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug.tests; singleton:=true
Bundle-Version: 3.11.400.qualifier
Bundle-Version: 3.11.500.qualifier
Bundle-ClassPath: javadebugtests.jar
Bundle-Activator: org.eclipse.jdt.debug.testplugin.JavaTestPlugin
Bundle-Vendor: %providerName
......@@ -37,7 +37,7 @@ Require-Bundle: org.eclipse.ui.ide;resolution:=optional,
org.eclipse.core.variables,
org.eclipse.ui,
org.eclipse.jdt.core;bundle-version="[3.8.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.15.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.17.0,4.0.0)",
org.eclipse.jdt.launching;bundle-version="[3.11.0,4.0.0)",
org.eclipse.jdt.debug;bundle-version="[3.11.0,4.0.0)",
org.eclipse.jdt.debug.ui;bundle-version="[3.9.0,4.0.0)",
......
......@@ -23,7 +23,8 @@ bin.includes = plugin.xml,\
META-INF/,\
plugin.properties,\
java7/,\
java8/
java8/,\
java9/
source.javadebugtests.jar = test plugin/,\
tests/,\
console tests/
......
......@@ -34,9 +34,9 @@ public class DebugHoverTest18 {
System.out.println(arg);
run(()->{
String var3 = "v2";
System.out.println(var2);
String var3 = "v3";
System.out.println(var3);
System.out.println(var2);
System.out.println(var1);
System.out.println(arg);
});
......
/*******************************************************************************
* Copyright (c) 2008 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/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
/**
* Tests built in logical structures.
*/
public class LogicalStructures {
public static void main(String[] args) {
Map map = new HashMap();
map.put("one", new Integer(1));
map.put("two", new Integer(2));
List list = new ArrayList();
list.add("three");
list.add("four");
Set set = map.entrySet();
Entry entry = (Entry) set.iterator().next();
entry.getKey();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012, 2017 Eclipse Foundation and others.
Copyright (c) 2012, 2019 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
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.jdt.debug</artifactId>
<groupId>eclipse.jdt.debug</groupId>
<version>4.11.0-SNAPSHOT</version>
<version>4.12.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug.tests</artifactId>
<version>3.11.400-SNAPSHOT</version>
<version>3.11.500-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>
......
/*******************************************************************************
* Copyright (c) 2000, 2015 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
......@@ -57,8 +57,8 @@ public class JavaProjectHelper {
public static final String SRC_DIR = "src";
public static final String BIN_DIR = "bin";
public static final String J2SE_1_4_EE_NAME = "J2SE-1.4";
public static final String J2SE_1_5_EE_NAME = "J2SE-1.5";
// public static final String J2SE_1_4_EE_NAME = "J2SE-1.4";
// public static final String J2SE_1_5_EE_NAME = "J2SE-1.5";
public static final String JAVA_SE_1_6_EE_NAME = "JavaSE-1.6";
public static final String JAVA_SE_1_7_EE_NAME = "JavaSE-1.7";
public static final String JAVA_SE_1_8_EE_NAME = "JavaSE-1.8";
......@@ -81,6 +81,10 @@ public class JavaProjectHelper {
* path to the 1.8 test source
*/
public static final IPath TEST_1_8_SRC_DIR= new Path("java8");
/**
* path to the 9 test source
*/
public static final IPath TEST_9_SRC_DIR = new Path("java9");
/**
* path to the compiler error java file
......@@ -436,13 +440,10 @@ public class JavaProjectHelper {
* @param ee
*/
public static void updateCompliance(IJavaProject project, String ee) {
if(J2SE_1_4_EE_NAME.equals(ee)) {
setCompliance(project, JavaCore.VERSION_1_4);
}
else if(J2SE_1_5_EE_NAME.equals(ee)) {
setCompliance(project, JavaCore.VERSION_1_5);
}
else if(JAVA_SE_1_7_EE_NAME.equals(ee)) {
/*
* if(J2SE_1_4_EE_NAME.equals(ee)) { setCompliance(project, JavaCore.VERSION_1_4); } else if(J2SE_1_5_EE_NAME.equals(ee)) {
* setCompliance(project, JavaCore.VERSION_1_5); } else
*/if (JAVA_SE_1_7_EE_NAME.equals(ee)) {
setCompliance(project, JavaCore.VERSION_1_7);
}
else if(JAVA_SE_1_8_EE_NAME.equals(ee)) {
......
/*******************************************************************************
* Copyright (c) 2000, 2017 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
......@@ -188,6 +188,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
public static final String ONE_FIVE_PROJECT_NAME = "OneFive";
public static final String ONE_SEVEN_PROJECT_NAME = "OneSeven";
public static final String ONE_EIGHT_PROJECT_NAME = "OneEight";
public static final String NINE_PROJECT_NAME = "Nine";
public static final String BOUND_JRE_PROJECT_NAME = "BoundJRE";
public static final String CLONE_SUFFIX = "Clone";
......@@ -238,6 +239,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
private static boolean loaded15 = false;
private static boolean loaded17 = false;
private static boolean loaded18 = false;
private static boolean loaded9 = false;
private static boolean loadedEE = false;
private static boolean loadedJRE = false;
private static boolean loadedMulti = false;
......@@ -267,6 +269,8 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
loaded17 = pro.exists();
pro = ResourcesPlugin.getWorkspace().getRoot().getProject(ONE_EIGHT_PROJECT_NAME);
loaded18 = pro.exists();
pro = ResourcesPlugin.getWorkspace().getRoot().getProject(NINE_PROJECT_NAME);
loaded9 = pro.exists();
pro = ResourcesPlugin.getWorkspace().getRoot().getProject(BOUND_JRE_PROJECT_NAME);
loadedJRE = pro.exists();
pro = ResourcesPlugin.getWorkspace().getRoot().getProject(BOUND_EE_PROJECT_NAME);
......@@ -344,7 +348,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
catch(Exception e) {
handleProjectCreationException(e, ONE_FOUR_PROJECT_CLOSED_NAME, jp);
}
jp = createProject(ONE_FOUR_PROJECT_NAME, JavaProjectHelper.TEST_SRC_DIR.toString(), JavaProjectHelper.J2SE_1_4_EE_NAME, false);
jp = createProject(ONE_FOUR_PROJECT_NAME, JavaProjectHelper.TEST_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_1_7_EE_NAME, false);
IPackageFragmentRoot src = jp.findPackageFragmentRoot(new Path(ONE_FOUR_PROJECT_NAME).append(JavaProjectHelper.SRC_DIR).makeAbsolute());
assertNotNull("The 'src' package fragment root should not be null", src);
File root = JavaTestPlugin.getDefault().getFileInPlugin(new Path("testjars"));
......@@ -394,7 +398,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
ArrayList<ILaunchConfiguration> cfgs = new ArrayList<>(1);
try {
if (!loaded15) {
jp = createProject(ONE_FIVE_PROJECT_NAME, JavaProjectHelper.TEST_1_5_SRC_DIR.toString(), JavaProjectHelper.J2SE_1_5_EE_NAME, true);
jp = createProject(ONE_FIVE_PROJECT_NAME, JavaProjectHelper.TEST_1_5_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_1_7_EE_NAME, true);
cfgs.add(createLaunchConfiguration(jp, "a.b.c.MethodBreakpoints"));
cfgs.add(createLaunchConfiguration(jp, "a.b.c.IntegerAccess"));
cfgs.add(createLaunchConfiguration(jp, "a.b.c.StepIntoSelectionWithGenerics"));
......@@ -495,6 +499,34 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
}
}
/**
* Creates the Java 9 compliant project
*/
synchronized void assert9Project() {
IJavaProject jp = null;
ArrayList<ILaunchConfiguration> cfgs = new ArrayList<>(1);
try {
if (!loaded9) {
jp = createProject(NINE_PROJECT_NAME, JavaProjectHelper.TEST_9_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_9_EE_NAME, false);
cfgs.add(createLaunchConfiguration(jp, "LogicalStructures"));
loaded9 = true;
waitForBuild();
}
} catch (Exception e) {
try {
if (jp != null) {
jp.getProject().delete(true, true, null);
for (int i = 0; i < cfgs.size(); i++) {
cfgs.get(i).delete();
}
}
} catch (CoreException ce) {
// ignore
}
handleProjectCreationException(e, NINE_PROJECT_NAME, jp);
}
}
/**
* Creates the 'BoundJRE' project used for the JRE testing
*/
......@@ -536,7 +568,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
JavaProjectHelper.addSourceContainer(jp, JavaProjectHelper.SRC_DIR, JavaProjectHelper.BIN_DIR);
// add VM specific JRE container
IExecutionEnvironment j2se14 = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(JavaProjectHelper.J2SE_1_4_EE_NAME);
IExecutionEnvironment j2se14 = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(JavaProjectHelper.JAVA_SE_1_7_EE_NAME);
assertNotNull("Missing J2SE-1.4 environment", j2se14);
IPath path = JavaRuntime.newJREContainerPath(j2se14);
JavaProjectHelper.addContainerEntry(jp, path);
......@@ -765,6 +797,16 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
return getJavaProject(ONE_EIGHT_PROJECT_NAME);
}
/**
* Returns the 'Nine' project, used for Java 9 tests.
*
* @return the test project
*/
protected IJavaProject get9Project() {
assert9Project();
return getJavaProject(NINE_PROJECT_NAME);
}
/**
* Returns the 'BoundJRE' project
*
......
/*******************************************************************************
* Copyright (c) 2000, 2017 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
......@@ -139,6 +139,7 @@ import org.eclipse.jdt.debug.tests.variables.TestAnonymousInspect;
import org.eclipse.jdt.debug.tests.variables.TestInstanceRetrieval;
import org.eclipse.jdt.debug.tests.variables.TestIntegerAccessUnboxing15;
import org.eclipse.jdt.debug.tests.variables.TestLogicalStructures;
import org.eclipse.jdt.debug.tests.variables.TestLogicalStructuresJava9;
import junit.framework.Test;
import junit.framework.TestSuite;
......@@ -205,6 +206,9 @@ public class AutomatedSuite extends DebugSuite {
addTest(new TestSuite(StaticVariableTests.class));
addTest(new TestSuite(ArrayTests.class));
addTest(new TestSuite(TestLogicalStructures.class));
if (JavaProjectHelper.isJava9Compatible()) {
addTest(new TestSuite(TestLogicalStructuresJava9.class));
}
addTest(new TestSuite(TestInstanceRetrieval.class));
addTest(new TestSuite(TestAnonymousInspect.class));
if(JavaProjectHelper.isJava7Compatible()) {
......
/*******************************************************************************
* Copyright (c) 2000, 2014 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
......@@ -336,7 +336,7 @@ public class BreakpointLocationVerificationTests extends AbstractDebugTest {
testLocation(79, 79, "BreakpointsLocation", "BreakpointsLocation.1StaticInnerClass", false);
}
else {
testLocation(82, 82, "BreakpointsLocation", "BreakpointsLocation.1.StaticInnerClass", false);
testLocation(82, 82, "BreakpointsLocation", "BreakpointsLocation.1StaticInnerClass", false);
}
}
......
/*******************************************************************************
* 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
......@@ -44,7 +44,7 @@ public class ExecutionEnvironmentTests extends AbstractDebugTest {
assertTrue("Should be at least one environment", executionEnvironments.length > 0);
for (int i = 0; i < executionEnvironments.length; i++) {
IExecutionEnvironment environment = executionEnvironments[i];
if (environment.getId().equals(JavaProjectHelper.J2SE_1_4_EE_NAME)) {
if (environment.getId().equals(JavaProjectHelper.JAVA_SE_1_7_EE_NAME)) {
return;
}
}
......@@ -55,7 +55,7 @@ public class ExecutionEnvironmentTests extends AbstractDebugTest {
IVMInstall vm = JavaRuntime.getDefaultVMInstall();
IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
IExecutionEnvironment environment = manager.getEnvironment(JavaProjectHelper.J2SE_1_4_EE_NAME);
IExecutionEnvironment environment = manager.getEnvironment(JavaProjectHelper.JAVA_SE_1_7_EE_NAME);
assertNotNull("Missing environment J2SE-1.4", environment);
IVMInstall[] installs = environment.getCompatibleVMs();
assertTrue("Should be at least one vm install for the environment", installs.length > 0);
......@@ -233,7 +233,7 @@ public class ExecutionEnvironmentTests extends AbstractDebugTest {
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
String result = manager.performStringSubstitution("${ee_home:J2SE-1.4}");
assertNotNull(result);
IExecutionEnvironment ee = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(JavaProjectHelper.J2SE_1_4_EE_NAME);
IExecutionEnvironment ee = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(JavaProjectHelper.JAVA_SE_1_7_EE_NAME);
IVMInstall install = JavaRuntime.getVMInstall(JavaRuntime.newJREContainerPath(ee));
assertEquals(install.getInstallLocation().getAbsolutePath(), result);
}
......
/*******************************************************************************
* Copyright (c) 2000, 2009 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
......@@ -72,7 +72,14 @@ public class ProcessTests extends AbstractDebugTest {
value = process.exitValue();
terminated = true;
} catch (IllegalThreadStateException e) {
process.getInputStream().read(new byte[1000], 0, 1000);
int n = process.getInputStream().available();
if (n > 0) { // avoid reading if nothing available to prevent Bug 545326
process.getInputStream().skip(n);
}
n = process.getErrorStream().available();
if (n > 0) {
process.getErrorStream().skip(n);
}
Thread.sleep(500);
}
}
......
/*******************************************************************************
* 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
......@@ -52,6 +52,7 @@ public class StratumTests extends AbstractDebugTest {
// TODO ideally need to check "if NN or newer"
if (!JavaCore.isSupportedJavaVersion(version)) {
// as of 2018-11-15 java 12 was not supported by the sourcelookup agent
// as of 2019-05-05 java 12 is supported by the sourcelookup agent
assertEquals("Wrong number of available strata", 1, strata.length);
assertEquals("Wrong strata", "Java", strata[0]);
} else {
......
......@@ -65,8 +65,8 @@ public class BreakpointManagerPerfTests extends AbstractDebugPerformanceTest {
if(bp != null) {
bps.add(bp);
}
int end = 9+count;
for(int i = 11; i < end; i++) {
int end = 12 + count;
for (int i = 14; i < end; i++) {
bp = createLineBreakpoint(i, fgTypeName);
if(bp != null) {
bps.add(bp);
......
......@@ -53,7 +53,7 @@ public class PerfBreakpointTests extends AbstractDebugPerformanceTest implements
String typeName = "LargeSourceFile";
IResource resource = getBreakpointResource(typeName);
IJavaLineBreakpoint bp = createLineBreakpoint(14, typeName);
IJavaLineBreakpoint bp = createLineBreakpoint(17, typeName);
IJavaThread thread = launchToBreakpoint(typeName, false);
bp.delete();
......@@ -62,7 +62,7 @@ public class PerfBreakpointTests extends AbstractDebugPerformanceTest implements
int[] lineNumbers = new int[150];
for (int i = 0; i < lineNumbers.length; i++) {
lineNumbers[i] = 15 + i;
lineNumbers[i] = 18 + i;
}
for (int i = 0; i < 10; i++) {
......@@ -101,7 +101,7 @@ public class PerfBreakpointTests extends AbstractDebugPerformanceTest implements
String typeName = "LargeSourceFile";
IResource resource = getBreakpointResource(typeName);
IJavaLineBreakpoint bp = createLineBreakpoint(14, typeName);
IJavaLineBreakpoint bp = createLineBreakpoint(17, typeName);
IJavaThread thread = launchToBreakpoint(typeName, false);
bp.delete();
......@@ -111,7 +111,7 @@ public class PerfBreakpointTests extends AbstractDebugPerformanceTest implements
int[] lineNumbers = new int[50];
for (int i = 0; i < lineNumbers.length; i++) {
lineNumbers[i] = 15 + i;
lineNumbers[i] = 18 + i;
}
for (int i = 0; i < 10; i++) {
......@@ -158,7 +158,7 @@ public class PerfBreakpointTests extends AbstractDebugPerformanceTest implements
String typeName = "LargeSourceFile";
IProject project = get14Project().getProject();
IJavaLineBreakpoint bp = createLineBreakpoint(14, typeName);
IJavaLineBreakpoint bp = createLineBreakpoint(17, typeName);
IJavaThread thread = launchToBreakpoint(typeName, false);
bp.delete();
......@@ -208,7 +208,7 @@ public class PerfBreakpointTests extends AbstractDebugPerformanceTest implements
String typeName = "LotsOfFields";
IResource resource = getBreakpointResource(typeName);
IJavaLineBreakpoint bp = createLineBreakpoint(516, typeName);
IJavaLineBreakpoint bp = createLineBreakpoint(519, typeName);
IJavaThread thread = launchToBreakpoint(typeName, false);
bp.delete();
......
......@@ -76,7 +76,7 @@ public class PerfConditionalBreakpointsTests extends AbstractDebugPerformanceTes
// just in case
removeAllBreakpoints();
fBP = createLineBreakpoint(22, fTypeName);
fBP = createLineBreakpoint(25, fTypeName);
BreakpointListener listener = new BreakpointListener();
DebugPlugin.getDefault().addDebugEventListener(listener);
......@@ -101,7 +101,7 @@ public class PerfConditionalBreakpointsTests extends AbstractDebugPerformanceTes
try {
if (!fConditionalBreakpointSet) {
fBP.delete();
fBP = createConditionalLineBreakpoint(22, fTypeName, "i%100==0", true);
fBP = createConditionalLineBreakpoint(25, fTypeName, "i%100==0", true);
fConditionalBreakpointSet = true;
} else if (!fWarmUpComplete) {
fHitCount++;
......
/*******************************************************************************
* Copyright (c) 2000, 2015 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
......@@ -13,12 +13,12 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.performance;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.console.IConsole;
import org.eclipse.debug.ui.console.IConsoleLineTrackerExtension;
import org.eclipse.jdt.debug.testplugin.ConsoleLineTracker;
......@@ -191,20 +191,18 @@ public class PerfConsoleTests extends AbstractDebugPerformanceTest implements IC
* @throws Exception
*/
protected void launchWorkingCopyAndWait(final ILaunchConfigurationWorkingCopy workingCopy) throws Exception {
Runnable runnable = new Runnable() {
@Override
public void run() {
DebugUITools.launch(workingCopy, ILaunchManager.RUN_MODE);
}
};
DebugUIPlugin.getStandardDisplay().asyncExec(runnable);
synchronized (fLock) {
if (!fStopped) {
fLock.wait(360000);
}
}
ILaunch launch = null;
try {
launch = workingCopy.launch(ILaunchManager.RUN_MODE, null);
synchronized (fLock) {
if (!fStopped) {
fLock.wait(360000);
}
}
} finally {
assertTrue("Test program took to long.", launch.isTerminated());
getLaunchManager().removeLaunch(launch);
}
}
/**
......
......@@ -96,7 +96,7 @@ public class PerfSteppingTests extends AbstractDebugPerformanceTest {
*/
public void testBareStepOver() throws Exception {
String typeName = "PerfLoop";
createLineBreakpoint(20, typeName);
createLineBreakpoint(23, typeName);
IJavaThread thread= null;
try {
......
......@@ -58,7 +58,7 @@ public class PerfVariableDetailTests extends AbstractDebugPerformanceTest implem
tagAsSummary("Computing variable toString() details iteratively", Dimension.ELAPSED_PROCESS);
removeAllBreakpoints();
String typeName = "VariableDetails";
createLineBreakpoint(24, typeName);
createLineBreakpoint(27, typeName);
IJavaThread thread = null;
try {
ILaunchConfiguration configuration = getLaunchConfiguration(typeName);
......
/*******************************************************************************
* Copyright (c) 2011, 2017 IBM Corporation and others.
* Copyright (c) 2011, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
......@@ -86,7 +86,7 @@ public class JarSourceLookupTests extends AbstractDebugTest {
IFile jar = jarProject.getFile("lib/sample.jar");
assertTrue("lib/sample.jar is missing in project: " + jarProject.getName(), jar.exists());
fgJarProject = createJavaProjectClone(RefPjName, testrpath.append(RefPjName).toString(), JavaProjectHelper.J2SE_1_4_EE_NAME, true);
fgJarProject = createJavaProjectClone(RefPjName, testrpath.append(RefPjName).toString(), JavaProjectHelper.JAVA_SE_1_7_EE_NAME, true);
IProject jarRefProject = fgJarProject.getProject();
IFile cp = jarRefProject.getFile(".classpath");
......
/*******************************************************************************
* Copyright (c) 2000, 2011 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
......@@ -40,6 +40,7 @@ import org.eclipse.jdt.launching.sourcelookup.PackageFragmentRootSourceLocation;
public class SourceLocationTests extends AbstractDebugTest {
public static final String JRE_CONTAINER_1_4_CPE_NAME = "org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4";
public static final String JRE_CONTAINER_1_7_CPE_NAME = "org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7";
public SourceLocationTests(String name) {
super(name);
......@@ -164,7 +165,7 @@ public class SourceLocationTests extends AbstractDebugTest {
IClasspathEntry lib = null;
for (int i = 0; i < cpes.length; i++) {
if (cpes[i].getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
if (cpes[i].getPath().equals(new Path(JRE_CONTAINER_1_4_CPE_NAME))) {
if (cpes[i].getPath().equals(new Path(JRE_CONTAINER_1_7_CPE_NAME))) {
lib = cpes[i];
break;
}
......@@ -205,7 +206,7 @@ public class SourceLocationTests extends AbstractDebugTest {
IClasspathEntry lib = null;
for (int i = 0; i < cpes.length; i++) {
if (cpes[i].getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
if (cpes[i].getPath().equals(new Path(JRE_CONTAINER_1_4_CPE_NAME))) {
if (cpes[i].getPath().equals(new Path(JRE_CONTAINER_1_7_CPE_NAME))) {
lib = cpes[i];
break;
}
......
......@@ -31,7 +31,7 @@ import org.eclipse.jdt.debug.core.IJavaStackFrame;
import org.eclipse.jdt.debug.core.IJavaThread;
import org.eclipse.jdt.debug.tests.TestUtil;
import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants;
import org.eclipse.jdt.internal.debug.core.model.JDILocalVariable;
import org.eclipse.jdt.internal.debug.core.model.JDIModificationVariable;
import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
import org.eclipse.jdt.internal.debug.core.model.JDIValue;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
......@@ -50,6 +50,8 @@ import junit.framework.Test;
*/
public class DebugHoverTests extends AbstractDebugUiTests {
private static final String VAL_PREFIX = new String(org.eclipse.jdt.internal.compiler.lookup.TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX);
public static Test suite() {
return new OrderedTestSuite(DebugHoverTests.class);
}
......@@ -109,9 +111,9 @@ public class DebugHoverTests extends AbstractDebugUiTests {
hover.setEditor(part);
Map<String, Region> offsets = new LinkedHashMap<>();
offsets.put("arg", new Region(1059, "arg".length()));
offsets.put("var1", new Region(1030, "var1".length()));
offsets.put("var2", new Region(1001, "var2".length()));
offsets.put(VAL_PREFIX + "arg", new Region(1059, "arg".length()));
offsets.put(VAL_PREFIX + "var1", new Region(1030, "var1".length()));
offsets.put(/* local */ "var2", new Region(1001, "var2".length()));
Set<Entry<String, Region>> entrySet = offsets.entrySet();
int startLine = bpLine1;
......@@ -125,12 +127,10 @@ public class DebugHoverTests extends AbstractDebugUiTests {
part = openEditorAndValidateStack(expectedMethod2, framesNumber2, file, thread);
offsets = new LinkedHashMap<>();
offsets.put("arg", new Region(1216, "arg".length()));
offsets.put("var1", new Region(1186, "var1".length()));
offsets.put("var3", new Region(1156, "var3".length()));
// This will not work yet, I have no idea how to identify parent
// lambda element...
// offsets.put("var2", new Region(1108, "var2".length()));
offsets.put(VAL_PREFIX + "arg", new Region(1216, "arg".length()));
offsets.put(VAL_PREFIX + "var1", new Region(1186, "var1".length()));
offsets.put(VAL_PREFIX + "var2", new Region(1156, "var2".length()));
offsets.put(/* local */ "var3", new Region(1126, "var3".length()));
entrySet = offsets.entrySet();
startLine = bpLine2;
......@@ -166,15 +166,16 @@ public class DebugHoverTests extends AbstractDebugUiTests {
}
private void validateLine(final int line, int valueIndex, CompilationUnitEditor part, JavaDebugHover hover, Entry<String, Region> varData) throws Exception, DebugException {
String variableName = varData.getKey();
String debugVarName = varData.getKey</