From 0383ce513439517851130a014c1d3660ee54c648 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Wed, 3 Apr 2024 16:50:59 +0200 Subject: [PATCH] Adjust OSGiWeavingAdaptor::weaveClass to AspectJ weaver changes Since 1.9.21.2, the AspectJ weaver, like other canonical Java instrumentation agents, returns null, if nothing was woven. We accommodate to that change here. --- .../weaving/aspectj/loadtime/OSGiWeavingAdaptor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java b/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java index 444f2c5f6b..549ad981ec 100644 --- a/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java +++ b/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java @@ -270,7 +270,11 @@ public byte[] weaveClass(final String name, byte[] bytes, } synchronized (this) { - bytes = super.weaveClass(name, bytes, mustWeave); + byte[] wovenBytes = super.weaveClass(name, bytes, mustWeave); + // Since 1.9.21.2, the AspectJ weaver, like other canonical Java instrumentation agents, returns null, + // if nothing was woven. We accommodate to that change here. + if (wovenBytes != null) + bytes = wovenBytes; } ((OSGiGeneratedClassHandler) this.generatedClassHandler)