From f986c3d18386e77c974e4272ab27c3b573773c9b Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Sun, 28 Jan 2024 16:13:22 +0700 Subject: Workaround for defining classes during LTW Overhaul ClassLoaderWeavingAdaptor to use statically initialised Unsafe instances and method handles pointing to their 'defineClass' methods. Those now work universally on JDKs 8-21. In older JDKs, the method used to be in sun.misc.Unsafe, in more recent ones on jdk.internal.misc.Unsafe. It is challenging to fetch instances, especially as reflection protection and module boundaries have been increased in the JDK progressively. But finally, a solution was adapted from Byte Buddy (BB). Kudos to BB author Rafael Winterhalter. The previous solution to use ClassLoader::defineClass and require '--add-opens' is no longer necessary for the first time since it became necessary in AspectJ 1.9.7 with Java 16 support. Add org.ow2.asm:asm-common as a dependency everywhere org.ow2.asm:asm was used before. Maybe that is too many places, but no worse than before. Add missing dependency on loadtime to aspectjweaver. This kept a build like "mvn install -am -pl aspectjweaver" from picking up changed loadtime classes. Fixes #117. Signed-off-by: Alexander Kriegisch --- aspectjweaver/aspectjweaver-assembly.xml | 1 + aspectjweaver/pom.xml | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'aspectjweaver') diff --git a/aspectjweaver/aspectjweaver-assembly.xml b/aspectjweaver/aspectjweaver-assembly.xml index 576bb2700..877ddf6b1 100644 --- a/aspectjweaver/aspectjweaver-assembly.xml +++ b/aspectjweaver/aspectjweaver-assembly.xml @@ -17,6 +17,7 @@ false org.ow2.asm:asm + org.ow2.asm:asm-commons diff --git a/aspectjweaver/pom.xml b/aspectjweaver/pom.xml index 34cefc74c..c5702e2aa 100644 --- a/aspectjweaver/pom.xml +++ b/aspectjweaver/pom.xml @@ -389,10 +389,19 @@ weaver ${project.version} + + org.aspectj + loadtime + ${project.version} + org.ow2.asm asm + + org.ow2.asm + asm-commons + -- cgit v1.2.3