diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java
index 00fb49e11a23b..7e1e7a722cf6b 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java
@@ -6,6 +6,8 @@ public final class GeneratedClassBuildItem extends MultiBuildItem {
final boolean applicationClass;
final String name;
+ String binaryName;
+ String internalName;
final byte[] classData;
final String source;
@@ -27,10 +29,38 @@ public boolean isApplicationClass() {
return applicationClass;
}
+ /**
+ * {@return a name for this class}
+ * @deprecated This method may return the binary name, the internal name, or a hybrid thereof and should not be
+ * used. Use {@link #binaryName()} or {@link #internalName()} instead.
+ */
+ @Deprecated(forRemoval = true)
public String getName() {
return name;
}
+ /**
+ * {@return the binary name of the class, which is delimited by .
characters}
+ */
+ public String binaryName() {
+ String binaryName = this.binaryName;
+ if (binaryName == null) {
+ binaryName = this.binaryName = name.replace('/', '.');
+ }
+ return binaryName;
+ }
+
+ /**
+ * {@return the internal name of the class, which is delimited by /
characters}
+ */
+ public String internalName() {
+ String internalName = this.internalName;
+ if (internalName == null) {
+ internalName = this.internalName = name.replace('.', '/');
+ }
+ return internalName;
+ }
+
public byte[] getClassData() {
return classData;
}
@@ -39,4 +69,7 @@ public String getSource() {
return source;
}
+ public String toString() {
+ return "GeneratedClassBuildItem[" + binaryName() + "]";
+ }
}
diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java
index cc971ba643bcb..e0e5b9e4d437e 100644
--- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java
+++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java
@@ -131,11 +131,12 @@ boolean isKafkaConnector(List list, boolean in
});
assertThat(generated)
- .extracting(GeneratedClassBuildItem::getName)
+ .extracting(GeneratedClassBuildItem::internalName)
.allSatisfy(s -> assertThat(generatedNames).satisfiesOnlyOnce(c -> c.apply(s)));
assertThat(reflective)
.flatExtracting(ReflectiveClassBuildItem::getClassNames)
+ .extracting(n -> n.replace('/', '.'))
.allSatisfy(s -> assertThat(reflectiveNames).satisfiesOnlyOnce(c -> c.apply(s)));
} finally {
// must not leak the lazily-initialized Config instance associated to the system classloader