[Git][java-team/junit4][master] 3 commits: d/p/java25-compatibility.patch: workaround Security Manager removal (Closes: #1108571).

Tony Mancill (@tmancill) gitlab at salsa.debian.org
Sun Mar 22 23:16:05 GMT 2026



Tony Mancill pushed to branch master at Debian Java Maintainers / junit4


Commits:
80e0d602 by Vladimir Petko at 2025-12-03T19:00:15+13:00
d/p/java25-compatibility.patch: workaround Security Manager removal (Closes: #1108571).

- - - - -
047658cd by Vladimir Petko at 2025-12-03T19:00:19+13:00
d/maven.properties: remove security manager argument

- - - - -
6970da2b by Vladimir Petko at 2025-12-03T19:00:20+13:00
changelog

- - - - -


4 changed files:

- debian/changelog
- debian/maven.properties
- + debian/patches/java25-compatibility.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+junit4 (4.13.2-6) UNRELEASED; urgency=medium
+
+  * Java 25 compatibility - workaround Security Manager
+    removal (Closes: #1108571).
+    - d/p/java25-compatibility.patch: use JUnitCore.main() implementation
+      in the test runner tests.
+    - d/maven.properties: remove Security Manager property.
+
+ -- Vladimir Petko <vladimir.petko at canonical.com>  Wed, 03 Dec 2025 18:38:30 +1300
+
 junit4 (4.13.2-5) unstable; urgency=medium
 
   * Removed the javadoc from the documentation package


=====================================
debian/maven.properties
=====================================
@@ -1,2 +1 @@
 maven.compiler.release=8
-argLine=-Djava.security.manager=allow


=====================================
debian/patches/java25-compatibility.patch
=====================================
@@ -0,0 +1,88 @@
+Description: Java 25 - workaround security manager removal
+ Java 25 removes Security Manager. The patch replaces call to JUnitCore.main() method
+ with its implementation, avoid the call to System.exit().
+ The patch uses reflection to access package-local APIs to avoid changing public
+ JUnit API.
+ The patch is not needed upstream as the project is in maintenance mode and does
+ not accept new feature requests.
+Author: Vladimir Petko <vladimir.petko at canonical.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1108571
+Forwarded: not-needed
+Last-Update: 2025-12-03
+
+--- a/src/test/java/org/junit/tests/running/core/JUnitCoreReturnsCorrectExitCodeTest.java
++++ b/src/test/java/org/junit/tests/running/core/JUnitCoreReturnsCorrectExitCodeTest.java
+@@ -2,8 +2,10 @@
+ 
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.fail;
+-
++import java.lang.reflect.Method;
+ import org.junit.Test;
++import org.junit.internal.JUnitSystem;
++import org.junit.internal.RealSystem;
+ import org.junit.runner.JUnitCore;
+ 
+ public class JUnitCoreReturnsCorrectExitCodeTest {
+@@ -37,11 +39,16 @@
+     }
+ 
+     private void runClass(final String className, int returnCode) {
+-        Integer exitValue = new MainRunner().runWithCheckForSystemExit(new Runnable() {
+-            public void run() {
+-                JUnitCore.main(className);
+-            }
+-        });
+-        assertEquals(Integer.valueOf(returnCode), exitValue);
++        try {
++            Class core = JUnitCore.class;
++            Method m = core.getDeclaredMethod("runMain", JUnitSystem.class, String[].class);
++            m.setAccessible(true);
++
++            Integer exitValue = ((org.junit.runner.Result)m.invoke(new JUnitCore(), new RealSystem(), new String[]{className})).wasSuccessful() ? 0 : 1;
++            assertEquals(Integer.valueOf(returnCode), exitValue);
++        }
++        catch (Throwable t){
++            throw new RuntimeException(t);
++        }
+     }
+ }
+--- a/src/test/java/org/junit/tests/running/core/CommandLineTest.java
++++ b/src/test/java/org/junit/tests/running/core/CommandLineTest.java
+@@ -5,11 +5,14 @@
+ 
+ import java.io.ByteArrayOutputStream;
+ import java.io.PrintStream;
+-
++import java.lang.reflect.Method;
+ import org.junit.After;
+ import org.junit.Before;
+ import org.junit.Test;
++import org.junit.internal.JUnitSystem;
++import org.junit.internal.RealSystem;
+ import org.junit.runner.JUnitCore;
++import org.junit.tests.running.core.CommandLineTest.Count;
+ 
+ public class CommandLineTest {
+     private ByteArrayOutputStream results;
+@@ -36,13 +39,14 @@
+     }
+ 
+     @Test
+-    public void runATest() {
++    public void runATest() throws Throwable {
+         testWasRun = false;
+-        new MainRunner().runWithCheckForSystemExit(new Runnable() {
+-            public void run() {
+-                JUnitCore.main("org.junit.tests.running.core.CommandLineTest$Example");
+-            }
+-        });
++        Class core = JUnitCore.class;
++        Method m = core.getDeclaredMethod("runMain", JUnitSystem.class, String[].class);
++        m.setAccessible(true);
++
++        m.invoke(new JUnitCore(), new RealSystem(),
++            new String[]{"org.junit.tests.running.core.CommandLineTest$Example"});
+         assertTrue(testWasRun);
+     }
+ 


=====================================
debian/patches/series
=====================================
@@ -3,3 +3,4 @@ Version.patch
 java17-compatibility.patch
 hamcrest-compatibility.patch
 java21-compatibility.patch
+java25-compatibility.patch



View it on GitLab: https://salsa.debian.org/java-team/junit4/-/compare/d8c58a944f4e98ea2ec0c6bb9e6a6d958a632825...6970da2bdf1134a06ab4e5852656b7ec16ae7312

-- 
View it on GitLab: https://salsa.debian.org/java-team/junit4/-/compare/d8c58a944f4e98ea2ec0c6bb9e6a6d958a632825...6970da2bdf1134a06ab4e5852656b7ec16ae7312
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20260322/d2cf26d0/attachment.htm>


More information about the pkg-java-commits mailing list