From b5a6424f2b4e867c99335fded8f5f5d2c7209708 Mon Sep 17 00:00:00 2001 From: Mark Struberg Date: Tue, 18 Jul 2023 10:53:54 +0200 Subject: [PATCH] OPENJPA-2911 isCloneable via ClassNodeTracker --- .../main/java/org/apache/openjpa/enhance/PCEnhancer.java | 2 +- .../org/apache/openjpa/util/asm/ClassNodeTracker.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java index 1b12b0828..7f20408a8 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java @@ -4076,7 +4076,7 @@ public class PCEnhancer { if (cloneMeth == null) { // add clone support for base classes // which also implement cloneable - boolean isCloneable = Cloneable.class.isAssignableFrom(_managedType.getType()); + boolean isCloneable = Cloneable.class.isAssignableFrom(managedType.getType()); boolean extendsObject = superName.equals(Object.class.getName()); if (!isCloneable || (!extendsObject && !getCreateSubclass())) { return; diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/asm/ClassNodeTracker.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/asm/ClassNodeTracker.java index a9e911421..1b08b1a52 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/asm/ClassNodeTracker.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/asm/ClassNodeTracker.java @@ -39,4 +39,13 @@ public class ClassNodeTracker { public ClassLoader getClassLoader() { return cl; } + + public Class getType() { + try { + return Class.forName(classNode.name.replace("/", "."), false, cl); + } + catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } }