diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmMethodGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmMethodGen.java index c0b1cfd38c5b..d9df92e3cdfd 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmMethodGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmMethodGen.java @@ -528,14 +528,14 @@ public static void genJMethodForBFunc(BIRFunction func, endLabel = labelGen.getLabel(funcName + localVar.endBB.id.value + "beforeTerm"); } } - String metaVarName = localVar.name.value; - if (!"".equals(metaVarName) && + String metaVarName = localVar.metaVarName; + if (metaVarName != null && !"".equals(metaVarName) && // filter out compiler added vars !((metaVarName.startsWith("$") && metaVarName.endsWith("$")) || (metaVarName.startsWith("$$") && metaVarName.endsWith("$$")) || metaVarName.startsWith("_$$_"))) { mv.visitLocalVariable(metaVarName, getJVMTypeSign(localVar.type), null, - startLabel, endLabel, indexMap.getIndex(localVar)); + startLabel, endLabel, indexMap.getIndex(localVar)); } } k = k + 1;