Skip to content

Commit e061ca2

Browse files
author
Haydon Perrin
committed
JsonBUtil: Throw exception if CompletableFuture is missing a generic type definition.
1 parent b7972e7 commit e061ca2

File tree

1 file changed

+5
-1
lines changed
  • http-generator-core/src/main/java/io/avaje/http/generator/core

1 file changed

+5
-1
lines changed

http-generator-core/src/main/java/io/avaje/http/generator/core/JsonBUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ private static void addJsonBodyType(MethodReader methodReader, Consumer<UType> a
5151

5252
public static void writeJsonbType(UType type, Append writer) {
5353
// Support for CompletableFuture's.
54-
if (type.isGeneric() && type.mainType().equals("java.util.concurrent.CompletableFuture")) {
54+
if (type.mainType().equals("java.util.concurrent.CompletableFuture")) {
55+
if (!type.isGeneric()) {
56+
throw new IllegalStateException("CompletableFuture usages must have a generic type defined. e.g. `CompletableFuture<String>` or `CompletableFuture<Void>`.");
57+
}
58+
5559
writeJsonbType(type.paramRaw(), writer);
5660
return;
5761
}

0 commit comments

Comments
 (0)