diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-09 12:53:13 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-09 12:53:13 +0700 |
commit | 45d593b8cbc90432853b0e5b9662478b09388783 (patch) | |
tree | 490af8deaeb883d646efe14b893a202b5147cfca /loadtime | |
parent | dbce4ca387fec90afb2f8044cdc48d0d4682edff (diff) | |
download | aspectj-45d593b8cbc90432853b0e5b9662478b09388783.tar.gz aspectj-45d593b8cbc90432853b0e5b9662478b09388783.zip |
Add implementation note and JDK-8325536 link to Aj.preProcess
See https://bugs.openjdk.org/browse/JDK-8325536.
Relates to #277.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'loadtime')
-rw-r--r-- | loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java index a8526ee55..4dbda9023 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java @@ -76,6 +76,11 @@ public class Aj implements ClassPreProcessor { @Override public byte[] preProcess(String className, final byte[] bytes, ClassLoader classLoader, ProtectionDomain protectionDomain) { + + // Implementation note: Try to return null, whenever it is clear that the original byte code was not changed by the + // weaver. While not strictly necessary, the changes from commit 3e3c83712e are defensive programming, which helps + // to avoid problems like https://bugs.openjdk.org/browse/JDK-8325536, even if unfixed in the JDK. + if (classLoader == null || className == null || classLoader.getClass().getName().equals(deleLoader) || classLoader.getClass().getName().equals(deleLoader2)) { // skip boot loader, null classes (hibernate), or those from a reflection loader |