Skip to content

Commit b21cf5f

Browse files
committed
Hibernate ORM - Reimplement isProxiable() with Jandex
1 parent 5ab060f commit b21cf5f

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ private PreGeneratedProxies generatedProxies(Set<String> managedClassAndPackageN
14001400
} else {
14011401
Set<String> proxyInterfaceNames = new TreeSet<>();
14021402
proxyInterfaceNames.add(ClassNames.HIBERNATE_PROXY.toString()); //always added
1403-
if (!proxyHelper.isProxiable(managedClassOrPackageName)) {
1403+
if (!proxyHelper.isProxiable(combinedIndex.getClassByName(managedClassOrPackageName))) {
14041404
// we need to make sure the actual class is proxiable
14051405
continue;
14061406
}
@@ -1461,7 +1461,7 @@ private boolean isModified(String entity, Set<String> changedClasses, IndexView
14611461
}
14621462
}
14631463
DotName superName = clazz.superName();
1464-
if (superName != null) {
1464+
if (superName != null && !DotName.OBJECT_NAME.equals(superName)) {
14651465
return isModified(superName.toString(), changedClasses, index);
14661466
}
14671467
return false;

extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ProxyBuildingHelper.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
import org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl;
88
import org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper;
9+
import org.jboss.jandex.ClassInfo;
910

1011
import net.bytebuddy.ClassFileVersion;
1112
import net.bytebuddy.description.method.MethodDescription;
1213
import net.bytebuddy.description.type.TypeDefinition;
13-
import net.bytebuddy.description.type.TypeDescription;
1414
import net.bytebuddy.dynamic.DynamicType;
1515
import net.bytebuddy.matcher.ElementMatcher;
1616
import net.bytebuddy.matcher.ElementMatchers;
@@ -52,17 +52,12 @@ private ByteBuddyProxyHelper getByteBuddyProxyHelper() {
5252
return this.byteBuddyProxyHelper;
5353
}
5454

55-
public boolean isProxiable(String managedClassOrPackageName) {
56-
TypePool.Resolution mappedClassResolution = typePool.describe(managedClassOrPackageName);
57-
if (!mappedClassResolution.isResolved()) {
58-
// Probably a package name - consider it's not proxiable.
59-
return false;
60-
}
61-
62-
TypeDescription mappedClass = mappedClassResolution.resolve();
63-
64-
return !mappedClass.isFinal()
65-
&& !mappedClass.getDeclaredMethods().filter(NO_ARG_CONSTRUCTOR).isEmpty();
55+
public boolean isProxiable(ClassInfo classInfo) {
56+
return classInfo != null
57+
&& !classInfo.isInterface()
58+
&& !classInfo.isAbstract()
59+
&& !classInfo.isFinal()
60+
&& classInfo.hasNoArgsConstructor();
6661
}
6762

6863
@Override

0 commit comments

Comments
 (0)