diff options
| author | Sarika Sinha | 2021-02-10 07:16:49 +0000 |
|---|---|---|
| committer | Sarika Sinha | 2021-03-13 08:32:22 +0000 |
| commit | 3e17a1fd1464c00b9c3fd03515cc0bcc49baef99 (patch) | |
| tree | ede71b5984c2e074384c28818c7cfbfc92bb6887 | |
| parent | 12f68c3d7bb64b2e6859bbc2bfdc1add76c45b4d (diff) | |
| download | eclipse.jdt.debug-3e17a1fd1464c00b9c3fd03515cc0bcc49baef99.tar.gz eclipse.jdt.debug-3e17a1fd1464c00b9c3fd03515cc0bcc49baef99.tar.xz eclipse.jdt.debug-3e17a1fd1464c00b9c3fd03515cc0bcc49baef99.zip | |
Change-Id: I1a423ff8d39e566268c0a4df859ae8c35adbc75b
5 files changed, 150 insertions, 2 deletions
diff --git a/org.eclipse.jdt.debug.tests/java16_/a/b/c/RecordTests.java b/org.eclipse.jdt.debug.tests/java16_/a/b/c/RecordTests.java new file mode 100644 index 000000000..12b2ec29c --- /dev/null +++ b/org.eclipse.jdt.debug.tests/java16_/a/b/c/RecordTests.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2021 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 + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package a.b.c; +record R(int i, String s) {} + +public class RecordTests { + + public static void main(String[] args) { + RecordTests dt = new RecordTests(); + } + +} diff --git a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java index c1656b871..f486539ca 100644 --- a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java +++ b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corporation and others. + * Copyright (c) 2000, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -8,6 +8,10 @@ * * SPDX-License-Identifier: EPL-2.0 * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Jesper S. Møller - bug 422029: [1.8] Enable debug evaluation support for default methods @@ -63,6 +67,7 @@ public class JavaProjectHelper { 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"; public static final String JAVA_SE_9_EE_NAME = "JavaSE-9"; + public static final String JAVA_SE_16_EE_NAME = "JavaSE-16"; /** * path to the test src for 'testprograms' @@ -85,6 +90,10 @@ public class JavaProjectHelper { * path to the 9 test source */ public static final IPath TEST_9_SRC_DIR = new Path("java9"); + /** + * path to the 16 test source + */ + public static final IPath TEST_16_SRC_DIR = new Path("java16_"); /** * path to the compiler error java file @@ -139,6 +148,15 @@ public class JavaProjectHelper { } /** + * Returns if the currently running VM is version compatible with Java 16 + * + * @return <code>true</code> if a Java 16 (or greater) VM is running <code>false</code> otherwise + */ + public static boolean isJava16_Compatible() { + return isCompatible(16); + } + + /** * Returns if the current running system is compatible with the given Java minor version * * @param ver the version to test - either 4, 5, 6, 7 or 8 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 ab32cb61d..23c02e269 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 @@ -8,6 +8,10 @@ * * SPDX-License-Identifier: EPL-2.0 * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Jesper Steen Møller - bug 422029: [1.8] Enable debug evaluation support for default methods @@ -187,6 +191,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation 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 ONESIX_PROJECT_NAME = "One_Six"; public static final String BOUND_JRE_PROJECT_NAME = "BoundJRE"; public static final String CLONE_SUFFIX = "Clone"; @@ -239,6 +244,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation private static boolean loaded17 = false; private static boolean loaded18 = false; private static boolean loaded9 = false; + private static boolean loaded16_ = false; private static boolean loadedEE = false; private static boolean loadedJRE = false; private static boolean loadedMulti = false; @@ -270,6 +276,8 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation loaded18 = pro.exists(); pro = ResourcesPlugin.getWorkspace().getRoot().getProject(NINE_PROJECT_NAME); loaded9 = pro.exists(); + pro = ResourcesPlugin.getWorkspace().getRoot().getProject(ONESIX_PROJECT_NAME); + loaded16_ = pro.exists(); pro = ResourcesPlugin.getWorkspace().getRoot().getProject(BOUND_JRE_PROJECT_NAME); loadedJRE = pro.exists(); pro = ResourcesPlugin.getWorkspace().getRoot().getProject(BOUND_EE_PROJECT_NAME); @@ -537,6 +545,34 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation } /** + * Creates the Java 16 compliant project + */ + synchronized void assert16_Project() { + IJavaProject jp = null; + ArrayList<ILaunchConfiguration> cfgs = new ArrayList<>(1); + try { + if (!loaded16_) { + jp = createProject(ONESIX_PROJECT_NAME, JavaProjectHelper.TEST_16_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_16_EE_NAME, false); + cfgs.add(createLaunchConfiguration(jp, "RecordTests")); + loaded16_ = 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, ONESIX_PROJECT_NAME, jp); + } + } + + /** * Creates the 'BoundJRE' project used for the JRE testing */ synchronized void assertBoundJreProject() { @@ -760,6 +796,16 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation * * @return the test project */ + protected IJavaProject get16_Project() { + assert16_Project(); + return getJavaProject(ONESIX_PROJECT_NAME); + } + + /** + * Returns the 'DebugTests' project. + * + * @return the test project + */ protected IJavaProject get14Project() { assert14Project(); return getJavaProject(ONE_FOUR_PROJECT_NAME); 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 ff5a25399..5da7132f1 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2020 IBM Corporation and others. + * Copyright (c) 2000, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -8,6 +8,10 @@ * * SPDX-License-Identifier: EPL-2.0 * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * SAP SE - Support hyperlinks for stack entries with method signature @@ -38,6 +42,7 @@ import org.eclipse.jdt.debug.tests.breakpoints.MethodBreakpointTests15; import org.eclipse.jdt.debug.tests.breakpoints.MiscBreakpointsTests; import org.eclipse.jdt.debug.tests.breakpoints.PatternBreakpointTests; import org.eclipse.jdt.debug.tests.breakpoints.PreLaunchBreakpointTest; +import org.eclipse.jdt.debug.tests.breakpoints.RecordBreakpointTests; import org.eclipse.jdt.debug.tests.breakpoints.RunToLineTests; import org.eclipse.jdt.debug.tests.breakpoints.SpecialExceptionBreakpointTests; import org.eclipse.jdt.debug.tests.breakpoints.SuspendVMBreakpointsTests; @@ -384,5 +389,9 @@ public class AutomatedSuite extends DebugSuite { addTest(new TestSuite(AlternateStratumTests.class)); } addTest(new TestSuite(ConditionalBreakpointsTests.class)); + + if (JavaProjectHelper.isJava16_Compatible()) { + addTest(new TestSuite(RecordBreakpointTests.class)); + } } } diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/RecordBreakpointTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/RecordBreakpointTests.java new file mode 100644 index 000000000..4e6a03608 --- /dev/null +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/RecordBreakpointTests.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2021 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 + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.debug.tests.breakpoints; + +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.debug.core.IJavaClassPrepareBreakpoint; +import org.eclipse.jdt.debug.tests.AbstractDebugTest; + +public class RecordBreakpointTests extends AbstractDebugTest { + + public RecordBreakpointTests(String name) { + super(name); + } + + /** + * Returns the project context for the current test - each test must implement this method + */ + @Override + protected IJavaProject getProjectContext() { + return get16_Project(); + } + public void testRecordClassBreakpoint() throws Exception { + + try { + // create a classLoad breakpoint to test + IJavaClassPrepareBreakpoint classPrepareBreakpoint = createClassPrepareBreakpoint("a.b.c.RecordTests"); + assertEquals("wrong type name", "a.b.c.RecordTests", classPrepareBreakpoint.getTypeName()); + } catch (Exception e) { + throw e; + } finally { + removeAllBreakpoints(); + } + } + +} |
