Skip to content

Commit 0d7538d

Browse files
fix: kotlin fixes (#5100)
1 parent 595f8c7 commit 0d7538d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/FTLDotNames.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ private FTLDotNames() {
2929
public static final DotName FIXTURE = DotName.createSimple(Fixture.class.getName());
3030
public static final DotName SINGLE_PARTITION_MAPPER = DotName.createSimple(SinglePartitionMapper.class);
3131
public static final DotName TRANSACTIONAL = DotName.createSimple(Transactional.class);
32+
public static final DotName KOTLIN_UNIT = DotName.createSimple("kotlin.Unit");
3233
}

jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/ModuleBuilder.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ public void registerVerbMethod(MethodInfo method, String className,
335335
} catch (Exception e) {
336336
log.errorf(e, "Failed to process FTL method %s.%s", method.declaringClass().name(), method.name());
337337
validationFailures.add(new ValidationFailure(toError(methodPos),
338-
"Failed to process FTL method " + method.declaringClass().name() + "." + method.name()));
338+
"Failed to process FTL method " + method.declaringClass().name() + "." + method.name() + " "
339+
+ e.getMessage()));
339340
}
340341
}
341342

@@ -415,7 +416,8 @@ public void registerSQLQueryMethod(MethodInfo method, String className, String r
415416
} catch (ClassNotFoundException e) {
416417
log.errorf(e, "Failed to process FTL method %s.%s", method.declaringClass().name(), method.name());
417418
validationFailures.add(new ValidationFailure(toError(forMethod(method)),
418-
"Failed to process FTL method " + method.declaringClass().name() + "." + method.name()));
419+
"Failed to process FTL method " + method.declaringClass().name() + "." + method.name() + " "
420+
+ e.getMessage()));
419421
}
420422
}
421423

@@ -480,7 +482,11 @@ public Type buildType(org.jboss.jandex.Type type, boolean export, Nullability nu
480482
}
481483
case CLASS -> {
482484
var clazz = type.asClassType();
485+
if (clazz.name().equals(FTLDotNames.KOTLIN_UNIT)) {
486+
return Type.newBuilder().setUnit(Unit.newBuilder().build()).build();
487+
}
483488
var info = index.getClassByName(clazz.name());
489+
484490
if (info != null && info.enclosingClass() != null && !Modifier.isStatic(info.flags())) {
485491
// proceed as normal, we fail at the end
486492
validationFailures.add(new ValidationFailure(toError(forClass(clazz.name().toString())),
@@ -536,7 +542,7 @@ public Type buildType(org.jboss.jandex.Type type, boolean export, Nullability nu
536542
var ref = Type.newBuilder().setRef(
537543
Ref.newBuilder().setName(name).setModule(moduleName).build()).build();
538544

539-
if (info.isEnum() || info.hasAnnotation(ENUM)) {
545+
if (info != null && (info.isEnum() || info.hasAnnotation(ENUM))) {
540546
// Set only the name and export here. EnumProcessor will fill in the rest
541547
xyz.block.ftl.schema.v1.Enum.Builder ennum = xyz.block.ftl.schema.v1.Enum.newBuilder()
542548
.setName(name)

0 commit comments

Comments
 (0)