From e9a9aae0c757f98a5c0daa2b857596cdb48516b6 Mon Sep 17 00:00:00 2001 From: hindujaB Date: Fri, 1 Nov 2024 21:59:12 +0530 Subject: [PATCH 1/2] Use referred type for populating default values --- .../java/io/ballerina/runtime/internal/values/MapValueImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java index 87ad34d427a4..bebed0159871 100644 --- a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java +++ b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java @@ -310,7 +310,7 @@ public void setTypeForcefully(Type type) { protected void populateInitialValues(BMapInitialValueEntry[] initialValues) { Map> defaultValues = new HashMap<>(); - if (type.getTag() == TypeTags.RECORD_TYPE_TAG) { + if (referredType.getTag() == TypeTags.RECORD_TYPE_TAG) { defaultValues.putAll(((BRecordType) type).getDefaultValues()); } From 31109b6a4631e40dd93b8016a2b0ba6672523870 Mon Sep 17 00:00:00 2001 From: hindujaB Date: Fri, 1 Nov 2024 22:03:33 +0530 Subject: [PATCH 2/2] Fix CCE error --- .../java/io/ballerina/runtime/internal/values/MapValueImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java index bebed0159871..c912e1c74b06 100644 --- a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java +++ b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java @@ -311,7 +311,7 @@ public void setTypeForcefully(Type type) { protected void populateInitialValues(BMapInitialValueEntry[] initialValues) { Map> defaultValues = new HashMap<>(); if (referredType.getTag() == TypeTags.RECORD_TYPE_TAG) { - defaultValues.putAll(((BRecordType) type).getDefaultValues()); + defaultValues.putAll(((BRecordType) referredType).getDefaultValues()); } for (BMapInitialValueEntry initialValue : initialValues) {