Skip to content

Commit

Permalink
Upgrade test configuration to JavaSE-23 eclipse-jdt#483
Browse files Browse the repository at this point in the history
  • Loading branch information
jarthana committed Sep 5, 2024
1 parent 125facd commit efc1dca
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pipeline {
xvnc(useXauthority: true) {
sh """
mvn clean verify --batch-mode --fail-at-end -Dmaven.repo.local=$WORKSPACE/.m2/repository \
-Ptest-on-javase-21 -Pbree-libs -Papi-check -Pjavadoc\
-Ptest-on-javase-23 -Pbree-libs -Papi-check -Pjavadoc\
-Dmaven.test.failure.ignore=true\
-Dcompare-version-with-baselines.skip=false \
-Dproject.build.sourceEncoding=UTF-8 \
Expand Down
6 changes: 3 additions & 3 deletions org.eclipse.jdt.debug.jdi.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012, 2022 Eclipse Foundation and others.
Copyright (c) 2012, 2024 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
Expand Down Expand Up @@ -59,7 +59,7 @@
</build>
<profiles>
<profile>
<id>test-on-javase-21</id>
<id>test-on-javase-23</id>
<build>
<plugins>
<plugin>
Expand All @@ -76,7 +76,7 @@
<configuration>
<toolchains>
<jdk>
<id>JavaSE-21</id>
<id>JavaSE-23</id>
</jdk>
</toolchains>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2022 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -739,8 +739,7 @@ private void launchJavaTarget() {

commandLine.add("-classpath");
commandLine.add(fClassPath);
commandLine.add("-Xdebug");
commandLine.add("-Xnoagent");
addDebugOptions(commandLine);
commandLine.add("-Djava.compiler=NONE");
commandLine.add("-Xrunjdwp:transport=dt_socket,address=" + fBackEndPort + ",suspend=y,server=y");
injectVMArgs(commandLine);
Expand Down Expand Up @@ -783,8 +782,7 @@ private void launchSunTarget() {
}
commandLine.add("-classpath");
commandLine.add(fClassPath);
commandLine.add("-Xdebug");
commandLine.add("-Xnoagent");
addDebugOptions(commandLine);
commandLine.add("-Djava.compiler=NONE");
commandLine.add("-Xrunjdwp:transport=dt_socket,address=" + fBackEndPort + ",suspend=y,server=y");
injectVMArgs(commandLine);
Expand Down Expand Up @@ -818,8 +816,7 @@ private void launchIBMTarget() {

commandLine.add("-classpath");
commandLine.add(fClassPath);
commandLine.add("-Xdebug");
commandLine.add("-Xnoagent");
addDebugOptions(commandLine);
commandLine.add("-Djava.compiler=NONE");
commandLine.add("-Xrunjdwp:transport=dt_socket,address=" + fBackEndPort + ",suspend=y,server=y");
injectVMArgs(commandLine);
Expand All @@ -832,6 +829,26 @@ private void launchIBMTarget() {
}
}

private void addDebugOptions(Vector<String> commandLine) {
int vmVersion = 0;
try {
String versionString = System.getProperty("java.specification.version");
if (versionString != null) {
String[] nums = versionString.split("\\.");
if (nums.length > 0) {
vmVersion = Integer.parseInt(nums[0]);
}
}
} catch (Exception e) {
// Ignore
}
if (vmVersion < 22) {
commandLine.add("-Xdebug");
}
if (vmVersion < 23) {
commandLine.add("-Xnoagent");
}
}
protected String getMainClassName() {
return "org.eclipse.debug.jdi.tests.program.MainClass";
}
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.jdt.debug.tests/build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2003, 2014 IBM Corporation and others.
# Copyright (c) 2003, 2024 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -26,7 +26,7 @@ bin.includes = plugin.xml,\
java8/,\
java9/,\
java16_/,\
java22/
java23/
source.javadebugtests.jar = test plugin/,\
tests/,\
console tests/
Expand Down
6 changes: 3 additions & 3 deletions org.eclipse.jdt.debug.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012, 2023 Eclipse Foundation and others.
Copyright (c) 2012, 2024 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
Expand Down Expand Up @@ -48,7 +48,7 @@
</build>
<profiles>
<profile>
<id>test-on-javase-21</id>
<id>test-on-javase-23</id>
<build>
<plugins>
<plugin>
Expand All @@ -65,7 +65,7 @@
<configuration>
<toolchains>
<jdk>
<id>JavaSE-21</id>
<id>JavaSE-23</id>
</jdk>
</toolchains>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class JavaProjectHelper {
public static final String JAVA_SE_9_EE_NAME = "JavaSE-9";
public static final String JAVA_SE_16_EE_NAME = "JavaSE-16";
public static final String JAVA_SE_21_EE_NAME = "JavaSE-21";
public static final String JAVA_SE_22_EE_NAME = "JavaSE-22";
public static final String JAVA_SE_23_EE_NAME = "JavaSE-23";

/**
* path to the test src for 'testprograms'
Expand Down Expand Up @@ -97,9 +97,9 @@ public class JavaProjectHelper {
*/
public static final IPath TEST_21_SRC_DIR = new Path("java21");
/**
* path to the 22 test source
* path to the 23 test source
*/
public static final IPath TEST_22_SRC_DIR = new Path("java22");
public static final IPath TEST_23_SRC_DIR = new Path("java23");

/**
* path to the compiler error java file
Expand Down Expand Up @@ -181,12 +181,12 @@ public static boolean isJava21_Compatible() {
}

/**
* Returns if the currently running VM is version compatible with Java 22
* Returns if the currently running VM is version compatible with Java 23
*
* @return <code>true</code> if a Java 22 (or greater) VM is running <code>false</code> otherwise
* @return <code>true</code> if a Java 23 (or greater) VM is running <code>false</code> otherwise
*/
public static boolean isJava22_Compatible() {
return isCompatible(22);
public static boolean isJava23_Compatible() {
return isCompatible(23);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
public static final String NINE_PROJECT_NAME = "Nine";
public static final String ONESIX_PROJECT_NAME = "One_Six";
public static final String TWENTYONE_PROJECT_NAME = "Two_One";
public static final String TWENTYTWO_PROJECT_NAME = "Two_Two";
public static final String TWENTYTHREE_PROJECT_NAME = "Two_Three";
public static final String BOUND_JRE_PROJECT_NAME = "BoundJRE";
public static final String CLONE_SUFFIX = "Clone";

Expand Down Expand Up @@ -236,7 +236,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
private static boolean loaded9 = false;
private static boolean loaded16_ = false;
private static boolean loaded21 = false;
private static boolean loaded22 = false;
private static boolean loaded23 = false;
private static boolean loadedEE = false;
private static boolean loadedJRE = false;
private static boolean loadedMulti = false;
Expand Down Expand Up @@ -617,18 +617,20 @@ synchronized void assert21Project() {
}

/**
* Creates the Java 21 compliant project
* Creates the Java 23 compliant project
*/
synchronized void assert22Project() {
synchronized void assert23Project() {
IJavaProject jp = null;
ArrayList<ILaunchConfiguration> cfgs = new ArrayList<>(1);
try {
if (!loaded22) {
jp = createProject(TWENTYTWO_PROJECT_NAME, JavaProjectHelper.TEST_22_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_22_EE_NAME, false);
if (!loaded23) {
jp = createProject(TWENTYTHREE_PROJECT_NAME, JavaProjectHelper.TEST_23_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_23_EE_NAME, false);
jp.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
jp.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_23);
jp.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_23);
cfgs.add(createLaunchConfiguration(jp, "Main1"));
cfgs.add(createLaunchConfiguration(jp, "Main2"));
loaded22 = true;
loaded23 = true;
waitForBuild();
}
} catch (Exception e) {
Expand All @@ -642,7 +644,7 @@ synchronized void assert22Project() {
} catch (CoreException ce) {
// ignore
}
handleProjectCreationException(e, TWENTYTWO_PROJECT_NAME, jp);
handleProjectCreationException(e, TWENTYTHREE_PROJECT_NAME, jp);
}
}

Expand Down Expand Up @@ -943,13 +945,13 @@ protected IJavaProject get21Project() {
}

/**
* Returns the 'Two_One' project, used for Java 21 tests.
* Returns the 'Two_Three' project, used for Java 23 tests.
*
* @return the test project
*/
protected IJavaProject get22Project() {
assert22Project();
return getJavaProject(TWENTYTWO_PROJECT_NAME);
protected IJavaProject get23Project() {
assert23Project();
return getJavaProject(TWENTYTHREE_PROJECT_NAME);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public AutomatedSuite() {
addTest(new TestSuite(ConfigurationEncodingTests.class));
addTest(new TestSuite(LaunchConfigurationManagerTests.class));
addTest(new TestSuite(LaunchConfigurationTests.class));
if (JavaProjectHelper.isJava22_Compatible()) {
if (JavaProjectHelper.isJava23_Compatible()) {
addTest(new TestSuite(InstanceMainMethodsTests.class));
}
addTest(new TestSuite(ProjectClasspathVariableTests.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public InstanceMainMethodsTests(String name) {

@Override
protected IJavaProject getProjectContext() {
return super.get22Project();
return super.get23Project();
}

public void testStaticMainWithoutArgs() throws Exception {
Expand Down

0 comments on commit efc1dca

Please sign in to comment.