From b805ee85c599e8f0b85ef2af62687e19a25c0f21 Mon Sep 17 00:00:00 2001 From: Tom Daffurn Date: Wed, 18 Sep 2024 20:01:55 +1000 Subject: [PATCH] fix: JVM Map value type extraction (#2658) Closes #2651 --- .../src/main/java/xyz/block/ftl/deployment/ModuleBuilder.java | 2 +- jvm-runtime/jvm_integration_test.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/ModuleBuilder.java b/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/ModuleBuilder.java index dba6f6acd4..7a078a04db 100644 --- a/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/ModuleBuilder.java +++ b/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/ModuleBuilder.java @@ -363,7 +363,7 @@ public Type buildType(org.jboss.jandex.Type type, boolean export) { } else if (paramType.name().equals(DotName.createSimple(Map.class))) { return Type.newBuilder().setMap(xyz.block.ftl.v1.schema.Map.newBuilder() .setKey(buildType(paramType.arguments().get(0), export)) - .setValue(buildType(paramType.arguments().get(0), export))) + .setValue(buildType(paramType.arguments().get(1), export))) .build(); } else if (paramType.name().equals(DotNames.OPTIONAL)) { //TODO: optional kinda sucks diff --git a/jvm-runtime/jvm_integration_test.go b/jvm-runtime/jvm_integration_test.go index b9d3fac1c9..f378d3178e 100644 --- a/jvm-runtime/jvm_integration_test.go +++ b/jvm-runtime/jvm_integration_test.go @@ -111,8 +111,7 @@ func TestJVMToGoCall(t *testing.T) { })...) tests = append(tests, PairedVerbTest("testObjectVerb", exampleObject)...) tests = append(tests, PairedVerbTest("testObjectOptionalFieldsVerb", exampleOptionalFieldsObject)...) - // TODO turn on when https://github.com/TBD54566975/ftl/issues/2651 is fixed - //tests = append(tests, PairedVerbTest("objectMapVerb", map[string]TestObject{"hello": exampleObject})...) + tests = append(tests, PairedVerbTest("objectMapVerb", map[string]TestObject{"hello": exampleObject})...) tests = append(tests, PairedVerbTest("objectArrayVerb", []TestObject{exampleObject})...) tests = append(tests, PairedVerbTest("parameterizedObjectVerb", parameterizedObject)...) tests = append(tests, PairedVerbTest("optionalIntVerb", -3)...)