You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/04/02 22:30:29 UTC

[maven-surefire] branch release/2.22.3 updated: a probable root cause illegal-access

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch release/2.22.3
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/release/2.22.3 by this push:
     new 57869d1  a probable root cause illegal-access
57869d1 is described below

commit 57869d18337f7bb8652e546039e006b587456ba4
Author: tibordigana <ti...@apache.org>
AuthorDate: Sun Apr 3 00:30:09 2022 +0200

    a probable root cause illegal-access
---
 .../org/apache/maven/surefire/its/CheckTestNgVersionsIT.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java
index b6c05ce..474f76f 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java
@@ -29,6 +29,8 @@ import org.apache.maven.surefire.its.fixture.SurefireLauncher;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import static org.apache.commons.lang3.JavaVersion.JAVA_9;
+import static org.apache.commons.lang3.JavaVersion.JAVA_RECENT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -173,6 +175,16 @@ public class CheckTestNgVersionsIT
             launcher.sysProp( "testNgClassifier", classifier );
         }
 
+        if ( ( version.startsWith( "5.12" ) || version.startsWith( "5.13" ) || version.startsWith( "5.14" ) )
+                && JAVA_RECENT.atLeast( JAVA_9 ) )
+        {
+            // TestNG 5.12 - 5.14 uses Guava lib ang CGLib with reflective access.
+            // WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.ReflectUtils$2
+            // (testng-5.12.1.jar) to method
+            // java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
+            launcher.argLine( "--illegal-access=deny --add-opens java.base/java.lang=ALL-UNNAMED" );
+        }
+
         final OutputValidator outputValidator = launcher.executeTest();
 
         outputValidator.assertTestSuiteResults( 3, 0, 0, 0 );