Skip to content
Commits on Source (4)
eclipse-jdt-debug (4.12-1) unstable; urgency=medium
* New upstream release
- Depend on libeclipse-jdt-core-java (>= 3.18)
-- Emmanuel Bourg <ebourg@apache.org> Wed, 17 Jul 2019 23:24:54 +0200
eclipse-jdt-debug (4.11-1) unstable; urgency=medium
* New upstream release
......
......@@ -17,7 +17,7 @@ Build-Depends:
libeclipse-core-variables-java,
libeclipse-debug-core-java (>= 3.13.200),
libeclipse-debug-ui-java (>= 3.13.100),
libeclipse-jdt-core-java (>= 3.15),
libeclipse-jdt-core-java (>= 3.18),
libeclipse-jdt-core-manipulation-java,
libeclipse-jdt-ui-java (>= 3.15.100),
libeclipse-jface-java,
......@@ -50,7 +50,7 @@ Depends:
libeclipse-core-jobs-java,
libeclipse-core-resources-java,
libeclipse-core-runtime-java,
libeclipse-debug-core-java (>= 3.12),
libeclipse-debug-core-java (>= 3.18),
libequinox-common-java,
libequinox-preferences-java,
libequinox-registry-java,
......
......@@ -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/
......
/*******************************************************************************
* Copyright (c) 2014 SAP SE and others.
* Copyright (c) 2014, 2019 SAP SE and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
......@@ -10,32 +10,54 @@
*
* Contributors:
* SAP SE - initial API and implementation
* Paul Pazderski - Bug 546900: Tests to check initial console content and content persistence
* Paul Pazderski - Bug 343023: Tests for 'clear initial content on first edit'
*******************************************************************************/
package org.eclipse.jdt.debug.tests.console;
import static org.junit.Assert.assertArrayEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
import org.eclipse.jdt.debug.tests.TestUtil;
import org.eclipse.jdt.debug.ui.console.JavaStackTraceConsoleFactory;
import org.eclipse.jdt.internal.debug.ui.console.ConsoleMessages;
import org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceConsole;
import org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceConsolePage;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.TextConsoleViewer;
import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
import org.eclipse.ui.internal.console.ConsoleView;
/**
* Tests {@link JavaStackTraceConsole}
*/
public class JavaStackTraceConsoleTest extends AbstractDebugTest {
private final JavaStackTraceConsoleFactory fConsoleFactory = new JavaStackTraceConsoleFactory();
private JavaStackTraceConsole fConsole;
public JavaStackTraceConsoleTest(String name) {
......@@ -45,18 +67,68 @@ public class JavaStackTraceConsoleTest extends AbstractDebugTest {
@Override
public void setUp() throws Exception {
super.setUp();
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
fConsole = new JavaStackTraceConsole();
consoleManager.addConsoles(new IConsole[] { fConsole });
initConsole(true);
}
@Override
protected void tearDown() throws Exception {
removeConsole(false);
super.tearDown();
}
/**
* Create and register a {@link JavaStackTraceConsole}.
*
* @param assertDefaultContent
* If <code>true</code> assert console is initialized with its default content.
* @see #removeConsole(boolean)
*/
private void initConsole(boolean assertDefaultContent) {
fConsoleFactory.openConsole();
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
IConsole[] consoles = consoleManager.getConsoles();
fConsole = null;
for (IConsole console : consoles) {
if (console instanceof JavaStackTraceConsole) {
fConsole = (JavaStackTraceConsole) console;
// do not end loop. There should be only one JavaStackTraceConsole but if there are more
// the last one is most likely the one we opened
}
}
assertNotNull("Failed to open a JavaStackTraceConsole", fConsole);
if (assertDefaultContent) {
assertInitialContent();
}
}
/**
* Remove the previous created console.
*
* @param preserveContent
* If <code>true</code> the remove does not prevent the current console content from being loaded by next
* {@link JavaStackTraceConsole}.
* @see #initConsole(boolean)
*/
private void removeConsole(boolean preserveContent) {
if (!preserveContent) {
fConsole.clearConsole();
}
final int contentLength = fConsole.getDocument().getLength();
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
consoleManager.removeConsoles(new IConsole[] { fConsole });
super.tearDown();
final Path stackTraceFile = Paths.get(JavaStackTraceConsole.FILE_NAME);
if (!preserveContent) {
assertTrue("Leaked content of JavaStackTraceConsole", Files.notExists(stackTraceFile));
} else {
assertTrue("JavaStackTraceConsole content was not persisted", Files.exists(stackTraceFile));
try {
assertTrue("Persisted content seems incomplete", Files.size(stackTraceFile) >= contentLength);
} catch (IOException e) {
fail("Persisted content seems incomplete");
}
}
}
public void testHyperlinkMatchSignatureSimple() throws Exception {
......@@ -95,6 +167,108 @@ public class JavaStackTraceConsoleTest extends AbstractDebugTest {
assertArrayEquals("Expected no hyperlinks for invalid type name", new Position[0], positions);
}
/**
* Test save/restore of stack trace console content on console close/reactivation.
*/
public void testLoadAndSaveDocument() throws Exception {
IDocument initialDocument = fConsole.getDocument();
String storedContent = "at foo.bar.Type.method1(Type.java:fff)";
consoleDocumentWithText(storedContent);
removeConsole(true);
Path file = Paths.get(JavaStackTraceConsole.FILE_NAME);
assertTrue("Content was not stored.", Files.exists(file));
assertTrue("Content was not stored.", Files.size(file) > 0);
initConsole(false);
assertNotSame("Failed to create new console.", initialDocument, fConsole.getDocument());
assertEquals("Failed to restore previous content.", storedContent, fConsole.getDocument().get());
}
/**
* Test for Bug 343023. Test if initial content is cleared on first edit and not cleared if it was changed programmatically before.
*/
public void testClearInitialContent() {
PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
// type at start of initial content
TextConsoleViewer viewer = getConsolesViewer();
viewer.getTextWidget().invokeAction(ST.TEXT_START);
doKeyStroke(viewer.getTextWidget(), 'a');
assertEquals("Initial content was not cleared.", "a", fConsole.getDocument().get());
doKeyStroke(viewer.getTextWidget(), 'b');
assertEquals("Content was cleared again.", "ab", fConsole.getDocument().get());
removeConsole(false);
// type inside initial content
initConsole(true);
viewer = getConsolesViewer();
viewer.getTextWidget().setCaretOffset(5);
doKeyStroke(viewer.getTextWidget(), 'a');
assertEquals("Initial content was not cleared.", "a", fConsole.getDocument().get());
doKeyStroke(viewer.getTextWidget(), 'b');
assertEquals("Content was cleared again.", "ab", fConsole.getDocument().get());
removeConsole(false);
// type at end of initial content
initConsole(true);
viewer = getConsolesViewer();
viewer.getTextWidget().invokeAction(ST.TEXT_END);
doKeyStroke(viewer.getTextWidget(), 'a');
assertEquals("Initial content was not cleared.", "a", fConsole.getDocument().get());
doKeyStroke(viewer.getTextWidget(), 'b');
assertEquals("Content was cleared again.", "ab", fConsole.getDocument().get());
removeConsole(false);
// select all initial content
initConsole(true);
viewer = getConsolesViewer();
viewer.getTextWidget().selectAll();
doKeyStroke(viewer.getTextWidget(), 'a');
assertEquals("Initial content was not cleared.", "a", fConsole.getDocument().get());
doKeyStroke(viewer.getTextWidget(), 'b');
assertEquals("Content was cleared again.", "ab", fConsole.getDocument().get());
removeConsole(false);
// select part of initial content
initConsole(true);
viewer = getConsolesViewer();
viewer.getTextWidget().setSelection(5, 10);
doKeyStroke(viewer.getTextWidget(), 'a');
assertEquals("Initial content was not cleared.", "a", fConsole.getDocument().get());
doKeyStroke(viewer.getTextWidget(), 'b');
assertEquals("Content was cleared again.", "ab", fConsole.getDocument().get());
removeConsole(false);
// paste inside initial content
initConsole(true);
viewer = getConsolesViewer();
viewer.getTextWidget().setCaretOffset(5);
viewer.getTextWidget().insert("at foo.bar.Type.method1(IILjava/lang/String;)V(Type.java:1)");
assertEquals("Initial content was not cleared.", "at foo.bar.Type.method1(IILjava/lang/String;)V(Type.java:1)", fConsole.getDocument().get());
doKeyStroke(viewer.getTextWidget(), 'b');
assertTrue("Content was cleared again.", fConsole.getDocument().getLength() > 5);
removeConsole(false);
// user edit after something already modified the content (expect no magic clear)
initConsole(true);
viewer = getConsolesViewer();
String text = "Text set programmatically";
viewer.getTextWidget().setText(text);
viewer.getTextWidget().invokeAction(ST.TEXT_END);
doKeyStroke(viewer.getTextWidget(), '!');
assertEquals(text + "!", fConsole.getDocument().get());
removeConsole(true); // preserve content this time!
// check first edit does not clear if console is initialized with custom content
initConsole(false);
viewer = getConsolesViewer();
int lengthBefore = fConsole.getDocument().getLength();
doKeyStroke(viewer.getTextWidget(), 'a');
assertEquals("Custom content was cleared.", lengthBefore + 1, fConsole.getDocument().getLength());
// do not remove last console so tearDown can do something
});
}
private IDocument consoleDocumentWithText(String text) throws InterruptedException {
IDocument document = fConsole.getDocument();
document.set(text);
......@@ -131,8 +305,7 @@ public class JavaStackTraceConsoleTest extends AbstractDebugTest {
private Position[] allLinkPositions() {
try {
return fConsole.getDocument().getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
}
catch (BadPositionCategoryException ex) {
} catch (BadPositionCategoryException ex) {
// no hyperlinks
}
return new Position[0];
......@@ -142,4 +315,51 @@ public class JavaStackTraceConsoleTest extends AbstractDebugTest {
return Arrays.toString(allLinkPositions());
}
/**
* Check if initial content is shown.
*/
public void assertInitialContent() {
assertEquals("Console not loaded with initial content.", ConsoleMessages.JavaStackTraceConsole_0, fConsole.getDocument().get());
}
/**
* Tries to get the viewer of the currently tested console.
*
* @return the consoles viewer
*/
private TextConsoleViewer getConsolesViewer() {
TestUtil.waitForJobs(getName(), 100, DEFAULT_TIMEOUT);
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
assertNotNull(workbenchWindow);
IWorkbenchPage activePage = workbenchWindow.getActivePage();
assertNotNull(activePage);
JavaStackTraceConsolePage page = null;
for (IViewReference vref : activePage.getViewReferences()) {
IViewPart view = vref.getView(false);
if (view instanceof ConsoleView) {
ConsoleView consoleView = (ConsoleView) view;
if (consoleView.getConsole() == fConsole && consoleView.getCurrentPage() instanceof JavaStackTraceConsolePage) {
page = (JavaStackTraceConsolePage) consoleView.getCurrentPage();
break;
}
}
}
assertNotNull(page);
return page.getViewer();
}
/**
* Simulate user pressing a key.
*
* @param widget
* widget to type in
* @param c
* character to type
*/
private void doKeyStroke(StyledText widget, char c) {
final Event e = new Event();
e.character = c;
widget.notifyListeners(SWT.KeyDown, e);
widget.notifyListeners(SWT.KeyUp, e);
}
}
......@@ -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, 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
......@@ -319,7 +319,7 @@ public class HcrTests extends AbstractDebugTest {
IJavaDebugTarget target = (IJavaDebugTarget)thread.getDebugTarget();
if (target.supportsHotCodeReplace()) {
IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 36", 36, frame.getLineNumber());
ICompilationUnit cu = getCompilationUnit(get14Project(), "src", "org.eclipse.debug.tests.targets", "HcrClass2.java");
cu = cu.getPrimary();
......@@ -342,7 +342,7 @@ public class HcrTests extends AbstractDebugTest {
assertNotNull("HCR should have not failed", listener.target);
assertTrue("the thread should be suspended again after the HCR", thread.isSuspended());
frame = (IJavaStackFrame) thread.getTopStackFrame();
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 36", 36, frame.getLineNumber());
} else {
System.err.println("Warning: HCR test skipped since target VM does not support HCR.");
......@@ -372,7 +372,7 @@ public class HcrTests extends AbstractDebugTest {
IJavaDebugTarget target = (IJavaDebugTarget)thread.getDebugTarget();
if (target.supportsHotCodeReplace()) {
IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 40", 40, frame.getLineNumber());
ICompilationUnit cu = getCompilationUnit(get14Project(), "src", "org.eclipse.debug.tests.targets", "HcrClass2.java");
cu = cu.getPrimary();
......@@ -395,7 +395,7 @@ public class HcrTests extends AbstractDebugTest {
assertNotNull("HCR should have not failed", listener.target);
assertTrue("the thread should be suspended again after the HCR", thread.isSuspended());
frame = (IJavaStackFrame) thread.getTopStackFrame();
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$2Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 40", 40, frame.getLineNumber());
} else {
System.err.println("Warning: HCR test skipped since target VM does not support HCR.");
......@@ -425,7 +425,7 @@ public class HcrTests extends AbstractDebugTest {
IJavaDebugTarget target = (IJavaDebugTarget)thread.getDebugTarget();
if (target.supportsHotCodeReplace()) {
IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$1$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$1Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 22", 22, frame.getLineNumber());
ICompilationUnit cu = getCompilationUnit(get14Project(), "src", "org.eclipse.debug.tests.targets", "HcrClass2.java");
cu = cu.getPrimary();
......@@ -448,7 +448,7 @@ public class HcrTests extends AbstractDebugTest {
assertNotNull("HCR should have not failed", listener.target);
assertTrue("the thread should be suspended again after the HCR", thread.isSuspended());
frame = (IJavaStackFrame) thread.getTopStackFrame();
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$1$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the local type", "org.eclipse.debug.tests.targets.HcrClass2$1Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 22", 22, frame.getLineNumber());
} else {
System.err.println("Warning: HCR test skipped since target VM does not support HCR.");
......@@ -1022,7 +1022,7 @@ public class HcrTests extends AbstractDebugTest {
if (target.supportsHotCodeReplace()) {
IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
assertEquals("We should be stopped in the run() method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass9$1$Local type", "org.eclipse.debug.tests.targets.HcrClass9$1$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass9$1Local type", "org.eclipse.debug.tests.targets.HcrClass9$Inner$1Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 22", 22, frame.getLineNumber());
ICompilationUnit cu = getCompilationUnit(get14Project(), "src", "org.eclipse.debug.tests.targets", "HcrClass9.java");
cu = cu.getPrimary();
......@@ -1046,7 +1046,7 @@ public class HcrTests extends AbstractDebugTest {
assertTrue("the thread should be suspended again after the HCR", thread.isSuspended());
frame = (IJavaStackFrame) thread.getTopStackFrame();
assertEquals("We should be stopped in the run method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass9$1$Local type", "org.eclipse.debug.tests.targets.HcrClass9$1$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass9$1$Local type", "org.eclipse.debug.tests.targets.HcrClass9$Inner$1Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 22", 22, frame.getLineNumber());
} else {
System.err.println("Warning: HCR test skipped since target VM does not support HCR.");
......@@ -1077,7 +1077,7 @@ public class HcrTests extends AbstractDebugTest {
if (target.supportsHotCodeReplace()) {
IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
assertEquals("We should be stopped in the run() method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass8$1$Local type", "org.eclipse.debug.tests.targets.HcrClass8$1$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass8$1$Local type", "org.eclipse.debug.tests.targets.HcrClass8$1$1Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 27", 27, frame.getLineNumber());
ICompilationUnit cu = getCompilationUnit(get14Project(), "src", "org.eclipse.debug.tests.targets", "HcrClass8.java");
cu = cu.getPrimary();
......@@ -1101,7 +1101,7 @@ public class HcrTests extends AbstractDebugTest {
assertTrue("the thread should be suspended again after the HCR", thread.isSuspended());
frame = (IJavaStackFrame) thread.getTopStackFrame();
assertEquals("We should be stopped in the run method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass8$1$Local type", "org.eclipse.debug.tests.targets.HcrClass8$1$Local", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass8$1$Local type", "org.eclipse.debug.tests.targets.HcrClass8$1$1Local", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 27", 27, frame.getLineNumber());
} else {
System.err.println("Warning: HCR test skipped since target VM does not support HCR.");
......@@ -1132,7 +1132,7 @@ public class HcrTests extends AbstractDebugTest {
if (target.supportsHotCodeReplace()) {
IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
assertEquals("We should be stopped in the run() method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass7$1$Local$Inner type", "org.eclipse.debug.tests.targets.HcrClass7$1$Local$Inner", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass7$1Local$Inner type", "org.eclipse.debug.tests.targets.HcrClass7$1Local$Inner", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 22", 22, frame.getLineNumber());
ICompilationUnit cu = getCompilationUnit(get14Project(), "src", "org.eclipse.debug.tests.targets", "HcrClass7.java");
cu = cu.getPrimary();
......@@ -1156,7 +1156,7 @@ public class HcrTests extends AbstractDebugTest {
assertTrue("the thread should be suspended again after the HCR", thread.isSuspended());
frame = (IJavaStackFrame) thread.getTopStackFrame();
assertEquals("We should be stopped in the run method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass7$1$Local$Inner type", "org.eclipse.debug.tests.targets.HcrClass7$1$Local$Inner", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass7$1$Local$Inner type", "org.eclipse.debug.tests.targets.HcrClass7$1Local$Inner", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 22", 22, frame.getLineNumber());
} else {
System.err.println("Warning: HCR test skipped since target VM does not support HCR.");
......@@ -1187,7 +1187,7 @@ public class HcrTests extends AbstractDebugTest {
if (target.supportsHotCodeReplace()) {
IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
assertEquals("We should be stopped in the run() method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass6$1 type", "org.eclipse.debug.tests.targets.HcrClass6$1", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass6$1 type", "org.eclipse.debug.tests.targets.HcrClass6$1Local$1", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 26", 26, frame.getLineNumber());
ICompilationUnit cu = getCompilationUnit(get14Project(), "src", "org.eclipse.debug.tests.targets", "HcrClass6.java");
cu = cu.getPrimary();
......@@ -1211,7 +1211,7 @@ public class HcrTests extends AbstractDebugTest {
assertTrue("the thread should be suspended again after the HCR", thread.isSuspended());
frame = (IJavaStackFrame) thread.getTopStackFrame();
assertEquals("We should be stopped in the run method", "run", frame.getMethodName());
assertEquals("We should be stopped in the HcrClass6$1 type", "org.eclipse.debug.tests.targets.HcrClass6$1", frame.getDeclaringTypeName());
assertEquals("We should be stopped in the HcrClass6$1 type", "org.eclipse.debug.tests.targets.HcrClass6$1Local$1", frame.getDeclaringTypeName());
assertEquals("We shoud be stopped on line 26", 26, frame.getLineNumber());
} else {
System.err.println("Warning: HCR test skipped since target VM does not support HCR.");
......
/*******************************************************************************
* 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);
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);
}
}
/**
......