[Git][java-team/libreflectasm-java][master] 2 commits: Updating ConstructorAccessTest to fit OpenJDK17

Pierre Gruet (@pgt) gitlab at salsa.debian.org
Fri Nov 11 07:46:42 GMT 2022



Pierre Gruet pushed to branch master at Debian Java Maintainers / libreflectasm-java


Commits:
acc2be32 by Pierre Gruet at 2022-11-11T07:44:32+01:00
Updating ConstructorAccessTest to fit OpenJDK17

- - - - -
cbe1d6c4 by Pierre Gruet at 2022-11-11T07:44:44+01:00
Upload to unstable

- - - - -


3 changed files:

- debian/changelog
- debian/patches/series
- + debian/patches/switching_to_OpenJDK17.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libreflectasm-java (1.11.9+dfsg-2) unstable; urgency=medium
+
+  * Updating ConstructorAccessTest to fit the changes in class loading
+    brought by OpenJDK17 (Closes: #1012106)
+
+ -- Pierre Gruet <pgt at debian.org>  Fri, 11 Nov 2022 07:44:35 +0100
+
 libreflectasm-java (1.11.9+dfsg-1) unstable; urgency=medium
 
   * New upstream version 1.11.9+dfsg


=====================================
debian/patches/series
=====================================
@@ -2,3 +2,4 @@ javadoc.patch
 no_shading.patch
 generate_1_6_classes.patch
 #ignore_test_automatic_unloading.patch
+switching_to_OpenJDK17.patch


=====================================
debian/patches/switching_to_OpenJDK17.patch
=====================================
@@ -0,0 +1,119 @@
+Description: updating ConstructorAccessTest.java to fit the changes in class
+ loading brought by OpenJDK17. These changes will be in next upstream version.
+Author: Pierre Gruet <pgt at debian.org>
+Origin: upstream, https://github.com/EsotericSoftware/reflectasm/commit/cad4d755114e80169727fd030c85d55db3997bd8
+Bug: https://github.com/EsotericSoftware/reflectasm/issues/89
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1012106
+Last-Update: 2022-11-11
+
+--- a/test/com/esotericsoftware/reflectasm/ConstructorAccessTest.java
++++ b/test/com/esotericsoftware/reflectasm/ConstructorAccessTest.java
+@@ -14,11 +14,21 @@
+ 
+ package com.esotericsoftware.reflectasm;
+ 
+-import static junit.framework.Assert.assertEquals;
+-import static junit.framework.Assert.assertTrue;
++import java.util.List;
++
+ import junit.framework.TestCase;
+ 
+ public class ConstructorAccessTest extends TestCase {
++    static private boolean java17;
++	static {
++		try {
++			Object version = Runtime.class.getDeclaredMethod("version").invoke(null);
++			java17 = ((List<Integer>)version.getClass().getDeclaredMethod("version").invoke(version)).get(0) >= 17;
++		} catch (Exception ignored) {
++			java17 = false;
++		}
++	}
++
+ 	public void testNewInstance () {
+ 		ConstructorAccess<SomeClass> access = ConstructorAccess.get(SomeClass.class);
+ 		SomeClass someObject = new SomeClass();
+@@ -28,6 +38,7 @@
+ 	}
+ 
+ 	public void testPackagePrivateNewInstance () {
++        if (java17) return;
+ 		ConstructorAccess<PackagePrivateClass> access = ConstructorAccess.get(PackagePrivateClass.class);
+ 		PackagePrivateClass someObject = new PackagePrivateClass();
+ 		assertEquals(someObject, access.newInstance());
+@@ -44,7 +55,7 @@
+ 			System.out.println("Expected exception happened: " + re);
+ 		}
+ 		catch (Throwable t) {
+-			System.out.println("Unexpected exception happened: " + t);
++            t.printStackTrace();
+ 			assertTrue(false);
+ 		}
+ 	}
+@@ -58,31 +69,33 @@
+ 			System.out.println("Expected exception happened: " + re);
+ 		}
+ 		catch (Throwable t) {
+-			System.out.println("Unexpected exception happened: " + t);
++            t.printStackTrace();
+ 			assertTrue(false);
+ 		}
+ 	}
+ 
+ 	public void testHasProtectedConstructor () {
++        if (java17) return;
+ 		try {
+ 			ConstructorAccess<HasProtectedConstructor> access = ConstructorAccess.get(HasProtectedConstructor.class);
+ 			HasProtectedConstructor newInstance = access.newInstance();
+ 			assertEquals("cow", newInstance.getMoo());
+ 		}
+ 		catch (Throwable t) {
+-			System.out.println("Unexpected exception happened: " + t);
++            t.printStackTrace();
+ 			assertTrue(false);
+ 		}
+ 	}
+ 
+-	public void testHasPackageProtectedConstructor () {
++	public void testHasPackagePrivateConstructor () {
++        if (java17) return;
+ 		try {
+-			ConstructorAccess<HasPackageProtectedConstructor> access = ConstructorAccess.get(HasPackageProtectedConstructor.class);
+-			HasPackageProtectedConstructor newInstance = access.newInstance();
++			ConstructorAccess<HasPackagePrivateConstructor> access = ConstructorAccess.get(HasPackagePrivateConstructor.class);
++			HasPackagePrivateConstructor newInstance = access.newInstance();
+ 			assertEquals("cow", newInstance.getMoo());
+ 		}
+ 		catch (Throwable t) {
+-			System.out.println("Unexpected exception happened: " + t);
++            t.printStackTrace();
+ 			assertTrue(false);
+ 		}
+ 	}
+@@ -94,7 +107,7 @@
+ 			assertEquals("cow", newInstance.getMoo());
+ 		}
+ 		catch (Throwable t) {
+-			System.out.println("Unexpected exception happened: " + t);
++            t.printStackTrace();
+ 			assertTrue(false);
+ 		}
+ 	}
+@@ -189,14 +202,14 @@
+ 		}
+ 	}
+ 
+-	static public class HasPackageProtectedConstructor extends HasProtectedConstructor {
+-		HasPackageProtectedConstructor () {
++	static public class HasPackagePrivateConstructor extends HasProtectedConstructor {
++		HasPackagePrivateConstructor () {
+ 			super();
+ 		}
+ 	}
+ 
+-	static public class HasPublicConstructor extends HasPackageProtectedConstructor {
+-		HasPublicConstructor () {
++	static public class HasPublicConstructor extends HasPackagePrivateConstructor {
++		public HasPublicConstructor () {
+ 			super();
+ 		}
+ 	}



View it on GitLab: https://salsa.debian.org/java-team/libreflectasm-java/-/compare/23667f4ca12bb2b131bf053e3ba62eb762f4f411...cbe1d6c440745c1829fafd356cc53cc8833fe511

-- 
View it on GitLab: https://salsa.debian.org/java-team/libreflectasm-java/-/compare/23667f4ca12bb2b131bf053e3ba62eb762f4f411...cbe1d6c440745c1829fafd356cc53cc8833fe511
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/20221111/6a556112/attachment.htm>


More information about the pkg-java-commits mailing list