Skip to content

Commit

Permalink
feat: update libreflectasm-java to 1.11.9+dfsg
Browse files Browse the repository at this point in the history
library that provides reflection by using code generation

Issue: deepin-community/sig-deepin-sysdev-team#547
Log: update repo
  • Loading branch information
xzl01 committed Apr 23, 2024
1 parent 237285a commit e05a353
Show file tree
Hide file tree
Showing 21 changed files with 474 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<classpath>
<classpathentry excluding="**/.svn/*" kind="src" path="src"/>
<classpathentry excluding="**/.svn/*" kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="build/junit-4.6.jar"/>
<classpathentry kind="lib" path="lib/asm-5.1.jar"/>
<classpathentry kind="output" path="bin"/>
Expand Down
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

7 changes: 7 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
19 changes: 1 addition & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,10 @@ To use reflectasm with maven, please use the following snippet in your pom.xml
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>reflectasm</artifactId>
<version>1.11.3</version>
<version>1.11.7</version>
</dependency>
```

If you already have asm in a different version (than the one pulled in by reflectasm - see pom.xml) in your classpath, you should use the shaded reflectasm (contains relocated asm classes):

```xml
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>reflectasm</artifactId>
<version>1.11.3</version>
<classifier>shaded</classifier>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
```

## Usage

Method reflection with ReflectASM:
Expand Down
32 changes: 32 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
libreflectasm-java (1.11.9+dfsg-4) unstable; urgency=medium

* Deactivating flaky assertion in ClassLoaderTest (Closes: #1031480)
* Raising Standards version to 4.6.2 (no change)
* Removing unneeded versioned B-D on javahelper

-- Pierre Gruet <[email protected]> Fri, 17 Feb 2023 21:51:44 +0100

libreflectasm-java (1.11.9+dfsg-3) unstable; urgency=medium

* Stopping build-depending on dropped libasm-java-doc (Closes: #1025838)

-- Pierre Gruet <[email protected]> Sat, 10 Dec 2022 14:18:59 +0100

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 <[email protected]> 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
* Refreshing patches
* Raising Standards version to 4.6.1 (no change)
* Updating d/watch after a change in the Github layout
* Adding a Lintian override for the bad-jar-name warning
* Refreshing the Lintian override for the embedded Javascript

-- Pierre Gruet <[email protected]> Thu, 22 Sep 2022 16:23:33 +0200

libreflectasm-java (1.11.6+dfsg-1) unstable; urgency=medium

* Bumping Standards version to 4.6.0 (no change)
Expand Down
5 changes: 2 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ Maintainer: Debian Java Maintainers <[email protected]
Uploaders: Pierre Gruet <[email protected]>
Build-Depends: debhelper-compat (= 13),
default-jdk-headless,
javahelper (>= 0.43),
javahelper,
maven-debian-helper,
libmaven-assembly-plugin-java,
libmaven-bundle-plugin-java,
libmaven-javadoc-plugin-java,
libasm-java,
libasm-java-doc,
junit4 <!nocheck>
Standards-Version: 4.6.0
Standards-Version: 4.6.2
Vcs-Git: https://salsa.debian.org/java-team/libreflectasm-java.git
Vcs-Browser: https://salsa.debian.org/java-team/libreflectasm-java
Homepage: https://github.com/EsotericSoftware/reflectasm
Expand Down
2 changes: 1 addition & 1 deletion debian/libreflectasm-java-doc.lintian-overrides
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# It would be too complicated to remove the javascript that is included in
# javadocs, see the discussion on Debian Java mailing list starting at
# https://lists.debian.org/debian-java/2018/06/msg00020.html.
embedded-javascript-library usr/share/doc/libreflectasm-java/api/*/jquery*.*s *
embedded-javascript-library please use * [usr/share/doc/libreflectasm-java/api/*/jquery*.*s]
3 changes: 3 additions & 0 deletions debian/libreflectasm-java.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The indicated file is the real jar and not a symlink, but this really does
# not harm.
bad-jar-name [usr/share/java/reflectasm.jar]
26 changes: 26 additions & 0 deletions debian/patches/disable_flaky_assertion.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Description: deactivating assertions that appear to be flaky
Author: Pierre Gruet <[email protected]>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031480
Forwarded: https://github.com/EsotericSoftware/reflectasm/issues/91
Last-Update: 2023-02-17

--- a/test/com/esotericsoftware/reflectasm/ClassLoaderTest.java
+++ b/test/com/esotericsoftware/reflectasm/ClassLoaderTest.java
@@ -60,7 +60,7 @@
assertEquals(access1.getClass().toString(), access2.getClass().toString()); // Same class names
assertFalse(access1.getClass().equals(access2.getClass())); // But different classes

- assertEquals(initialCount + 2, AccessClassLoader.activeAccessClassLoaders());
+ //assertEquals(initialCount + 2, AccessClassLoader.activeAccessClassLoaders());

testClassLoader1 = null;
testClass1 = null;
@@ -74,7 +74,7 @@
reclaimLoaders();

// Yeah, reclaimed!
- assertEquals(initialCount, AccessClassLoader.activeAccessClassLoaders());
+ //assertEquals(initialCount, AccessClassLoader.activeAccessClassLoaders());
}

private void reclaimLoaders () throws Exception {
46 changes: 23 additions & 23 deletions debian/patches/generate_1_6_classes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ Last-Update: 2021-05-18

--- a/src/com/esotericsoftware/reflectasm/ConstructorAccess.java
+++ b/src/com/esotericsoftware/reflectasm/ConstructorAccess.java
@@ -91,7 +91,7 @@
: "com/esotericsoftware/reflectasm/ConstructorAccess";
@@ -89,7 +89,7 @@
: "com/esotericsoftware/reflectasm/ConstructorAccess";

ClassWriter cw = new ClassWriter(0);
- cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, superclassNameInternal, null);
+ cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, superclassNameInternal, null);
ClassWriter cw = new ClassWriter(0);
- cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, superclassNameInternal, null);
+ cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, superclassNameInternal, null);

insertConstructor(cw, superclassNameInternal);
insertNewInstance(cw, classNameInternal);
insertConstructor(cw, superclassNameInternal);
insertNewInstance(cw, classNameInternal);
--- a/src/com/esotericsoftware/reflectasm/FieldAccess.java
+++ b/src/com/esotericsoftware/reflectasm/FieldAccess.java
@@ -148,7 +148,7 @@
String classNameInternal = className.replace('.', '/');
@@ -147,7 +147,7 @@
String classNameInternal = className.replace('.', '/');

ClassWriter cw = new ClassWriter(0);
- cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null,
+ cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null,
"com/esotericsoftware/reflectasm/FieldAccess", null);
insertConstructor(cw);
insertGetObject(cw, classNameInternal, fields);
ClassWriter cw = new ClassWriter(0);
- cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, "com/esotericsoftware/reflectasm/FieldAccess",
+ cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, "com/esotericsoftware/reflectasm/FieldAccess",
null);
insertConstructor(cw);
insertGetObject(cw, classNameInternal, fields);
--- a/src/com/esotericsoftware/reflectasm/MethodAccess.java
+++ b/src/com/esotericsoftware/reflectasm/MethodAccess.java
@@ -121,7 +121,7 @@
@@ -120,7 +120,7 @@

ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
MethodVisitor mv;
- cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null,
+ cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null,
"com/esotericsoftware/reflectasm/MethodAccess", null);
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
MethodVisitor mv;
- cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, "com/esotericsoftware/reflectasm/MethodAccess",
+ cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, "com/esotericsoftware/reflectasm/MethodAccess",
null);
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
2 changes: 1 addition & 1 deletion debian/patches/javadoc.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Last-Update: 2021-05-17

--- a/pom.xml
+++ b/pom.xml
@@ -128,6 +128,11 @@
@@ -131,6 +131,11 @@
</instructions>
</configuration>
</plugin>
Expand Down
8 changes: 4 additions & 4 deletions debian/patches/no_shading.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Last-Update: 2021-05-17

--- a/pom.xml
+++ b/pom.xml
@@ -93,7 +93,7 @@
</excludes>
@@ -95,7 +95,7 @@
</archive>
</configuration>
</plugin>
- <plugin>
+ <!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
@@ -103,9 +103,9 @@
@@ -105,9 +105,9 @@
<goals>
<goal>shade</goal>
</goals>
Expand All @@ -26,7 +26,7 @@ Last-Update: 2021-05-17
<shadedArtifactAttached>false</shadedArtifactAttached>
<relocations>
<relocation>
@@ -116,7 +116,7 @@
@@ -118,7 +118,7 @@
</configuration>
</execution>
</executions>
Expand Down
4 changes: 3 additions & 1 deletion debian/patches/series
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
javadoc.patch
no_shading.patch
generate_1_6_classes.patch
ignore_test_automatic_unloading.patch
#ignore_test_automatic_unloading.patch
switching_to_OpenJDK17.patch
disable_flaky_assertion.patch
119 changes: 119 additions & 0 deletions debian/patches/switching_to_OpenJDK17.patch
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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();
}
}
2 changes: 1 addition & 1 deletion debian/watch
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=4
opts="repack,repacksuffix=+dfsg,compression=xz,dversionmangle=s/\+dfsg//" \
https://github.com/EsotericSoftware/reflectasm/releases/latest (?:.*/)?(?:reflectasm-)?([\d\.]+).tar.gz
https://github.com/EsotericSoftware/reflectasm/tags (?:.*/)?(?:reflectasm-)?([\d\.]+).tar.gz
11 changes: 7 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.esotericsoftware</groupId>
<artifactId>reflectasm</artifactId>
<version>1.11.6</version>
<version>1.11.9</version>
<packaging>bundle</packaging>
<name>ReflectASM</name>
<description>High performance Java reflection using code generation</description>
Expand Down Expand Up @@ -88,9 +88,11 @@
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<exclude>**/.svn/*</exclude>
</excludes>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.esotericsoftware.reflectasm</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -125,6 +127,7 @@
<configuration>
<instructions>
<Export-Package>com.esotericsoftware.reflectasm*</Export-Package>
<Import-Package>!org.objectweb.asm.*</Import-Package>
</instructions>
</configuration>
</plugin>
Expand Down
Loading

0 comments on commit e05a353

Please sign in to comment.