diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/BallerinaSemanticModel.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/BallerinaSemanticModel.java index 73bf9e881f9b..a8bb84b7a0f7 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/BallerinaSemanticModel.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/BallerinaSemanticModel.java @@ -684,7 +684,7 @@ private boolean isResourceFunction(BSymbol symbol) { } private boolean isIgnorableSelfSymbol(Name name, BSymbol symbol, BSymbol symbolEnvScopeOwner) { - return name.value.equals("self") && !symbol.owner.owner.equals(symbolEnvScopeOwner.owner); + return name.getValue().equals("self") && !symbol.owner.owner.equals(symbolEnvScopeOwner.owner); } private boolean isFilteredVarSymbol(BSymbol symbol, Set states) { diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ExpectedTypeFinder.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ExpectedTypeFinder.java index a0a16524bcf9..235bf9a5f66c 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ExpectedTypeFinder.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ExpectedTypeFinder.java @@ -1100,7 +1100,7 @@ private Optional getParamType(BLangInvocation bLangNode, int argumen //Skip the first n arguments where n is the number of positional arguments specified by the user. int numOfPositionalArgs = argumentIndex - namedArgs.size(); return invokableSymbol.params.subList(numOfPositionalArgs, paramsSize) - .stream().filter(param -> !namedArgs.contains(param.name.value)) + .stream().filter(param -> !namedArgs.contains(param.name.getValue())) .findFirst().flatMap(this::getSymbolType); } if (invokableSymbol.restParam != null) { diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/LangLibrary.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/LangLibrary.java index 302ef304c309..d1b34fba9275 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/LangLibrary.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/LangLibrary.java @@ -75,8 +75,8 @@ private LangLibrary(CompilerContext context) { PackageID moduleID = module.pkgID; if (isLangLibModule(moduleID)) { - if (!LANG_VALUE.equals(moduleID.nameComps.get(1).value)) { - addLangLibMethods(moduleID.nameComps.get(1).value, module, this.langLibMethods, types); + if (!LANG_VALUE.equals(moduleID.nameComps.get(1).getValue())) { + addLangLibMethods(moduleID.nameComps.get(1).getValue(), module, this.langLibMethods, types); } else { populateLangValueLibrary(module, this.langLibMethods); } @@ -194,7 +194,7 @@ private static void addLangLibMethods(String basicType, BPackageSymbol langLibMo (!invSymbol.params.isEmpty() && equalsToBasicType(invSymbol.params.get(0).type, basicType) || invSymbol.restParam != null && equalsToBasicType(((BArrayType) invSymbol.restParam.type).eType, basicType))) { - methods.put(invSymbol.name.value, invSymbol); + methods.put(invSymbol.name.getValue(), invSymbol); } } @@ -212,7 +212,7 @@ private static void populateLangValueLibrary(BPackageSymbol langValue, continue; } - methods.put(symbol.name.value, (BInvokableSymbol) symbol); + methods.put(symbol.name.getValue(), (BInvokableSymbol) symbol); } langLibMethods.put(LANG_VALUE, methods); diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ReferenceFinder.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ReferenceFinder.java index 760d26ce9e14..c68d2005d709 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ReferenceFinder.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/ReferenceFinder.java @@ -1480,7 +1480,7 @@ private void findRefsInResourceAccessPathSegments(BLangInvocation.BLangResourceA } BLangLiteral literal = (BLangLiteral) expr; - if (literal.value.equals(pathSymbol.name.value) && addIfSameSymbol(pathSymbol, expr.pos)) { + if (literal.value.equals(pathSymbol.name.getValue()) && addIfSameSymbol(pathSymbol, expr.pos)) { return; } } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/SymbolFactory.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/SymbolFactory.java index c457b9a5f73f..7751c740fd9e 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/SymbolFactory.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/SymbolFactory.java @@ -524,7 +524,7 @@ public BallerinaEnumSymbol createEnumSymbol(BEnumSymbol enumSymbol, String name) List members = new ArrayList<>(); for (BConstantSymbol member : enumSymbol.members) { - members.add(this.createConstantSymbol(member, member.name.value)); + members.add(this.createConstantSymbol(member, member.name.getValue())); } for (AnnotationAttachmentSymbol annot : enumSymbol.getAnnotations()) { @@ -766,7 +766,7 @@ private String getMethodName(BInvokableSymbol method, BObjectTypeSymbol owner) { for (BAttachedFunction mthd : methods) { if (method == mthd.symbol) { if (mthd instanceof BResourceFunction bResourceFunction) { - return bResourceFunction.accessor.value; + return bResourceFunction.accessor.getValue(); } return mthd.symbol.getOriginalName().getValue(); } @@ -788,7 +788,7 @@ private void addIfFlagSet(BallerinaClassSymbol.ClassSymbolBuilder symbolBuilder, } private BField getBField(BVarSymbol symbol) { - String fieldName = symbol.name.value; + String fieldName = symbol.name.getValue(); BStructureType type = (BStructureType) symbol.owner.type; return type.fields.get(fieldName); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractIntSubTypeSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractIntSubTypeSymbol.java index ccb710cf79b0..1726084e7bc7 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractIntSubTypeSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractIntSubTypeSymbol.java @@ -48,8 +48,8 @@ public Optional getModule() { SymbolTable symTable = SymbolTable.getInstance(this.context); SymbolFactory symFactory = SymbolFactory.getInstance(this.context); this.module = (ModuleSymbol) symFactory.getBCompiledSymbol(symTable.langIntModuleSymbol, - symTable.langIntModuleSymbol - .getOriginalName().value); + symTable.langIntModuleSymbol + .getOriginalName().getValue()); return Optional.of(this.module); } } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractXMLSubTypeSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractXMLSubTypeSymbol.java index 541b9cda9fdb..cd7825c06cf3 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractXMLSubTypeSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/AbstractXMLSubTypeSymbol.java @@ -48,8 +48,8 @@ public Optional getModule() { SymbolTable symTable = SymbolTable.getInstance(this.context); SymbolFactory symFactory = SymbolFactory.getInstance(this.context); this.module = (ModuleSymbol) symFactory.getBCompiledSymbol(symTable.langXmlModuleSymbol, - symTable.langXmlModuleSymbol - .getOriginalName().value); + symTable.langXmlModuleSymbol + .getOriginalName().getValue()); return Optional.of(this.module); } } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaClassSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaClassSymbol.java index 7d2bf8583143..23a5b2440ab0 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaClassSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaClassSymbol.java @@ -91,7 +91,7 @@ public Map fieldDescriptors() { BObjectType type = (BObjectType) this.getBType(); for (BField field : type.fields.values()) { - fields.put(field.symbol.getOriginalName().value, new BallerinaClassFieldSymbol(this.context, field)); + fields.put(field.symbol.getOriginalName().getValue(), new BallerinaClassFieldSymbol(this.context, field)); } this.classFields = Collections.unmodifiableMap(fields); @@ -108,8 +108,8 @@ public Optional initMethod() { if (this.initMethod == null && this.internalSymbol.initializerFunc != null) { SymbolFactory symbolFactory = SymbolFactory.getInstance(this.context); this.initMethod = symbolFactory.createMethodSymbol(internalSymbol.initializerFunc.symbol, - internalSymbol.initializerFunc.symbol - .getOriginalName().value); + internalSymbol.initializerFunc.symbol + .getOriginalName().getValue()); } return Optional.ofNullable(this.initMethod); diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaConstantSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaConstantSymbol.java index 9e0a696feecd..381e2fe61e7c 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaConstantSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaConstantSymbol.java @@ -91,7 +91,7 @@ public TypeDescKind typeKind() { @Override public String signature() { - return this.getInternalSymbol().name.value; + return this.getInternalSymbol().name.getValue(); } @Override diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaErrorTypeSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaErrorTypeSymbol.java index 85ab4492d850..66132d25f235 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaErrorTypeSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaErrorTypeSymbol.java @@ -83,7 +83,7 @@ public Optional getModule() { } SymbolFactory symbolFactory = SymbolFactory.getInstance(this.context); - this.module = symbolFactory.createModuleSymbol((BPackageSymbol) symbol, symbol.name.value); + this.module = symbolFactory.createModuleSymbol((BPackageSymbol) symbol, symbol.name.getValue()); return Optional.of(this.module); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectFieldSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectFieldSymbol.java index 14ae5d9f7c04..2f3a67886cfc 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectFieldSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectFieldSymbol.java @@ -59,7 +59,7 @@ public class BallerinaObjectFieldSymbol extends BallerinaSymbol implements Objec private List annotAttachments; public BallerinaObjectFieldSymbol(CompilerContext context, BField bField, SymbolKind kind) { - super(bField.symbol.getOriginalName().value, kind, bField.symbol, context); + super(bField.symbol.getOriginalName().getValue(), kind, bField.symbol, context); this.bField = bField; this.docAttachment = new BallerinaDocumentation(bField.symbol.markdownDocumentation); this.deprecated = Symbols.isFlagOn(bField.symbol.flags, Flags.DEPRECATED); diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectTypeSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectTypeSymbol.java index c7eb00b3a536..910de0c65b4d 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectTypeSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaObjectTypeSymbol.java @@ -94,7 +94,7 @@ public Map fieldDescriptors() { BObjectType type = (BObjectType) this.getBType(); for (BField field : type.fields.values()) { - fields.put(field.symbol.getOriginalName().value, new BallerinaObjectFieldSymbol(this.context, field)); + fields.put(field.symbol.getOriginalName().getValue(), new BallerinaObjectFieldSymbol(this.context, field)); } this.objectFields = Collections.unmodifiableMap(fields); @@ -113,11 +113,11 @@ public Map methods() { for (BAttachedFunction attachedFunc : ((BObjectTypeSymbol) this.getBType().tsymbol).attachedFuncs) { if (attachedFunc instanceof BResourceFunction resFn) { String resPath = resFn.pathSegmentSymbols.stream() - .map(p -> p.name.value).collect(Collectors.joining("/")); - methods.put(resFn.accessor.value + " " + resPath, + .map(p -> p.name.getValue()).collect(Collectors.joining("/")); + methods.put(resFn.accessor.getValue() + " " + resPath, symbolFactory.createResourceMethodSymbol(attachedFunc.symbol)); } else { - methods.put(attachedFunc.funcName.value, + methods.put(attachedFunc.funcName.getValue(), symbolFactory.createMethodSymbol(attachedFunc.symbol, attachedFunc.symbol.getOriginalName().getValue())); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordFieldSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordFieldSymbol.java index e5962a1116c0..0f55d6f40bd6 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordFieldSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordFieldSymbol.java @@ -58,7 +58,7 @@ public class BallerinaRecordFieldSymbol extends BallerinaSymbol implements Recor private boolean deprecated; public BallerinaRecordFieldSymbol(CompilerContext context, BField bField) { - super(bField.symbol.getOriginalName().value, SymbolKind.RECORD_FIELD, bField.symbol, context); + super(bField.symbol.getOriginalName().getValue(), SymbolKind.RECORD_FIELD, bField.symbol, context); this.bField = bField; this.docAttachment = new BallerinaDocumentation(bField.symbol.markdownDocumentation); this.deprecated = Symbols.isFlagOn(bField.symbol.flags, Flags.DEPRECATED); diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordTypeSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordTypeSymbol.java index a288bb882344..366a5c4b6fb4 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordTypeSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRecordTypeSymbol.java @@ -61,7 +61,7 @@ public Map fieldDescriptors() { BRecordType type = (BRecordType) this.getBType(); for (BField field : type.fields.values()) { - fields.put(field.symbol.getOriginalName().value, new BallerinaRecordFieldSymbol(this.context, field)); + fields.put(field.symbol.getOriginalName().getValue(), new BallerinaRecordFieldSymbol(this.context, field)); } this.fieldSymbols = Collections.unmodifiableMap(fields); diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRegexpTypeSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRegexpTypeSymbol.java index 4c5f43a6447d..a2b9bc5421a5 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRegexpTypeSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaRegexpTypeSymbol.java @@ -56,7 +56,7 @@ public Optional getModule() { SymbolTable symTable = SymbolTable.getInstance(this.context); SymbolFactory symFactory = SymbolFactory.getInstance(this.context); this.module = (ModuleSymbol) symFactory.getBCompiledSymbol(symTable.langRegexpModuleSymbol, - symTable.langRegexpModuleSymbol.getOriginalName().value); + symTable.langRegexpModuleSymbol.getOriginalName().getValue()); } return Optional.ofNullable(this.module); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaResourceMethodSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaResourceMethodSymbol.java index 370a20a6c2f4..994e7a0cff33 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaResourceMethodSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaResourceMethodSymbol.java @@ -150,6 +150,6 @@ private BResourceFunction getBResourceFunction(List methods, } throw new IllegalStateException( - "Matching BResourceFunction not found for internal symbol: " + internalSymbol.name.value); + "Matching BResourceFunction not found for internal symbol: " + internalSymbol.name.getValue()); } } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaServiceDeclarationSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaServiceDeclarationSymbol.java index df06197ba142..72246fb19953 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaServiceDeclarationSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaServiceDeclarationSymbol.java @@ -123,7 +123,7 @@ public Map fieldDescriptors() { Map fields = new LinkedHashMap<>(); for (BField field : classType.fields.values()) { - fields.put(field.name.value, new BallerinaClassFieldSymbol(this.context, field)); + fields.put(field.name.getValue(), new BallerinaClassFieldSymbol(this.context, field)); } this.fields = Collections.unmodifiableMap(fields); @@ -146,14 +146,15 @@ public Map fieldDescriptors() { StringJoiner stringJoiner = new StringJoiner("/"); for (BResourcePathSegmentSymbol pathSegmentSym : resFn.pathSegmentSymbols) { - stringJoiner.add(pathSegmentSym.name.value); + stringJoiner.add(pathSegmentSym.name.getValue()); } - methods.put(resFn.accessor.value + " " + stringJoiner.toString(), + methods.put(resFn.accessor.getValue() + " " + stringJoiner.toString(), symbolFactory.createResourceMethodSymbol(method.symbol)); } else { - methods.put(method.funcName.value, - symbolFactory.createMethodSymbol(method.symbol, method.symbol.getOriginalName().value)); + methods.put( + method.funcName.getValue(), + symbolFactory.createMethodSymbol(method.symbol, method.symbol.getOriginalName().getValue())); } } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaStringCharTypeSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaStringCharTypeSymbol.java index 6e493c8f74c4..66800da9759d 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaStringCharTypeSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaStringCharTypeSymbol.java @@ -62,8 +62,8 @@ public Optional getModule() { SymbolTable symTable = SymbolTable.getInstance(this.context); SymbolFactory symFactory = SymbolFactory.getInstance(this.context); this.module = (ModuleSymbol) symFactory.getBCompiledSymbol(symTable.langStringModuleSymbol, - symTable.langStringModuleSymbol - .getOriginalName().value); + symTable.langStringModuleSymbol + .getOriginalName().getValue()); return Optional.of(this.module); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaSymbol.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaSymbol.java index 2c30110360ff..8cdb2de8e5bc 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaSymbol.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/BallerinaSymbol.java @@ -98,7 +98,7 @@ public Optional getModule() { } SymbolFactory symbolFactory = SymbolFactory.getInstance(this.context); - this.module = symbolFactory.createModuleSymbol((BPackageSymbol) symbol, symbol.name.value); + this.module = symbolFactory.createModuleSymbol((BPackageSymbol) symbol, symbol.name.getValue()); return Optional.of(this.module); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/TypesFactory.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/TypesFactory.java index 64e5f1d98ff1..87e1c3eaf170 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/TypesFactory.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/TypesFactory.java @@ -209,7 +209,7 @@ private TypeSymbol createTypeDescriptor(BType bType, BTypeSymbol tSymbol) { case OBJECT: ObjectTypeSymbol objType = new BallerinaObjectTypeSymbol(this.context, (BObjectType) bType); if (Symbols.isFlagOn(tSymbol.flags, Flags.CLASS)) { - return symbolFactory.createClassSymbol((BClassSymbol) tSymbol, tSymbol.name.value, objType); + return symbolFactory.createClassSymbol((BClassSymbol) tSymbol, tSymbol.name.getValue(), objType); } return objType; case RECORD: @@ -314,7 +314,7 @@ public boolean isTypeReference(BType bType, BSymbol tSymbol, boolean rawTypeOnly return false; } - if (!isBuiltinNamedType(bType.tag) && !(tSymbol.name.value.isEmpty() + if (!isBuiltinNamedType(bType.tag) && !(tSymbol.name.getValue().isEmpty() || anonymousModelHelper.isAnonymousType(tSymbol))) { return true; } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/resourcepath/BallerinaPathSegmentList.java b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/resourcepath/BallerinaPathSegmentList.java index e5a7d77413bb..d34ce089ffc4 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/resourcepath/BallerinaPathSegmentList.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/symbols/resourcepath/BallerinaPathSegmentList.java @@ -72,7 +72,7 @@ public List pathParameters() { for (int i = 0; i < segments.size(); i++) { Name internalSegment = segments.get(i); BResourcePathSegmentSymbol pathSegSymbol = this.internalPathSegmentSymbols.get(i); - switch (internalSegment.value) { + switch (internalSegment.getValue()) { case "^": BVarSymbol paramVarSymbol = this.internalPathParams.get(internalPathParamCount++); pathParams.add(symbolFactory.createPathParamSymbol(paramVarSymbol.getOriginalName().getValue(), diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/ConfigReader.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/ConfigReader.java index 5efb0c6a72df..69a6377670bb 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/ConfigReader.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/ConfigReader.java @@ -201,7 +201,7 @@ private static void getConfigVars(Module module, Collection sc // Get description String description = getDescriptionValue(varSymbol, module); configVariables.add(new ConfigVariable( - varSymbol.name.value.replace("\\", ""), varSymbol.type, + varSymbol.name.getValue().replace("\\", ""), varSymbol.type, Symbols.isFlagOn(varSymbol.flags, Flags.REQUIRED), description)); } } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/DocumentContext.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/DocumentContext.java index c219679275d7..16b25065b896 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/DocumentContext.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/DocumentContext.java @@ -144,10 +144,10 @@ private Set getModuleLoadRequests(ModuleDescriptor currentMod TransactionImportValidator trxImportValidator = new TransactionImportValidator(); if (trxImportValidator.shouldImportTransactionPackage(modulePartNode) && - !currentModuleDesc.name().toString().equals(Names.TRANSACTION.value)) { - String moduleName = Names.TRANSACTION.value; + !currentModuleDesc.name().toString().equals(Names.TRANSACTION.getValue())) { + String moduleName = Names.TRANSACTION.getValue(); ModuleLoadRequest ballerinaiLoadReq = new ModuleLoadRequest( - PackageOrg.from(Names.BALLERINA_INTERNAL_ORG.value), + PackageOrg.from(Names.BALLERINA_INTERNAL_ORG.getValue()), moduleName, scope, DependencyResolutionType.PLATFORM_PROVIDED); moduleLoadRequestSet.add(ballerinaiLoadReq); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBalaWriter.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBalaWriter.java index 7c49f2660322..dc3e6ba8beb6 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBalaWriter.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBalaWriter.java @@ -247,8 +247,8 @@ private CompilerBackend.TargetPlatform getTargetPlatform(PackageResolution pkgRe // 1) Check direct dependencies of imports in the package have any `ballerina/java` dependency for (ResolvedPackageDependency dependency : resolvedPackageDependencies) { - if (dependency.packageInstance().packageOrg().value().equals(Names.BALLERINA_ORG.value) && - dependency.packageInstance().packageName().value().equals(Names.JAVA.value) && + if (dependency.packageInstance().packageOrg().value().equals(Names.BALLERINA_ORG.getValue()) && + dependency.packageInstance().packageName().value().equals(Names.JAVA.getValue()) && !dependency.scope().equals(PackageDependencyScope.TEST_ONLY)) { return this.backend.targetPlatform(); } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/PackageResolution.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/PackageResolution.java index 90cb5f5f536f..ad9f9ed53a8d 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/PackageResolution.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/PackageResolution.java @@ -327,7 +327,7 @@ private LinkedHashSet getModuleLoadRequestsOfDirectDependenci { String moduleName = Names.OBSERVE.getValue(); ModuleLoadRequest observeModuleLoadReq = new ModuleLoadRequest( - PackageOrg.from(Names.BALLERINA_INTERNAL_ORG.value), moduleName, + PackageOrg.from(Names.BALLERINA_INTERNAL_ORG.getValue()), moduleName, PackageDependencyScope.DEFAULT, DependencyResolutionType.PLATFORM_PROVIDED); allModuleLoadRequests.add(observeModuleLoadReq); } @@ -338,7 +338,7 @@ private LinkedHashSet getModuleLoadRequestsOfDirectDependenci "choreo".equals(compilationOptions.getCloud())) { String moduleName = Names.CLOUD.getValue(); ModuleLoadRequest c2cModuleLoadReq = new ModuleLoadRequest( - PackageOrg.from(Names.BALLERINA_ORG.value), moduleName, + PackageOrg.from(Names.BALLERINA_ORG.getValue()), moduleName, PackageDependencyScope.DEFAULT, DependencyResolutionType.COMPILER_PLUGIN); allModuleLoadRequests.add(c2cModuleLoadReq); } diff --git a/compiler/ballerina-lang/src/main/java/org/ballerinalang/model/elements/PackageID.java b/compiler/ballerina-lang/src/main/java/org/ballerinalang/model/elements/PackageID.java index f33bc65873cc..dd60994a9fe4 100644 --- a/compiler/ballerina-lang/src/main/java/org/ballerinalang/model/elements/PackageID.java +++ b/compiler/ballerina-lang/src/main/java/org/ballerinalang/model/elements/PackageID.java @@ -166,7 +166,7 @@ private List createNameComps(Name name) { if (name == Names.DEFAULT_PACKAGE) { return Lists.of(Names.DEFAULT_PACKAGE); } - return Arrays.stream(name.value.split("\\.")).map(Name::new).collect(Collectors.toList()); + return Arrays.stream(name.getValue().split("\\.")).map(Name::new).collect(Collectors.toList()); } /** @@ -256,19 +256,19 @@ public int hashCode() { @Override public String toString() { if (Names.DOT.equals(this.name)) { - return this.name.value; + return this.name.getValue(); } String org = ""; if (this.orgName != null && !this.orgName.equals(Names.ANON_ORG)) { - org = this.orgName + Names.ORG_NAME_SEPARATOR.value; + org = this.orgName + Names.ORG_NAME_SEPARATOR.getValue(); } if (version.equals(Names.EMPTY)) { - return org + this.name.value; + return org + this.name.getValue(); } - return org + this.name + Names.VERSION_SEPARATOR.value + this.version; + return org + this.name + Names.VERSION_SEPARATOR.getValue() + this.version; } public Name getOrgName() { diff --git a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/GeneralFSPackageRepository.java b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/GeneralFSPackageRepository.java index 4a1a0d897c0b..de26c4ddd17a 100644 --- a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/GeneralFSPackageRepository.java +++ b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/GeneralFSPackageRepository.java @@ -163,7 +163,7 @@ protected Path generatePathOld(PackageID pkgID) { Path pkgDirPath = this.basePath; for (Name comp : pkgID.getNameComps()) { - pkgDirPath = pkgDirPath.resolve(comp.value); + pkgDirPath = pkgDirPath.resolve(comp.getValue()); } return pkgDirPath; } @@ -179,7 +179,7 @@ public Path generatePath(PackageID pkgID) { } private Path generatePathNew(PackageID pkgID) { - Path pkgDirPath = this.basePath.resolve(pkgID.getOrgName().value); + Path pkgDirPath = this.basePath.resolve(pkgID.getOrgName().getValue()); return pkgDirPath.resolve(createPackageNameWithDots(pkgID)); } @@ -190,7 +190,7 @@ private String createPackageNameWithDots(PackageID pkgID) { if (i != 0) { builder.append("."); } - builder.append(nameComps.get(i).value); + builder.append(nameComps.get(i).getValue()); } return builder.toString(); } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/BIRPackageSymbolEnter.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/BIRPackageSymbolEnter.java index 318b9bb49e24..2cc5c9604f66 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/BIRPackageSymbolEnter.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/BIRPackageSymbolEnter.java @@ -281,9 +281,10 @@ private void populateReferencedFunctions() { // we should not copy private functions. continue; } - String referencedFuncName = function.funcName.value; + String referencedFuncName = function.funcName.getValue(); Name funcName = Names.fromString( - Symbols.getAttachedFuncSymbolName(structureTypeSymbol.name.value, referencedFuncName)); + Symbols.getAttachedFuncSymbolName(structureTypeSymbol.name.getValue(), + referencedFuncName)); Scope.ScopeEntry matchingObjFuncSym = objectType.tsymbol.scope.lookup(funcName); if (matchingObjFuncSym == NOT_FOUND_ENTRY) { structureTypeSymbol.attachedFuncs.add(function); @@ -416,7 +417,7 @@ private void defineFunction(DataInputStream dataInStream) throws IOException { // Update the symbol invokableSymbol.owner = attachedType.tsymbol; invokableSymbol.name = - Names.fromString(Symbols.getAttachedFuncSymbolName(attachedType.tsymbol.name.value, funcName)); + Names.fromString(Symbols.getAttachedFuncSymbolName(attachedType.tsymbol.name.getValue(), funcName)); if (attachedType.tag == TypeTags.OBJECT || attachedType.tag == TypeTags.RECORD) { scopeToDefine = attachedType.tsymbol.scope; if (isResourceFunction) { @@ -478,10 +479,10 @@ private void defineFunction(DataInputStream dataInStream) throws IOException { new BAttachedFunction(Names.fromString(funcName), invokableSymbol, funcType, symTable.builtinPos); BStructureTypeSymbol structureTypeSymbol = (BStructureTypeSymbol) attachedType.tsymbol; - if (Names.USER_DEFINED_INIT_SUFFIX.value.equals(funcName) || - funcName.equals(Names.INIT_FUNCTION_SUFFIX.value)) { + if (Names.USER_DEFINED_INIT_SUFFIX.getValue().equals(funcName) || + funcName.equals(Names.INIT_FUNCTION_SUFFIX.getValue())) { ((BObjectTypeSymbol) structureTypeSymbol).initializerFunc = attachedFunc; - } else if (funcName.equals(Names.GENERATED_INIT_SUFFIX.value)) { + } else if (funcName.equals(Names.GENERATED_INIT_SUFFIX.getValue())) { ((BObjectTypeSymbol) structureTypeSymbol).generatedInitializerFunc = attachedFunc; } else { structureTypeSymbol.attachedFuncs.add(attachedFunc); @@ -541,7 +542,7 @@ private void defineTypeDef(DataInputStream dataInStream) throws IOException { BTypeReferenceType referenceType = null; boolean hasReferenceType = dataInStream.readBoolean(); if (hasReferenceType) { - if (type.tag == TypeTags.TYPEREFDESC && Objects.equals(type.tsymbol.name.value, typeDefName) + if (type.tag == TypeTags.TYPEREFDESC && Objects.equals(type.tsymbol.name.getValue(), typeDefName) && type.tsymbol.owner == this.env.pkgSymbol) { referenceType = (BTypeReferenceType) type; referenceType.tsymbol.pos = pos; @@ -1298,7 +1299,7 @@ public BType readType(int cpI) throws IOException { defineMarkDownDocAttachment(varSymbol, docBytes); BField structField = new BField(varSymbol.name, varSymbol.pos, varSymbol); - recordType.fields.put(structField.name.value, structField); + recordType.fields.put(structField.name.getValue(), structField); recordSymbol.scope.define(varSymbol.name, varSymbol); } @@ -1654,7 +1655,7 @@ public BType readType(int cpI) throws IOException { defineMarkDownDocAttachment(objectVarSymbol, docBytes); BField structField = new BField(objectVarSymbol.name, null, objectVarSymbol); - objectType.fields.put(structField.name.value, structField); + objectType.fields.put(structField.name.getValue(), structField); objectSymbol.scope.define(objectVarSymbol.name, objectVarSymbol); } boolean generatedConstructorPresent = inputStream.readBoolean(); @@ -1804,7 +1805,7 @@ private void populateIntersectionTypeReferencedFunctions(DataInputStream inputSt var attachedFuncFlags = inputStream.readLong(); BInvokableType attachedFuncType = (BInvokableType) readTypeFromCp(); Name funcName = Names.fromString(Symbols.getAttachedFuncSymbolName( - objectSymbol.name.value, attachedFuncName)); + objectSymbol.name.getValue(), attachedFuncName)); Name funcOrigName = Names.fromString(attachedFuncOrigName); BInvokableSymbol attachedFuncSymbol = Symbols.createFunctionSymbol(attachedFuncFlags, funcName, funcOrigName, @@ -1832,7 +1833,8 @@ private void populateIntersectionTypeReferencedFunctions(DataInputStream inputSt private BType getType(BType readShape, SymbolEnv pkgEnv, Name name) { BType type = symbolResolver.lookupSymbolInMainSpace(pkgEnv, name).type; - if (type != symTable.noType && (!name.value.contains(ANON_PREFIX) || types.isSameBIRShape(readShape, type))) { + if (type != symTable.noType && (!name.getValue().contains(ANON_PREFIX) || + types.isSameBIRShape(readShape, type))) { return type; } @@ -1847,7 +1849,7 @@ private BType getType(BType readShape, SymbolEnv pkgEnv, Name name) { if (types.isSameBIRShape(readShape, anonType)) { return anonType; } - } else if (typeDefName.equals(name.value)) { + } else if (typeDefName.equals(name.getValue())) { return symbol.type; } } @@ -1855,7 +1857,7 @@ private BType getType(BType readShape, SymbolEnv pkgEnv, Name name) { for (Map.Entry value : pkgEnv.scope.entries.entrySet()) { BSymbol symbol = value.getValue().symbol; - if (value.getKey().value.contains(ANON_PREFIX)) { + if (value.getKey().getValue().contains(ANON_PREFIX)) { BType anonType = symbol.type; if (types.isSameBIRShape(readShape, anonType)) { diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/PackageCache.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/PackageCache.java index 146c3f5a4353..92e340bb181e 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/PackageCache.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/PackageCache.java @@ -78,7 +78,7 @@ public void put(PackageID packageID, BLangPackage bLangPackage) { public void remove(PackageID packageID) { packageMap.remove(getCacheID(packageID)); - String[] packageElements = packageID.toString().split(Names.VERSION_SEPARATOR.value); + String[] packageElements = packageID.toString().split(Names.VERSION_SEPARATOR.getValue()); packageSymbolMap.remove(packageElements[0]); } @@ -106,7 +106,7 @@ public BPackageSymbol getSymbol(PackageID packageID) { } public BPackageSymbol getSymbol(String bvmAlias) { - String[] packageElements = bvmAlias.split(Names.VERSION_SEPARATOR.value); + String[] packageElements = bvmAlias.split(Names.VERSION_SEPARATOR.getValue()); Map versionMap = packageSymbolMap.get(packageElements[0]); if (versionMap != null) { if (packageElements.length > 1) { @@ -122,13 +122,13 @@ public BPackageSymbol getSymbol(String bvmAlias) { } public void putSymbol(PackageID packageID, BPackageSymbol packageSymbol) { - String[] packageElements = packageID.toString().split(Names.VERSION_SEPARATOR.value); + String[] packageElements = packageID.toString().split(Names.VERSION_SEPARATOR.getValue()); Map versionMap = packageSymbolMap.computeIfAbsent(packageElements[0], k -> new LinkedHashMap<>()); if (packageElements.length > 1) { versionMap.put(getMajorVersion(packageElements[1]), packageSymbol); } else { - versionMap.put(Names.DEFAULT_VERSION.value, packageSymbol); + versionMap.put(Names.DEFAULT_VERSION.getValue(), packageSymbol); } } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/SourceDirectoryManager.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/SourceDirectoryManager.java index 4673f6f1f0a6..a89a34783e23 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/SourceDirectoryManager.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/SourceDirectoryManager.java @@ -236,9 +236,9 @@ boolean checkIfSourcesExists(String pkg) { @Override public boolean isModuleExists(PackageID moduleId) { - if (this.sourceDirectory.getSourcePackageNames().contains(moduleId.name.value) && - this.manifest.getProject().getOrgName().equals(moduleId.orgName.value) && - this.manifest.getProject().getVersion().equals(moduleId.version.value)) { + if (this.sourceDirectory.getSourcePackageNames().contains(moduleId.name.getValue()) && + this.manifest.getProject().getOrgName().equals(moduleId.orgName.getValue()) && + this.manifest.getProject().getVersion().equals(moduleId.version.getValue())) { return true; } else { return false; @@ -253,11 +253,11 @@ public Path getBalaPath(PackageID moduleId) throws InvalidModuleException { // Get the version of the project. String versionNo = manifest.getProject().getVersion(); // Identify the platform version - String platform = manifest.getTargetPlatform(moduleId.name.value); + String platform = manifest.getTargetPlatform(moduleId.name.getValue()); // {module}-{lang spec version}-{platform}-{version}.bala //+ "2019R2" + ProjectDirConstants.FILE_NAME_DELIMITER - String balaFileName = moduleId.name.value + "-" - + moduleId.orgName.value + "-" + String balaFileName = moduleId.name.getValue() + "-" + + moduleId.orgName.getValue() + "-" + platform + "-" + versionNo + BLANG_COMPILED_PKG_BINARY_EXT; diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/BIRGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/BIRGen.java index 9186c3a0bfbf..7624f5c87c0f 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/BIRGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/BIRGen.java @@ -364,7 +364,7 @@ public void visit(BLangTypeDefinition astTypeDefinition) { BType type = getDefinedType(astTypeDefinition); BType referredType = Types.getImpliedType(type); BSymbol symbol = astTypeDefinition.symbol; - String displayName = symbol.name.value; + String displayName = symbol.name.getValue(); if (referredType.tag == TypeTags.RECORD) { BRecordType recordType = (BRecordType) referredType; if (recordType.shouldPrintShape()) { @@ -579,12 +579,12 @@ public void visit(BLangFunction astFunc) { this.env.unlockVars.push(new BIRLockDetailsHolder()); Name funcName; if (isTypeAttachedFunction) { - funcName = Names.fromString(astFunc.symbol.name.value); + funcName = Names.fromString(astFunc.symbol.name.getValue()); } else { funcName = getFuncName(astFunc.symbol); } BIRFunction birFunc = new BIRFunction(astFunc.pos, funcName, - Names.fromString(astFunc.symbol.getOriginalName().value), astFunc.symbol.flags, type, workerName, + Names.fromString(astFunc.symbol.getOriginalName().getValue()), astFunc.symbol.flags, type, workerName, astFunc.sendsToThis.size(), astFunc.symbol.origin.toBIROrigin()); this.currentScope = new BirScope(0, null); if (astFunc.receiver != null) { @@ -651,7 +651,7 @@ public void visit(BLangFunction astFunc) { // Parent symbol will always be BObjectTypeSymbol for resource functions BObjectTypeSymbol objectTypeSymbol = (BObjectTypeSymbol) parentTSymbol; for (BAttachedFunction func : objectTypeSymbol.attachedFuncs) { - if (func.funcName.value.equals(funcName.value)) { + if (func.funcName.getValue().equals(funcName.getValue())) { BResourceFunction resourceFunction = (BResourceFunction) func; List pathParamSymbols = resourceFunction.pathParams; @@ -715,7 +715,7 @@ public void visit(BLangFunction astFunc) { private BIRVariableDcl createBIRVarDeclForPathParam(BVarSymbol pathParamSym) { return new BIRVariableDcl(pathParamSym.pos, pathParamSym.type, this.env.nextLocalVarId(), - VarScope.FUNCTION, VarKind.ARG, pathParamSym.name.value); + VarScope.FUNCTION, VarKind.ARG, pathParamSym.name.getValue()); } private BIRVariableDcl getSelf(BSymbol receiver) { @@ -832,7 +832,7 @@ public void visit(BLangLambdaFunction lambdaExpr) { } PackageID pkgID = lambdaExpr.function.symbol.pkgID; - PackageID boundMethodPkgId = getPackageIdForBoundMethod(lambdaExpr, funcName.value); + PackageID boundMethodPkgId = getPackageIdForBoundMethod(lambdaExpr, funcName.getValue()); boolean isWorker = lambdaExpr.function.flagSet.contains(Flag.WORKER); List closureMapOperands = getClosureMapOperands(lambdaExpr); @@ -841,14 +841,14 @@ public void visit(BLangLambdaFunction lambdaExpr) { lambdaExpr.getBType(), lambdaExpr.function.symbol.strandName, lambdaExpr.function.symbol.schedulerPolicy, isWorker); setScopeAndEmit(fpLoad); - BType targetType = getRecordTargetType(funcName.value); + BType targetType = getRecordTargetType(funcName.getValue()); if (lambdaExpr.function.flagSet.contains(Flag.RECORD) && targetType != null && targetType.tag == TypeTags.RECORD) { // If the function is for record type and has captured variables, then we need to create a // temp value in the type and keep it setScopeAndEmit( new BIRNonTerminator.RecordDefaultFPLoad(lhsOp.pos, lhsOp, targetType, - getFieldName(funcName.value, targetType.tsymbol.name.value))); + getFieldName(funcName.getValue(), targetType.tsymbol.name.getValue()))); } this.env.targetOperand = lhsOp; } @@ -865,7 +865,7 @@ private BType getRecordTargetType(String funcName) { String[] split = funcName.split(Pattern.quote(RECORD_DELIMITER)); String typeName = split[split.length - 2]; for (BIRTypeDefinition type : this.env.enclPkg.typeDefs) { - if (typeName.equals(type.originalName.value)) { + if (typeName.equals(type.originalName.getValue())) { return type.type; } } @@ -889,11 +889,11 @@ private List getClosureMapOperands(BLangLambdaFunction lambdaExpr) { private Name getFuncName(BInvokableSymbol symbol) { if (symbol.receiverSymbol == null) { - return Names.fromString(symbol.name.value); + return Names.fromString(symbol.name.getValue()); } - int offset = symbol.receiverSymbol.type.tsymbol.name.value.length() + 1; - String attachedFuncName = symbol.name.value; + int offset = symbol.receiverSymbol.type.tsymbol.name.getValue().length() + 1; + String attachedFuncName = symbol.name.getValue(); return Names.fromString(attachedFuncName.substring(offset)); } @@ -912,7 +912,7 @@ private void addParam(BIRFunction birFunc, BVarSymbol paramSymbol, BLangExpressi paramSymbol.kind == SymbolKind.PATH_REST_PARAMETER; BIRFunctionParameter birVarDcl = new BIRFunctionParameter(pos, paramSymbol.type, this.env.nextLocalVarId(), VarScope.FUNCTION, VarKind.ARG, - paramSymbol.name.value, defaultValExpr != null, isPathParam); + paramSymbol.name.getValue(), defaultValExpr != null, isPathParam); birFunc.localVars.add(birVarDcl); @@ -928,7 +928,7 @@ private void addParam(BIRFunction birFunc, BVarSymbol paramSymbol, BLangExpressi private void addRestParam(BIRFunction birFunc, BVarSymbol paramSymbol, Location pos) { BIRFunctionParameter birVarDcl = new BIRFunctionParameter(pos, paramSymbol.type, - this.env.nextLocalVarId(), VarScope.FUNCTION, VarKind.ARG, paramSymbol.name.value, false, + this.env.nextLocalVarId(), VarScope.FUNCTION, VarKind.ARG, paramSymbol.name.getValue(), false, paramSymbol.kind == SymbolKind.PATH_REST_PARAMETER); birFunc.parameters.add(birVarDcl); birFunc.localVars.add(birVarDcl); @@ -946,7 +946,7 @@ private void addRequiredParam(BIRFunction birFunc, BVarSymbol paramSymbol, Locat boolean isPathParam = paramSymbol.kind == SymbolKind.PATH_PARAMETER || paramSymbol.kind == SymbolKind.PATH_REST_PARAMETER; BIRFunctionParameter birVarDcl = new BIRFunctionParameter(pos, paramSymbol.type, - this.env.nextLocalVarId(), VarScope.FUNCTION, VarKind.ARG, paramSymbol.name.value, + this.env.nextLocalVarId(), VarScope.FUNCTION, VarKind.ARG, paramSymbol.name.getValue(), false, isPathParam); birFunc.parameters.add(birVarDcl); birFunc.localVars.add(birVarDcl); @@ -1101,8 +1101,8 @@ public void visit(BLangSimpleVariableDef astVarDefStmt) { @Override public void visit(BLangSimpleVariable varNode) { - String name = ANNOTATION_DATA.equals(varNode.symbol.name.value) ? ANNOTATION_DATA : varNode.name.value; - String originalName = ANNOTATION_DATA.equals(varNode.symbol.getOriginalName().value) ? + String name = ANNOTATION_DATA.equals(varNode.symbol.name.getValue()) ? ANNOTATION_DATA : varNode.name.value; + String originalName = ANNOTATION_DATA.equals(varNode.symbol.getOriginalName().getValue()) ? ANNOTATION_DATA : varNode.name.originalValue; BIRGlobalVariableDcl birVarDcl = new BIRGlobalVariableDcl(varNode.pos, varNode.symbol.flags, varNode.symbol.type, varNode.symbol.pkgID, @@ -1183,7 +1183,7 @@ public void visit(BLangAlternateWorkerReceive altWorkerReceive) { BIROperand lhsOp = new BIROperand(tempVarDcl); this.env.targetOperand = lhsOp; - boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.value); + boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.getValue()); this.env.enclBB.terminator = new BIRTerminator.WorkerAlternateReceive(altWorkerReceive.pos, getChannelList(altWorkerReceive), lhsOp, isOnSameStrand, thenBB, this.currentScope); @@ -1218,7 +1218,7 @@ public void visit(BLangMultipleWorkerReceive multipleWorkerReceive) { this.env.enclFunc.localVars.add(tempVarDcl); BIROperand lhsOp = new BIROperand(tempVarDcl); this.env.targetOperand = lhsOp; - boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.value); + boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.getValue()); this.env.enclBB.terminator = new BIRTerminator.WorkerMultipleReceive(multipleWorkerReceive.pos, getChannelList(multipleWorkerReceive), lhsOp, isOnSameStrand, thenBB, this.currentScope); @@ -1237,7 +1237,7 @@ public void visit(BLangWorkerReceive workerReceive) { BIROperand lhsOp = new BIROperand(tempVarDcl); this.env.targetOperand = lhsOp; - boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.value); + boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.getValue()); this.env.enclBB.terminator = new BIRTerminator.WorkerReceive(workerReceive.pos, Names.fromString(workerReceive.getChannel().channelId()), lhsOp, isOnSameStrand, thenBB, @@ -1259,7 +1259,7 @@ public void visit(BLangWorkerAsyncSendExpr asyncSendExpr) { this.env.enclFunc.localVars.add(tempVarDcl); BIROperand lhsOp = new BIROperand(tempVarDcl); this.env.targetOperand = lhsOp; - boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.value); + boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.getValue()); this.env.enclBB.terminator = new BIRTerminator.WorkerSend( asyncSendExpr.pos, Names.fromString(asyncSendExpr.getChannel().channelId()), dataOp, isOnSameStrand, @@ -1282,7 +1282,7 @@ public void visit(BLangWorkerSyncSendExpr syncSend) { BIROperand lhsOp = new BIROperand(tempVarDcl); this.env.targetOperand = lhsOp; - boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.value); + boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.getValue()); this.env.enclBB.terminator = new BIRTerminator.WorkerSend( syncSend.pos, Names.fromString(syncSend.getChannel().channelId()), dataOp, isOnSameStrand, true, lhsOp, @@ -1300,7 +1300,7 @@ public void visit(BLangWorkerFlushExpr flushExpr) { //create channelDetails array BIRNode.ChannelDetails[] channels = new BIRNode.ChannelDetails[flushExpr.cachedWorkerSendStmts.size()]; int i = 0; - boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.value); + boolean isOnSameStrand = DEFAULT_WORKER_NAME.equals(this.env.enclFunc.workerName.getValue()); for (BLangWorkerAsyncSendExpr sendStmt : flushExpr.cachedWorkerSendStmts) { channels[i] = new BIRNode.ChannelDetails(sendStmt.getChannel().channelId(), isOnSameStrand, true); i++; @@ -1687,7 +1687,7 @@ public void visit(BLangTypeInit connectorInitExpr) { BIRTypeDefinition def = typeDefs.get(objectTypeSymbol); instruction = new BIRNonTerminator.NewInstance(connectorInitExpr.pos, def, toVarRef, objectType); } else { - String objectName = objectTypeSymbol.name.value; + String objectName = objectTypeSymbol.name.getValue(); instruction = new BIRNonTerminator.NewInstance(connectorInitExpr.pos, objectTypeSymbol.pkgID, objectName, toVarRef, objectType); } @@ -2394,7 +2394,7 @@ private void populateBirLockWithGlobalVars(BLangLockStmt lockStmt) { birGlobalVar = dummyGlobalVarMapForLocks.computeIfAbsent(globalVar, k -> new BIRGlobalVariableDcl(null, globalVar.flags, globalVar.type, globalVar.pkgID, globalVar.name, globalVar.getOriginalName(), VarScope.GLOBAL, - VarKind.GLOBAL, globalVar.name.value, + VarKind.GLOBAL, globalVar.name.getValue(), globalVar.origin.toBIROrigin())); } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmCodeGenUtil.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmCodeGenUtil.java index 2b3344d2627d..2ae4fc158cb8 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmCodeGenUtil.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmCodeGenUtil.java @@ -202,8 +202,8 @@ public static String rewriteVirtualCallTypeName(String value, BType objectType) objectType = getImpliedType(objectType); // The call name will be in the format of`objectTypeName.funcName` for attached functions of imported modules. // Therefore, We need to remove the type name. - if (!objectType.tsymbol.name.value.isEmpty() && value.startsWith(objectType.tsymbol.name.value)) { - value = value.replace(objectType.tsymbol.name.value + ".", "").trim(); + if (!objectType.tsymbol.name.getValue().isEmpty() && value.startsWith(objectType.tsymbol.name.getValue())) { + value = value.replace(objectType.tsymbol.name.getValue() + ".", "").trim(); } return Utils.encodeFunctionIdentifier(value); } @@ -280,16 +280,16 @@ public static String getPackageName(PackageID packageID) { private static String getPackageNameWithSeparator(PackageID packageID, String separator) { String packageName = ""; - String orgName = Utils.encodeNonFunctionIdentifier(packageID.orgName.value); + String orgName = Utils.encodeNonFunctionIdentifier(packageID.orgName.getValue()); String moduleName; if (!packageID.isTestPkg) { - moduleName = Utils.encodeNonFunctionIdentifier(packageID.name.value); + moduleName = Utils.encodeNonFunctionIdentifier(packageID.name.getValue()); } else { - moduleName = Utils.encodeNonFunctionIdentifier(packageID.name.value) + Names.TEST_PACKAGE.value; + moduleName = Utils.encodeNonFunctionIdentifier(packageID.name.getValue()) + Names.TEST_PACKAGE.getValue(); } if (!moduleName.equals(ENCODED_DOT_CHARACTER)) { - if (!packageID.version.value.isEmpty()) { - packageName = getMajorVersion(packageID.version.value) + separator; + if (!packageID.version.getValue().isEmpty()) { + packageName = getMajorVersion(packageID.version.getValue()) + separator; } packageName = moduleName + separator + packageName; } @@ -470,9 +470,9 @@ public static String toNameString(BType t) { if ((typeSymbol.kind == SymbolKind.RECORD || typeSymbol.kind == SymbolKind.OBJECT) && ((BStructureTypeSymbol) typeSymbol).typeDefinitionSymbol != null) { return Utils.encodeNonFunctionIdentifier(((BStructureTypeSymbol) typeSymbol) - .typeDefinitionSymbol.name.value); + .typeDefinitionSymbol.name.getValue()); } - return Utils.encodeNonFunctionIdentifier(typeSymbol.name.value); + return Utils.encodeNonFunctionIdentifier(typeSymbol.name.getValue()); } public static boolean isBallerinaBuiltinModule(String orgName, String moduleName) { @@ -486,7 +486,7 @@ public static BirScope getLastScopeFromBBInsGen(MethodVisitor mv, LabelGenerator int insCount = bb.instructions.size(); for (int i = 0; i < insCount; i++) { - Label insLabel = labelGen.getLabel(funcName + bb.id.value + "ins" + i); + Label insLabel = labelGen.getLabel(funcName + bb.id.getValue() + "ins" + i); mv.visitLabel(insLabel); BIRAbstractInstruction inst = bb.instructions.get(i); if (inst != null) { @@ -555,7 +555,7 @@ public static void genYieldCheck(MethodVisitor mv, LabelGenerator labelGen, BIRN mv.visitMethodInsn(INVOKEVIRTUAL, STRAND_CLASS, "isYielded", "()Z", false); generateSetYieldedStatus(mv, labelGen, funcName, yieldLocationVarIndex, terminatorPos, fullyQualifiedFuncName, yieldStatus, yieldStatusVarIndex); - Label gotoLabel = labelGen.getLabel(funcName + thenBB.id.value); + Label gotoLabel = labelGen.getLabel(funcName + thenBB.id.getValue()); mv.visitJumpInsn(GOTO, gotoLabel); } @@ -582,24 +582,25 @@ protected static void generateSetYieldedStatus(MethodVisitor mv, LabelGenerator } public static PackageID cleanupPackageID(PackageID pkgID) { - Name org = new Name(Utils.encodeNonFunctionIdentifier(pkgID.orgName.value)); - Name module = new Name(Utils.encodeNonFunctionIdentifier(pkgID.name.value)); + Name org = new Name(Utils.encodeNonFunctionIdentifier(pkgID.orgName.getValue())); + Name module = new Name(Utils.encodeNonFunctionIdentifier(pkgID.name.getValue())); return new PackageID(org, module, pkgID.version); } public static boolean isBuiltInPackage(PackageID packageID) { packageID = cleanupPackageID(packageID); - return BALLERINA.equals(packageID.orgName.value) && BUILT_IN_PACKAGE_NAME.equals(packageID.name.value); + return BALLERINA.equals(packageID.orgName.getValue()) && + BUILT_IN_PACKAGE_NAME.equals(packageID.name.getValue()); } public static boolean isSameModule(PackageID moduleId, PackageID importModule) { PackageID cleanedPkg = cleanupPackageID(importModule); - if (!moduleId.orgName.value.equals(cleanedPkg.orgName.value)) { + if (!moduleId.orgName.getValue().equals(cleanedPkg.orgName.getValue())) { return false; - } else if (!moduleId.name.value.equals(cleanedPkg.name.value)) { + } else if (!moduleId.name.getValue().equals(cleanedPkg.name.getValue())) { return false; } else { - return getMajorVersion(moduleId.version.value).equals(getMajorVersion(cleanedPkg.version.value)); + return getMajorVersion(moduleId.version.getValue()).equals(getMajorVersion(cleanedPkg.version.getValue())); } } @@ -744,7 +745,7 @@ private JvmCodeGenUtil() { } public static String getRefTypeConstantName(BTypeReferenceType type) { - return JvmConstants.TYPEREF_TYPE_VAR_PREFIX + Utils.encodeNonFunctionIdentifier(type.tsymbol.name.value); + return JvmConstants.TYPEREF_TYPE_VAR_PREFIX + Utils.encodeNonFunctionIdentifier(type.tsymbol.name.getValue()); } public static void visitMaxStackForMethod(MethodVisitor mv, String funcName, String className) { diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmDesugarPhase.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmDesugarPhase.java index b406cce3835e..c0b775f4f80f 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmDesugarPhase.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmDesugarPhase.java @@ -113,14 +113,14 @@ private static void rewriteRecordInitFunction(BIRFunction func, BRecordType reco // Rename the function name by appending the record name to it. // This done to avoid frame class name overlapping. - func.name = new Name(toNameString(recordType) + func.name.value); + func.name = new Name(toNameString(recordType) + func.name.getValue()); // change the kind of receiver to 'ARG' receiver.kind = VarKind.ARG; // Update the name of the reciever. Then any instruction that was refering to the receiver will // now refer to the injected parameter. - String paramName = "$_" + receiver.name.value; + String paramName = "$_" + receiver.name.getValue(); receiver.name = new Name(paramName); // Inject an additional parameter to accept the self-record value into the init function @@ -154,22 +154,22 @@ static HashMap encodeModuleIdentifiers(BIRNode.BIRPackage module } private static void encodePackageIdentifiers(PackageID packageID, HashMap encodedVsInitialIds) { - packageID.orgName = Names.fromString(encodeNonFunctionIdentifier(packageID.orgName.value, + packageID.orgName = Names.fromString(encodeNonFunctionIdentifier(packageID.orgName.getValue(), encodedVsInitialIds)); - packageID.name = Names.fromString(encodeNonFunctionIdentifier(packageID.name.value, encodedVsInitialIds)); + packageID.name = Names.fromString(encodeNonFunctionIdentifier(packageID.name.getValue(), encodedVsInitialIds)); } private static void encodeTypeDefIdentifiers(List typeDefs, HashMap encodedVsInitialIds) { for (BIRTypeDefinition typeDefinition : typeDefs) { typeDefinition.type.tsymbol.name = Names.fromString(encodeNonFunctionIdentifier( - typeDefinition.type.tsymbol.name.value, encodedVsInitialIds)); + typeDefinition.type.tsymbol.name.getValue(), encodedVsInitialIds)); typeDefinition.internalName = - Names.fromString(encodeNonFunctionIdentifier(typeDefinition.internalName.value, + Names.fromString(encodeNonFunctionIdentifier(typeDefinition.internalName.getValue(), encodedVsInitialIds)); if (typeDefinition.referenceType != null) { typeDefinition.referenceType.tsymbol.name = Names.fromString(encodeNonFunctionIdentifier( - typeDefinition.referenceType.tsymbol.name.value, encodedVsInitialIds)); + typeDefinition.referenceType.tsymbol.name.getValue(), encodedVsInitialIds)); } encodeFunctionIdentifiers(typeDefinition.attachedFuncs, encodedVsInitialIds); @@ -181,13 +181,15 @@ private static void encodeTypeDefIdentifiers(List typeDefs, encodeAttachedFunctionIdentifiers(objectTypeSymbol.attachedFuncs, encodedVsInitialIds); } for (BField field : objectType.fields.values()) { - field.name = Names.fromString(encodeNonFunctionIdentifier(field.name.value, encodedVsInitialIds)); + field.name = Names.fromString( + encodeNonFunctionIdentifier(field.name.getValue(), encodedVsInitialIds)); } } if (bType.tag == TypeTags.RECORD) { BRecordType recordType = (BRecordType) bType; for (BField field : recordType.fields.values()) { - field.name = Names.fromString(encodeNonFunctionIdentifier(field.name.value, encodedVsInitialIds)); + field.name = Names.fromString( + encodeNonFunctionIdentifier(field.name.getValue(), encodedVsInitialIds)); } } } @@ -196,7 +198,7 @@ private static void encodeTypeDefIdentifiers(List typeDefs, private static void encodeFunctionIdentifiers(List functions, HashMap encodedVsInitialIds) { for (BIRFunction function : functions) { - function.name = Names.fromString(encodeFunctionIdentifier(function.name.value, encodedVsInitialIds)); + function.name = Names.fromString(encodeFunctionIdentifier(function.name.getValue(), encodedVsInitialIds)); for (BIRNode.BIRVariableDcl localVar : function.localVars) { if (localVar.metaVarName == null) { continue; @@ -204,12 +206,12 @@ private static void encodeFunctionIdentifiers(List functions, localVar.metaVarName = encodeNonFunctionIdentifier(localVar.metaVarName, encodedVsInitialIds); } for (BIRNode.BIRParameter parameter : function.requiredParams) { - parameter.name = Names.fromString(encodeNonFunctionIdentifier(parameter.name.value, + parameter.name = Names.fromString(encodeNonFunctionIdentifier(parameter.name.getValue(), encodedVsInitialIds)); } if (function.type.tsymbol != null) { for (BVarSymbol parameter : ((BInvokableTypeSymbol) function.type.tsymbol).params) { - parameter.name = Names.fromString(encodeNonFunctionIdentifier(parameter.name.value, + parameter.name = Names.fromString(encodeNonFunctionIdentifier(parameter.name.getValue(), encodedVsInitialIds)); } } @@ -224,7 +226,7 @@ private static void encodeDefaultFunctionName(BInvokableType type, HashMap encodedVsInitialIds) { if (function.workerName != null) { - function.workerName = Names.fromString(encodeNonFunctionIdentifier(function.workerName.value, + function.workerName = Names.fromString(encodeNonFunctionIdentifier(function.workerName.getValue(), encodedVsInitialIds)); } } @@ -240,7 +242,7 @@ private static void encodeWorkerName(BIRFunction function, private static void encodeAttachedFunctionIdentifiers(List functions, HashMap encodedVsInitialIds) { for (BAttachedFunction function : functions) { - function.funcName = Names.fromString(encodeFunctionIdentifier(function.funcName.value, + function.funcName = Names.fromString(encodeFunctionIdentifier(function.funcName.getValue(), encodedVsInitialIds)); } } @@ -248,14 +250,16 @@ private static void encodeAttachedFunctionIdentifiers(List fu private static void encodeGlobalVariableIdentifiers(List globalVars, HashMap encodedVsInitialIds) { for (BIRNode.BIRGlobalVariableDcl globalVar : globalVars) { - globalVar.name = Names.fromString(encodeNonFunctionIdentifier(globalVar.name.value, encodedVsInitialIds)); + globalVar.name = Names.fromString( + encodeNonFunctionIdentifier(globalVar.name.getValue(), encodedVsInitialIds)); } } private static void encodeImportedGlobalVariableIdentifiers(Set globalVars, HashMap encodedVsInitialIds) { for (BIRNode.BIRGlobalVariableDcl globalVar : globalVars) { - globalVar.name = Names.fromString(encodeNonFunctionIdentifier(globalVar.name.value, encodedVsInitialIds)); + globalVar.name = Names.fromString( + encodeNonFunctionIdentifier(globalVar.name.getValue(), encodedVsInitialIds)); } } @@ -369,7 +373,7 @@ private static String encodeNonFunctionIdentifier(String identifier, HashMap encodedVsInitialIds) { - String initialString = encodedVsInitialIds.get(encodedIdString.value); + String initialString = encodedVsInitialIds.get(encodedIdString.getValue()); if (initialString != null) { return Names.fromString(initialString); } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmErrorGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmErrorGen.java index c77ba0bd9e8f..a7792c44d0ab 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmErrorGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmErrorGen.java @@ -64,7 +64,7 @@ public JvmErrorGen(MethodVisitor mv, BIRVarToJVMIndexMap indexMap, JvmInstructio private BIRNode.BIRErrorEntry findErrorEntry(List errors, BIRNode.BIRBasicBlock currentBB) { for (BIRNode.BIRErrorEntry err : errors) { - if (err != null && err.endBB.id.value.equals(currentBB.id.value)) { + if (err != null && err.endBB.id.getValue().equals(currentBB.id.getValue())) { return err; } } @@ -88,7 +88,7 @@ public void generateTryCatch(BIRNode.BIRFunction func, String funcName, BIRNode. return; } - Label startLabel = labelGen.getLabel(funcName + currentEE.trapBB.id.value); + Label startLabel = labelGen.getLabel(funcName + currentEE.trapBB.id.getValue()); Label endLabel = new Label(); Label jumpLabel = new Label(); @@ -96,7 +96,7 @@ public void generateTryCatch(BIRNode.BIRFunction func, String funcName, BIRNode. this.mv.visitJumpInsn(GOTO, jumpLabel); if (currentEE instanceof JErrorEntry jCurrentEE) { BIRNode.BIRVariableDcl retVarDcl = currentEE.errorOp.variableDcl; - int retIndex = this.indexMap.addIfNotExists(retVarDcl.name.value, retVarDcl.type); + int retIndex = this.indexMap.addIfNotExists(retVarDcl.name.getValue(), retVarDcl.type); boolean exeptionExist = false; for (CatchIns catchIns : jCurrentEE.catchIns) { if (ERROR_VALUE.equals(catchIns.errorClass)) { @@ -138,7 +138,7 @@ public void generateTryCatch(BIRNode.BIRFunction func, String funcName, BIRNode. this.mv.visitLabel(errorValueLabel); BIRNode.BIRVariableDcl varDcl = currentEE.errorOp.variableDcl; - int lhsIndex = this.indexMap.addIfNotExists(varDcl.name.value, varDcl.type); + int lhsIndex = this.indexMap.addIfNotExists(varDcl.name.getValue(), varDcl.type); jvmInstructionGen.generateVarStore(this.mv, varDcl, lhsIndex); this.mv.visitJumpInsn(GOTO, jumpLabel); this.mv.visitLabel(otherErrorLabel); @@ -149,6 +149,6 @@ public void generateTryCatch(BIRNode.BIRFunction func, String funcName, BIRNode. } private int getJVMIndexOfVarRef(BIRNode.BIRVariableDcl varDcl) { - return this.indexMap.addIfNotExists(varDcl.name.value, varDcl.type); + return this.indexMap.addIfNotExists(varDcl.name.getValue(), varDcl.type); } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmInstructionGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmInstructionGen.java index 1f18e04c03ae..367289f5b064 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmInstructionGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmInstructionGen.java @@ -395,7 +395,7 @@ public void generateVarLoad(MethodVisitor mv, BIRNode.BIRVariableDcl varDcl, int return; } case CONSTANT, GLOBAL -> { - String varName = varDcl.name.value; + String varName = varDcl.name.getValue(); PackageID moduleId = ((BIRNode.BIRGlobalVariableDcl) varDcl).pkgId; String pkgName = JvmCodeGenUtil.getPackageName(moduleId); String className = jvmPackageGen.lookupGlobalVarClassName(pkgName, varName); @@ -443,7 +443,7 @@ public void generateVarStore(MethodVisitor mv, BIRNode.BIRVariableDcl varDcl, in BType bType = JvmCodeGenUtil.getImpliedType(varDcl.type); if (varDcl.kind == VarKind.GLOBAL || varDcl.kind == VarKind.CONSTANT) { - String varName = varDcl.name.value; + String varName = varDcl.name.getValue(); PackageID moduleId = ((BIRNode.BIRGlobalVariableDcl) varDcl).pkgId; String pkgName = JvmCodeGenUtil.getPackageName(moduleId); String className = jvmPackageGen.lookupGlobalVarClassName(pkgName, varName); @@ -1224,7 +1224,7 @@ private void generateBitwiseUnsignedRightShiftIns(BIRNonTerminator.BinaryOp bina } private int getJVMIndexOfVarRef(BIRNode.BIRVariableDcl varDcl) { - return this.indexMap.addIfNotExists(varDcl.name.value, varDcl.type); + return this.indexMap.addIfNotExists(varDcl.name.getValue(), varDcl.type); } void generateMapNewIns(BIRNonTerminator.NewStructure mapNewIns, int localVarOffset) { @@ -1636,7 +1636,7 @@ void generateObjectNewIns(BIRNonTerminator.NewInstance objectNewIns, int strandI objectNewIns.objectName); } else { className = getTypeValueClassName(JvmCodeGenUtil.getPackageName(type.tsymbol.pkgID), - objectNewIns.def.internalName.value); + objectNewIns.def.internalName.getValue()); } this.mv.visitTypeInsn(NEW, className); @@ -1668,7 +1668,7 @@ private void reloadObjectCtorAnnots(BType type, int strandIndex) { void generateFPLoadIns(BIRNonTerminator.FPLoad inst) { this.mv.visitTypeInsn(NEW, FUNCTION_POINTER); this.mv.visitInsn(DUP); - String name = inst.funcName.value; + String name = inst.funcName.getValue(); String funcKey = inst.pkgId.toString() + ":" + name; diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmPackageGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmPackageGen.java index f6316475a157..e25b62412d1c 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmPackageGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmPackageGen.java @@ -115,11 +115,11 @@ import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_INIT_CLASS_NAME; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_STARTED; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_START_ATTEMPTED; -import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.PARENT_MODULE_START_ATTEMPTED; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_STOP_METHOD; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_TYPES_CLASS_NAME; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.NO_OF_DEPENDANT_MODULES; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.OBJECT; +import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.PARENT_MODULE_START_ATTEMPTED; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.SERVICE_EP_AVAILABLE; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.TEST_EXECUTE_METHOD; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.VALUE_CREATOR; @@ -169,7 +169,7 @@ public class JvmPackageGen { } private static String getBvmAlias(String orgName, String moduleName) { - if (Names.ANON_ORG.value.equals(orgName)) { + if (Names.ANON_ORG.getValue().equals(orgName)) { return moduleName; } return orgName + "/" + moduleName; @@ -219,15 +219,15 @@ private static void addBuiltinImports(PackageID currentModule, Set de } public static boolean isLangModule(PackageID moduleId) { - if (!BALLERINA.equals(moduleId.orgName.value)) { + if (!BALLERINA.equals(moduleId.orgName.getValue())) { return false; } - return moduleId.name.value.startsWith("lang" + ENCODED_DOT_CHARACTER) || - moduleId.name.value.equals(ENCODED_JAVA_MODULE); + return moduleId.name.getValue().startsWith("lang" + ENCODED_DOT_CHARACTER) || + moduleId.name.getValue().equals(ENCODED_JAVA_MODULE); } private static void generatePackageVariable(BIRGlobalVariableDcl globalVar, ClassWriter cw) { - String varName = globalVar.name.value; + String varName = globalVar.name.getValue(); BType bType = globalVar.type; String descriptor = JvmCodeGenUtil.getFieldTypeSignature(bType); FieldVisitor fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, varName, descriptor, null, null); @@ -363,7 +363,7 @@ private static BIRFunction findFunction(BIRNode parentNode, String funcName) { private static BIRFunction findFunction(List functions, String funcName) { for (BIRFunction func : functions) { - if (func.name.value.equals(funcName)) { + if (func.name.getValue().equals(funcName)) { return func; } } @@ -474,7 +474,7 @@ private void linkGlobalVars(BIRPackage module, String initClass, boolean isEntry String pkgName = JvmCodeGenUtil.getPackageName(module.packageID); for (BIRGlobalVariableDcl globalVar : module.globalVars) { if (globalVar != null) { - globalVarClassMap.put(pkgName + globalVar.name.value, initClass); + globalVarClassMap.put(pkgName + globalVar.name.getValue(), initClass); } } @@ -497,7 +497,7 @@ private void linkTypeDefinitions(BIRPackage module, boolean isEntry) { for (BIRFunction func : attachedFuncs) { // link the bir function for lookup - String functionName = func.name.value; + String functionName = func.name.getValue(); String lookupKey = typeName + "." + functionName; String pkgName = JvmCodeGenUtil.getPackageName(module.packageID); String className = JvmValueGen.getTypeValueClassName(pkgName, typeName); @@ -533,7 +533,7 @@ private void linkModuleFunctions(BIRPackage birPackage, String initClass, boolea // Generate init class. Init function should be the first function of the package, hence check first // function. BIRFunction initFunc = functions.get(0); - String functionName = Utils.encodeFunctionIdentifier(initFunc.name.value); + String functionName = Utils.encodeFunctionIdentifier(initFunc.name.getValue()); String fileName = initFunc.pos.lineRange().fileName(); JavaClass klass = new JavaClass(fileName, fileName); klass.functions.add(0, initFunc); @@ -545,14 +545,14 @@ private void linkModuleFunctions(BIRPackage birPackage, String initClass, boolea // Add start function BIRFunction startFunc = functions.get(1); - functionName = Utils.encodeFunctionIdentifier(startFunc.name.value); + functionName = Utils.encodeFunctionIdentifier(startFunc.name.getValue()); birFunctionMap.put(pkgName + functionName, getFunctionWrapper(startFunc, packageID, initClass)); klass.functions.add(1, startFunc); count += 1; // Add stop function BIRFunction stopFunc = functions.get(2); - functionName = Utils.encodeFunctionIdentifier(stopFunc.name.value); + functionName = Utils.encodeFunctionIdentifier(stopFunc.name.getValue()); birFunctionMap.put(pkgName + functionName, getFunctionWrapper(stopFunc, packageID, initClass)); klass.functions.add(2, stopFunc); count += 1; @@ -564,7 +564,7 @@ private void linkModuleFunctions(BIRPackage birPackage, String initClass, boolea BIRFunction birFunc = functions.get(count); count = count + 1; // link the bir function for lookup - String birFuncName = birFunc.name.value; + String birFuncName = birFunc.name.getValue(); String balFileName; if (birFunc.pos == symbolTable.builtinPos) { balFileName = MODULE_INIT_CLASS_NAME; @@ -581,14 +581,14 @@ private void linkModuleFunctions(BIRPackage birPackage, String initClass, boolea } String cleanedBalFileName = balFileName; - if (!birFunc.name.value.startsWith(MethodGenUtils.encodeModuleSpecialFuncName(".` brakes because, // it's "file name" may end in `.bal` due to module. see #27201 cleanedBalFileName = JvmCodeGenUtil.cleanupPathSeparators(balFileName); } String birModuleClassName = getModuleLevelClassName(packageID, cleanedBalFileName); - if (!JvmCodeGenUtil.isBallerinaBuiltinModule(packageID.orgName.value, packageID.name.value)) { + if (!JvmCodeGenUtil.isBallerinaBuiltinModule(packageID.orgName.getValue(), packageID.name.getValue())) { JavaClass javaClass = jvmClassMap.get(birModuleClassName); if (javaClass != null) { javaClass.functions.add(birFunc); @@ -632,7 +632,7 @@ public byte[] getBytes(ClassWriter cw, BIRNode node) { BIRFunction func = findFunction(node, funcName); if (func != null && func.pos != null) { dlog.error(func.pos, DiagnosticErrorCode.METHOD_TOO_LARGE, - Utils.decodeIdentifier(func.name.value)); + Utils.decodeIdentifier(func.name.getValue())); } else { dlog.error(node.pos, DiagnosticErrorCode.METHOD_TOO_LARGE, Utils.decodeIdentifier(funcName)); @@ -699,7 +699,7 @@ CompiledJarFile generate(BIRPackage module) { boolean serviceEPAvailable = module.isListenerAvailable; for (BIRNode.BIRImportModule importModule : module.importModules) { BPackageSymbol pkgSymbol = packageCache.getSymbol( - getBvmAlias(importModule.packageID.orgName.value, importModule.packageID.name.value)); + getBvmAlias(importModule.packageID.orgName.getValue(), importModule.packageID.name.getValue())); if (pkgSymbol.bir != null) { String moduleInitClass = JvmCodeGenUtil.getModuleLevelClassName(pkgSymbol.bir.packageID, MODULE_INIT_CLASS_NAME); @@ -727,7 +727,8 @@ CompiledJarFile generate(BIRPackage module) { addBuiltinImports(module.packageID, immediateImports); for (BIRNode.BIRImportModule immediateImport : module.importModules) { BPackageSymbol pkgSymbol = packageCache.getSymbol( - getBvmAlias(immediateImport.packageID.orgName.value, immediateImport.packageID.name.value)); + getBvmAlias(immediateImport.packageID.orgName.getValue(), + immediateImport.packageID.name.getValue())); immediateImports.add(pkgSymbol.pkgID); } @@ -799,7 +800,7 @@ private BIRFunction getTestExecuteFunction(BIRPackage module) { private BIRFunction getFunction(BIRPackage module, String funcName) { BIRFunction function = null; for (BIRFunction birFunc : module.functions) { - if (birFunc.name.value.equals(funcName)) { + if (birFunc.name.getValue().equals(funcName)) { function = birFunc; break; } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTerminatorGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTerminatorGen.java index 27938d6c9f82..1c037923e055 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTerminatorGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTerminatorGen.java @@ -129,7 +129,6 @@ import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.LOCK_VALUE; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MAKE_CONCAT_WITH_CONSTANTS; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MAP; -import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.MODULE_INITIALIZER; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_INIT_CLASS_NAME; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.OBJECT; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.PANIC_FIELD; @@ -190,6 +189,7 @@ import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.LOAD_JOBJECT_TYPE; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.LOCK; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.MAP_PUT; +import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.MODULE_INITIALIZER; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.MULTIPLE_RECEIVE_CALL; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.PANIC_IF_IN_LOCK; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmSignatures.PASS_OBJECT_RETURN_OBJECT; @@ -352,7 +352,7 @@ private void genGoToTerm(BIRTerminator.GOTO gotoIns, String funcName, BIRNode.BI int currentBBNumber = currentBB.number; int gotoBBNumber = gotoIns.targetBB.number; if (currentBBNumber <= gotoBBNumber) { - Label gotoLabel = this.labelGen.getLabel(funcName + gotoIns.targetBB.id.value); + Label gotoLabel = this.labelGen.getLabel(funcName + gotoIns.targetBB.id.getValue()); this.mv.visitJumpInsn(GOTO, gotoLabel); return; } @@ -366,7 +366,7 @@ private void genGoToTerm(BIRTerminator.GOTO gotoIns, String funcName, BIRNode.BI private void genLockTerm(BIRTerminator.Lock lockIns, String funcName, int localVarOffset, int yieldLocationVarIndex, Location terminatorPos, String fullyQualifiedFuncName, int yieldStatusVarIndex) { - Label gotoLabel = this.labelGen.getLabel(funcName + lockIns.lockedBB.id.value); + Label gotoLabel = this.labelGen.getLabel(funcName + lockIns.lockedBB.id.getValue()); String lockStore = "L" + LOCK_STORE + ";"; String initClassName = jvmPackageGen.lookupGlobalVarClassName(this.currentPackageName, LOCK_STORE_VAR_NAME); String lockName = GLOBAL_LOCK_NAME + lockIns.lockId; @@ -383,7 +383,7 @@ private void genLockTerm(BIRTerminator.Lock lockIns, String funcName, int localV private void genUnlockTerm(BIRTerminator.Unlock unlockIns, String funcName) { - Label gotoLabel = this.labelGen.getLabel(funcName + unlockIns.unlockBB.id.value); + Label gotoLabel = this.labelGen.getLabel(funcName + unlockIns.unlockBB.id.getValue()); // unlocked in the same order https://yarchive.net/comp/linux/lock_ordering.html String lockStore = "L" + LOCK_STORE + ";"; @@ -436,9 +436,9 @@ private void notifyChannels(List channels, int retIndex, private void genBranchTerm(BIRTerminator.Branch branchIns, String funcName) { this.loadVar(branchIns.op.variableDcl); - Label trueBBLabel = this.labelGen.getLabel(funcName + branchIns.trueBB.id.value); + Label trueBBLabel = this.labelGen.getLabel(funcName + branchIns.trueBB.id.getValue()); this.mv.visitJumpInsn(IFGT, trueBBLabel); - Label falseBBLabel = this.labelGen.getLabel(funcName + branchIns.falseBB.id.value); + Label falseBBLabel = this.labelGen.getLabel(funcName + branchIns.falseBB.id.getValue()); this.mv.visitJumpInsn(GOTO, falseBBLabel); } @@ -629,7 +629,7 @@ private void genJICallTerm(JIMethodCall callIns, int localVarOffset, BIRNode.BIR } if (callIns.varArgExist) { BIROperand arg = callIns.args.get(argIndex); - int localVarIndex = this.indexMap.addIfNotExists(arg.variableDcl.name.value, arg.variableDcl.type); + int localVarIndex = this.indexMap.addIfNotExists(arg.variableDcl.name.getValue(), arg.variableDcl.type); genVarArg(this.mv, this.indexMap, arg.variableDcl.type, callIns.varArgType, localVarIndex, symbolTable, jvmCastGen); } @@ -759,13 +759,13 @@ private void genCall(BIRTerminator.Call callIns, PackageID packageID, int localV } private void genFuncCall(BIRTerminator.Call callIns, PackageID packageID, int localVarOffset) { - String methodName = callIns.name.value; + String methodName = callIns.name.getValue(); this.genStaticCall(callIns, packageID, localVarOffset, methodName, methodName); } private void genBuiltinTypeAttachedFuncCall(BIRTerminator.Call callIns, PackageID packageID, int localVarOffset) { - String methodLookupName = callIns.name.value; + String methodLookupName = callIns.name.getValue(); int optionalIndex = methodLookupName.indexOf("."); int index = optionalIndex != -1 ? optionalIndex + 1 : 0; String methodName = methodLookupName.substring(index); @@ -803,7 +803,7 @@ private void genStaticCall(BIRTerminator.Call callIns, PackageID packageID, int packageID.orgName.getValue() + "/" + packageID.name.getValue()); Name decodedMethodName = new Name(Utils.decodeIdentifier(methodName)); BInvokableSymbol funcSymbol = (BInvokableSymbol) symbol.scope.lookup(decodedMethodName).symbol; - if (funcSymbol == null && JvmCodeGenUtil.isModuleInitializerMethod(decodedMethodName.value)) { + if (funcSymbol == null && JvmCodeGenUtil.isModuleInitializerMethod(decodedMethodName.getValue())) { // moduleInit() and moduleStart() functions are not present in the BIR cache because they are generated // in CodeGen phase. Therefore, they are not found inside the packageSymbol scope. jvmClass = JvmCodeGenUtil.getModuleLevelClassName(packageID, @@ -841,7 +841,7 @@ private void genVirtualCall(BIRTerminator.Call callIns, int localVarOffset) { this.mv.visitVarInsn(ALOAD, localVarOffset); // load the function name as the second argument - this.mv.visitLdcInsn(JvmCodeGenUtil.rewriteVirtualCallTypeName(callIns.name.value, selfArg.type)); + this.mv.visitLdcInsn(JvmCodeGenUtil.rewriteVirtualCallTypeName(callIns.name.getValue(), selfArg.type)); // create an Object[] for the rest params int argsCount = callIns.args.size() - 1; this.mv.visitLdcInsn((long) (argsCount)); @@ -905,7 +905,7 @@ private void genAsyncCallTerm(BIRTerminator.AsyncCall callIns, int localVarOffse paramIndex += 1; } - LambdaFunction lambdaFunction = asyncDataCollector.addAndGetLambda(callIns.name.value, callIns, true); + LambdaFunction lambdaFunction = asyncDataCollector.addAndGetLambda(callIns.name.getValue(), callIns, true); JvmCodeGenUtil.createFunctionPointer(this.mv, lambdaFunction.enclosingClass, lambdaFunction.lambdaName); boolean concurrent = false; @@ -914,7 +914,7 @@ private void genAsyncCallTerm(BIRTerminator.AsyncCall callIns, int localVarOffse if (!callIns.annotAttachments.isEmpty()) { for (BIRNode.BIRAnnotationAttachment annotationAttachment : callIns.annotAttachments) { if (annotationAttachment == null || - !STRAND.equals(annotationAttachment.annotTagRef.value) || + !STRAND.equals(annotationAttachment.annotTagRef.getValue()) || !JvmCodeGenUtil.isBuiltInPackage(annotationAttachment.annotPkgId)) { continue; } @@ -1149,7 +1149,7 @@ private void genWorkerSendIns(BIRTerminator.WorkerSend ins, int localVarOffset, this.mv.visitInvokeDynamicInsn(MAKE_CONCAT_WITH_CONSTANTS, INT_TO_STRING, new Handle(H_INVOKESTATIC, STRING_CONCAT_FACTORY, MAKE_CONCAT_WITH_CONSTANTS, HANDLE_DESCRIPTOR_FOR_STRING_CONCAT, false), - ins.channel.value + START_OF_HEADING_WITH_SEMICOLON); + ins.channel.getValue() + START_OF_HEADING_WITH_SEMICOLON); this.mv.visitMethodInsn(INVOKEVIRTUAL, WD_CHANNELS, "getWorkerDataChannel", GET_WORKER_DATA_CHANNEL, false); this.loadVar(ins.data.variableDcl); jvmCastGen.addBoxInsn(this.mv, ins.data.variableDcl.type); @@ -1251,7 +1251,7 @@ private void genWorkerReceiveIns(BIRTerminator.WorkerReceive ins, int localVarOf this.mv.visitInvokeDynamicInsn(MAKE_CONCAT_WITH_CONSTANTS, INT_TO_STRING, new Handle(H_INVOKESTATIC, STRING_CONCAT_FACTORY, MAKE_CONCAT_WITH_CONSTANTS, HANDLE_DESCRIPTOR_FOR_STRING_CONCAT, false), - ins.workerName.value + START_OF_HEADING_WITH_SEMICOLON); + ins.workerName.getValue() + START_OF_HEADING_WITH_SEMICOLON); this.mv.visitMethodInsn(INVOKEVIRTUAL, WD_CHANNELS, "getWorkerDataChannel", GET_WORKER_DATA_CHANNEL, false); this.mv.visitVarInsn(ALOAD, localVarOffset); @@ -1290,7 +1290,7 @@ private void submitToScheduler(BIROperand lhsOp, BType attachedType, String pare String metaDataVarName; if (attachedType != null) { - metaDataVarName = setAndGetStrandMetadataVarName(attachedType.tsymbol.name.value, parentFunction, + metaDataVarName = setAndGetStrandMetadataVarName(attachedType.tsymbol.name.getValue(), parentFunction, asyncDataCollector); } else { metaDataVarName = JvmCodeGenUtil.setAndGetStrandMetadataVarName(parentFunction, asyncDataCollector); @@ -1330,7 +1330,7 @@ private void loadFpReturnType(BIROperand lhsOp) { } private int getJVMIndexOfVarRef(BIRNode.BIRVariableDcl varDcl) { - return this.indexMap.addIfNotExists(varDcl.name.value, varDcl.type); + return this.indexMap.addIfNotExists(varDcl.name.getValue(), varDcl.type); } private void loadVar(BIRNode.BIRVariableDcl varDcl) { diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeGen.java index e6d31db01347..f150f2207313 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeGen.java @@ -231,7 +231,7 @@ void generateUserDefinedTypeFields(ClassWriter cw, List typeD // do not generate anything for other types (e.g.: finite type, type reference types etc.) continue; } - String name = typeDef.internalName.value; + String name = typeDef.internalName.getValue(); generateTypeField(cw, name); generateTypedescField(cw, name); } @@ -730,7 +730,7 @@ private void loadIntersectionType(MethodVisitor mv, BIntersectionType bType) { mv.visitTypeInsn(NEW, INTERSECTION_TYPE_IMPL); mv.visitInsn(DUP); - mv.visitLdcInsn(Utils.decodeIdentifier(bType.tsymbol.name.value)); + mv.visitLdcInsn(Utils.decodeIdentifier(bType.tsymbol.name.getValue())); String varName = jvmConstantsGen.getModuleConstantVar(bType.tsymbol.pkgID); mv.visitFieldInsn(GETSTATIC, jvmConstantsGen.getModuleConstantClass(), varName, GET_MODULE); // Create the constituent types array. @@ -785,9 +785,9 @@ private void loadUserDefinedType(MethodVisitor mv, BType bType) { String typeOwner = JvmCodeGenUtil.getPackageName(pkgID) + MODULE_INIT_CLASS_NAME; String defName = ""; if ((typeSymbol.kind == SymbolKind.RECORD || typeSymbol.kind == SymbolKind.OBJECT) - && typeSymbol.name.value.isEmpty()) { - defName = Utils - .encodeNonFunctionIdentifier(((BStructureTypeSymbol) typeSymbol).typeDefinitionSymbol.name.value); + && typeSymbol.name.getValue().isEmpty()) { + defName = Utils.encodeNonFunctionIdentifier( + ((BStructureTypeSymbol) typeSymbol).typeDefinitionSymbol.name.getValue()); } //class symbols String fieldName = defName.isEmpty() ? getTypeFieldName(toNameString(typeToLoad)) : defName; @@ -906,18 +906,18 @@ private void populateFunctionParameters(MethodVisitor mv, BInvokableTypeSymbol i mv.visitInsn(L2I); mv.visitTypeInsn(NEW, FUNCTION_PARAMETER); mv.visitInsn(DUP); - mv.visitLdcInsn(paramSymbol.name.value); + mv.visitLdcInsn(paramSymbol.name.getValue()); if (paramSymbol.isDefaultable) { mv.visitInsn(ICONST_1); } else { mv.visitInsn(ICONST_0); } BInvokableSymbol bInvokableSymbol = invokableSymbol.defaultValues.get( - Utils.decodeIdentifier(paramSymbol.name.value)); + Utils.decodeIdentifier(paramSymbol.name.getValue())); if (bInvokableSymbol == null) { mv.visitInsn(ACONST_NULL); } else { - mv.visitLdcInsn(bInvokableSymbol.name.value); + mv.visitLdcInsn(bInvokableSymbol.name.getValue()); } loadType(mv, paramSymbol.type); mv.visitMethodInsn(INVOKESPECIAL, FUNCTION_PARAMETER, JVM_INIT_METHOD, INIT_FUNCTION_PARAM, false); @@ -1013,7 +1013,7 @@ private void loadFiniteType(MethodVisitor mv, BFiniteType finiteType) { String name = Utils.decodeIdentifier(toNameString(finiteType)); mv.visitLdcInsn(name); // load original type name - mv.visitLdcInsn(finiteType.tsymbol.originalName.value); + mv.visitLdcInsn(finiteType.tsymbol.originalName.getValue()); mv.visitTypeInsn(NEW, LINKED_HASH_SET); mv.visitInsn(DUP); diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeTestGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeTestGen.java index cd3a61752802..0fd50ef0968a 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeTestGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTypeTestGen.java @@ -68,7 +68,7 @@ void generateTypeTestIns(BIRNonTerminator.TypeTest typeTestIns) { // instanceof operator. if (canOptimizeNilCheck(sourceType, targetType) || canOptimizeNilUnionCheck(sourceType, targetType) || - sourceValue.name.value.startsWith(MAIN_ARG_VAR_PREFIX)) { + sourceValue.name.getValue().startsWith(MAIN_ARG_VAR_PREFIX)) { handleNilUnionType(typeTestIns); return; } @@ -146,7 +146,7 @@ private boolean canOptimizeErrorCheck(BType sourceType, BType targetType) { } } return (foundError == 1 && types.isAssignable(errorType, targetType)) || (foundError > 0 && "error".equals( - targetType.tsymbol.name.value)); + targetType.tsymbol.name.getValue())); } /** diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmValueGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmValueGen.java index f0802f68060d..a1bb8818dd46 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmValueGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmValueGen.java @@ -190,8 +190,8 @@ void generateValueClasses(JarEntries jarEntries, JvmConstantsGen jvmConstantsGen return; } BType bType = optionalTypeDef.type; - String className = getTypeValueClassName(packageName, optionalTypeDef.internalName.value); - String valueClass = VALUE_CLASS_PREFIX + optionalTypeDef.internalName.value; + String className = getTypeValueClassName(packageName, optionalTypeDef.internalName.getValue()); + String valueClass = VALUE_CLASS_PREFIX + optionalTypeDef.internalName.getValue(); asyncDataCollector.setCurrentSourceFileName(valueClass); asyncDataCollector.setCurrentSourceFileWithoutExt(valueClass); if (optionalTypeDef.type.tag == TypeTags.OBJECT && @@ -204,7 +204,7 @@ void generateValueClasses(JarEntries jarEntries, JvmConstantsGen jvmConstantsGen byte[] bytes = this.createRecordValueClass(recordType, className, optionalTypeDef, asyncDataCollector, jvmTypeGen); jarEntries.put(className + CLASS_FILE_SUFFIX, bytes); - String typedescClass = getTypeDescClassName(packageName, optionalTypeDef.internalName.value); + String typedescClass = getTypeDescClassName(packageName, optionalTypeDef.internalName.getValue()); bytes = this.createRecordTypeDescClass(recordType, typedescClass, optionalTypeDef, jvmTypeGen); jarEntries.put(typedescClass + CLASS_FILE_SUFFIX, bytes); } @@ -316,7 +316,7 @@ private byte[] createRecordValueClass(BRecordType recordType, String className, jvmRecordGen.createAndSplitContainsKeyMethod(cw, fields, className); jvmRecordGen.createAndSplitGetValuesMethod(cw, fields, className, jvmCastGen); this.createGetSizeMethod(cw, fields, className); - this.createRecordClearMethod(cw, typeDef.name.value); + this.createRecordClearMethod(cw, typeDef.name.getValue()); jvmRecordGen.createAndSplitRemoveMethod(cw, fields, className, jvmCastGen); jvmRecordGen.createAndSplitGetKeysMethod(cw, fields, className); this.createRecordPopulateInitialValuesMethod(cw, className); @@ -393,7 +393,7 @@ private void createRecordFields(ClassWriter cw, Map fields) { if (field == null) { continue; } - String fieldName = field.name.value; + String fieldName = field.name.getValue(); FieldVisitor fv = cw.visitField(0, fieldName, getTypeDesc(field.type), null, null); fv.visitEnd(); @@ -418,7 +418,7 @@ private void createGetSizeMethod(ClassWriter cw, Map fields, Str int requiredFieldsCount = 0; for (BField optionalField : fields.values()) { - String fieldName = optionalField.name.value; + String fieldName = optionalField.name.getValue(); if (isOptionalRecordField(optionalField)) { mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, className, getFieldIsPresentFlagName(fieldName), @@ -490,10 +490,10 @@ private void createObjectFields(ClassWriter cw, Map fields) { if (field == null) { continue; } - FieldVisitor fvb = cw.visitField(0, field.name.value, getTypeDesc(field.type), null, null); + FieldVisitor fvb = cw.visitField(0, field.name.getValue(), getTypeDesc(field.type), null, null); fvb.visitEnd(); String lockClass = "L" + LOCK_VALUE + ";"; - FieldVisitor fv = cw.visitField(ACC_PUBLIC, computeLockNameFromString(field.name.value), + FieldVisitor fv = cw.visitField(ACC_PUBLIC, computeLockNameFromString(field.name.getValue()), lockClass, null, null); fv.visitEnd(); } @@ -524,7 +524,7 @@ private void createObjectMethodsWithSplitClasses(ClassWriter cw, List fields, String mv.visitTypeInsn(NEW, LOCK_VALUE); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, LOCK_VALUE, JVM_INIT_METHOD, VOID_METHOD_DESC, false); - mv.visitFieldInsn(PUTFIELD, className, computeLockNameFromString(field.name.value), lockClass); + mv.visitFieldInsn(PUTFIELD, className, computeLockNameFromString(field.name.getValue()), lockClass); } mv.visitInsn(RETURN); diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FieldNameHashComparator.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FieldNameHashComparator.java index ab6a4db5d4ac..567d7d79a222 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FieldNameHashComparator.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FieldNameHashComparator.java @@ -32,8 +32,8 @@ public class FieldNameHashComparator implements Comparator { @Override public int compare(NamedNode o1, NamedNode o2) { - String name1 = Utils.decodeIdentifier(o1.getName().value); - String name2 = Utils.decodeIdentifier(o2.getName().value); + String name1 = Utils.decodeIdentifier(o1.getName().getValue()); + String name2 = Utils.decodeIdentifier(o2.getName().getValue()); return Integer.compare(name1.hashCode(), name2.hashCode()); } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FunctionParamComparator.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FunctionParamComparator.java index 55bb1b2450d0..0e8a902ce701 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FunctionParamComparator.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/FunctionParamComparator.java @@ -35,7 +35,7 @@ public int compare(BIRNode.BIRVariableDcl o1, BIRNode.BIRVariableDcl o2) { return Integer.compare(getWeight(o1), getWeight(o2)); } if (o1.kind == VarKind.TEMP) { - return Integer.compare(o1.name.value.hashCode(), o2.name.value.hashCode()); + return Integer.compare(o1.name.getValue().hashCode(), o2.name.getValue().hashCode()); } return 0; } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/NameHashComparator.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/NameHashComparator.java index f2ba568c7512..d1818a7165f3 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/NameHashComparator.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/internal/NameHashComparator.java @@ -30,8 +30,8 @@ public class NameHashComparator implements Comparator { @Override public int compare(NamedNode o1, NamedNode o2) { - String name1 = o1.getName().value; - String name2 = o2.getName().value; + String name1 = o1.getName().getValue(); + String name2 = o2.getName().getValue(); return Integer.compare(name1.hashCode(), name2.hashCode()); } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/AnnotationProc.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/AnnotationProc.java index 29671469e10d..c13f7058129c 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/AnnotationProc.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/AnnotationProc.java @@ -57,7 +57,7 @@ static InteropValidationRequest getInteropAnnotValue(BIRFunction birFunc) { return null; } - String annotTagRef = annotAttach.annotTagRef.value; + String annotTagRef = annotAttach.annotTagRef.getValue(); return createJInteropValidationRequest(annotTagRef, annotAttach, birFunc); } @@ -73,9 +73,9 @@ private static BIRAnnotationAttachment getInteropAnnotAttachment(BIRFunction bir private static boolean isInteropAnnotAttachment(BIRAnnotationAttachment annotAttach) { - return INTEROP_ANNOT_ORG.equals(annotAttach.annotPkgId.orgName.value) && - INTEROP_ANNOT_MODULE.equals(annotAttach.annotPkgId.name.value) && - isInteropAnnotationTag(annotAttach.annotTagRef.value); + return INTEROP_ANNOT_ORG.equals(annotAttach.annotPkgId.orgName.getValue()) && + INTEROP_ANNOT_MODULE.equals(annotAttach.annotPkgId.name.getValue()) && + isInteropAnnotationTag(annotAttach.annotTagRef.getValue()); } private static InteropValidationRequest createJInteropValidationRequest(String annotTagRef, @@ -174,7 +174,7 @@ private static String getJMethodNameFromAnnot(String annotTagRef, return JVM_INIT_METHOD; } else { String methodName = (String) getLiteralValueFromAnnotValue(jNameValueEntry); - return methodName != null ? methodName : birFunc.name.value; + return methodName != null ? methodName : birFunc.name.getValue(); } } @@ -182,6 +182,6 @@ private static String getJFieldNameFromAnnot(BIRNode.ConstValue jNameValueEntry, BIRFunction birFunc) { String fieldName = (String) getLiteralValueFromAnnotValue(jNameValueEntry); - return fieldName != null ? fieldName : birFunc.name.value; + return fieldName != null ? fieldName : birFunc.name.getValue(); } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/InteropMethodGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/InteropMethodGen.java index 753a8ba3eadf..c607282c7a5c 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/InteropMethodGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/InteropMethodGen.java @@ -147,7 +147,7 @@ static void genJFieldForInteropField(JFieldBIRFunction birFunc, ClassWriter clas String desc = JvmCodeGenUtil.getMethodDesc(birFunc.type.paramTypes, retType); int access = birFunc.receiver != null ? ACC_PUBLIC : ACC_PUBLIC + ACC_STATIC; - MethodVisitor mv = classWriter.visitMethod(access, birFunc.name.value, desc, null, null); + MethodVisitor mv = classWriter.visitMethod(access, birFunc.name.getValue(), desc, null, null); JvmInstructionGen instGen = new JvmInstructionGen(mv, indexMap, birModule, jvmPackageGen, jvmTypeGen, jvmCastGen, jvmConstantsGen, asyncDataCollector, types); JvmErrorGen errorGen = new JvmErrorGen(mv, indexMap, instGen); @@ -166,7 +166,7 @@ static void genJFieldForInteropField(JFieldBIRFunction birFunc, ClassWriter clas for (BIRVariableDcl birLocalVarOptional : birFunc.localVars) { if (birLocalVarOptional instanceof BIRNode.BIRFunctionParameter functionParameter) { birFuncParams.add(functionParameter); - indexMap.addIfNotExists(functionParameter.name.value, functionParameter.type); + indexMap.addIfNotExists(functionParameter.name.getValue(), functionParameter.type); } } @@ -176,7 +176,7 @@ static void genJFieldForInteropField(JFieldBIRFunction birFunc, ClassWriter clas // Load receiver which is the 0th parameter in the birFunc if (!jField.isStatic()) { BIRNode.BIRVariableDcl var = birFuncParams.get(0); - int receiverLocalVarIndex = indexMap.addIfNotExists(var.name.value, var.type); + int receiverLocalVarIndex = indexMap.addIfNotExists(var.name.getValue(), var.type); mv.visitVarInsn(ALOAD, receiverLocalVarIndex); mv.visitMethodInsn(INVOKEVIRTUAL, HANDLE_VALUE, GET_VALUE_METHOD, "()Ljava/lang/Object;", false); mv.visitTypeInsn(CHECKCAST, jField.getDeclaringClassName()); @@ -203,7 +203,7 @@ static void genJFieldForInteropField(JFieldBIRFunction birFunc, ClassWriter clas int birFuncParamIndex = jField.isStatic() ? 0 : 1; if (birFuncParamIndex < birFuncParams.size()) { BIRNode.BIRFunctionParameter birFuncParam = birFuncParams.get(birFuncParamIndex); - int paramLocalVarIndex = indexMap.addIfNotExists(birFuncParam.name.value, birFuncParam.type); + int paramLocalVarIndex = indexMap.addIfNotExists(birFuncParam.name.getValue(), birFuncParam.type); loadMethodParamToStackInInteropFunction(mv, birFuncParam, jFieldType, paramLocalVarIndex, instGen, jvmCastGen); } @@ -224,7 +224,7 @@ static void genJFieldForInteropField(JFieldBIRFunction birFunc, ClassWriter clas // Handle return type BIRVariableDcl retVarDcl = new BIRVariableDcl(retType, new Name("$_ret_var_$"), null, VarKind.LOCAL); - int returnVarRefIndex = indexMap.addIfNotExists(retVarDcl.name.value, retType); + int returnVarRefIndex = indexMap.addIfNotExists(retVarDcl.name.getValue(), retType); int retTypeTag = JvmCodeGenUtil.getImpliedType(retType).tag; if (retTypeTag == TypeTags.NIL) { @@ -253,7 +253,7 @@ static void genJFieldForInteropField(JFieldBIRFunction birFunc, ClassWriter clas mv.visitLabel(retLabel); mv.visitLineNumber(birFunc.pos.lineRange().endLine().line() + 1, retLabel); termGen.genReturnTerm(returnVarRefIndex, birFunc, -1, 0); - JvmCodeGenUtil.visitMaxStackForMethod(mv, birFunc.name.value, birFunc.javaField.getDeclaringClassName()); + JvmCodeGenUtil.visitMaxStackForMethod(mv, birFunc.name.getValue(), birFunc.javaField.getDeclaringClassName()); mv.visitEnd(); } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/JMethodResolver.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/JMethodResolver.java index 29c69a942619..73086e8e49f6 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/JMethodResolver.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/JMethodResolver.java @@ -551,7 +551,8 @@ private void validateReturnTypes(JMethodRequest jMethodRequest, JMethod jMethod) jMethodRequest.declaringClass.getName() + "': Java type '" + jReturnType.getName() + "' will not be matched to ballerina type '" + - (bReturnType.tag == TypeTags.FINITE ? bReturnType.tsymbol.name.value : + (bReturnType.tag == TypeTags.FINITE ? + bReturnType.tsymbol.name.getValue() : bReturnType) + "'"); } } @@ -1095,7 +1096,7 @@ private void throwNoSuchMethodError(String methodName, Class jType, BType bTy throw new JInteropException(DiagnosticErrorCode.METHOD_SIGNATURE_DOES_NOT_MATCH, "Incompatible param type for method '" + methodName + "' in class '" + declaringClass.getName() + "': Java type '" + jType.getName() + "' will not be matched to ballerina type '" + - (bType.tag == TypeTags.FINITE ? bType.tsymbol.name.value : bType) + "'"); + (bType.tag == TypeTags.FINITE ? bType.tsymbol.name.getValue() : bType) + "'"); } private void throwParamCountMismatchError(JMethodRequest jMethodRequest) throws JInteropException { diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/ConfigMethodGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/ConfigMethodGen.java index 1618d381a41d..614324c8ab7e 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/ConfigMethodGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/ConfigMethodGen.java @@ -196,7 +196,7 @@ private void populateConfigDataMethod(ClassWriter cw, String moduleClass, mv.visitInsn(DUP); mv.visitFieldInsn(GETSTATIC, moduleClass, CURRENT_MODULE_VAR_NAME, "L" + MODULE + ";"); - mv.visitLdcInsn(globalVar.name.value); + mv.visitLdcInsn(globalVar.name.getValue()); jvmTypeGen.loadType(mv, globalVar.type); mv.visitLdcInsn(getOneBasedLocationString(module, globalVar.pos)); if (Symbols.isFlagOn(globalVarFlags, Flags.REQUIRED)) { diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/FrameClassGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/FrameClassGen.java index 3a116ac0efba..e15d04359fd0 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/FrameClassGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/FrameClassGen.java @@ -73,7 +73,7 @@ private void generateFrameClassForFunction(PackageID packageID, BIRNode.BIRFunct JarEntries pkgEntries, BType attachedType) { String frameClassName = MethodGenUtils.getFrameClassName(JvmCodeGenUtil.getPackageName(packageID), - func.name.value, attachedType); + func.name.getValue(), attachedType); ClassWriter cw = new BallerinaClassWriter(COMPUTE_FRAMES); if (func.pos != null && func.pos.lineRange().fileName() != null) { cw.visitSource(func.pos.lineRange().fileName(), null); diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/InitMethodGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/InitMethodGen.java index 4393d2ae2c46..d45ba12e51e7 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/InitMethodGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/InitMethodGen.java @@ -521,7 +521,7 @@ private BIRNode.BIRGlobalVariableDcl getDefaultFuncFPGlobalVar(Name name, List globalVars) { for (BIRNode.BIRGlobalVariableDcl globalVar : globalVars) { - if (globalVar.name.value.equals(name.value)) { + if (globalVar.name.getValue().equals(name.getValue())) { return globalVar; } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/LambdaGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/LambdaGen.java index db6a0d634707..d1f6f127baa5 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/LambdaGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/LambdaGen.java @@ -228,7 +228,7 @@ private void genLoadDataForObjectAttachedLambdas(BIRTerminator.AsyncCall ins, Me mv.visitInsn(AALOAD); mv.visitTypeInsn(CHECKCAST, STRAND_CLASS); - mv.visitLdcInsn(JvmCodeGenUtil.rewriteVirtualCallTypeName(ins.name.value, ref.variableDcl.type)); + mv.visitLdcInsn(JvmCodeGenUtil.rewriteVirtualCallTypeName(ins.name.getValue(), ref.variableDcl.type)); int objectArrayLength = paramTypes.size() - 1; mv.visitIntInsn(BIPUSH, objectArrayLength); mv.visitTypeInsn(ANEWARRAY, OBJECT); @@ -461,17 +461,17 @@ private boolean isExternStaticFunctionCall(BIRInstruction callIns) { if (call.isVirtual) { return false; } - methodName = call.name.value; + methodName = call.name.getValue(); packageID = call.calleePkg; } case ASYNC_CALL -> { BIRTerminator.AsyncCall asyncCall = (BIRTerminator.AsyncCall) callIns; - methodName = asyncCall.name.value; + methodName = asyncCall.name.getValue(); packageID = asyncCall.calleePkg; } case FP_LOAD -> { BIRNonTerminator.FPLoad fpLoad = (BIRNonTerminator.FPLoad) callIns; - methodName = fpLoad.funcName.value; + methodName = fpLoad.funcName.getValue(); packageID = fpLoad.pkgId; } default -> throw new BLangCompilerException("JVM static function call generation is not supported for " + diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MainMethodGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MainMethodGen.java index e4bd8a182f6c..34fdba0b97c7 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MainMethodGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MainMethodGen.java @@ -438,7 +438,8 @@ private List getDefaultableNames(List a List defaultableNames = new ArrayList<>(); int defaultableIndex = 0; for (BIRNode.BIRAnnotationAttachment attachment : annotAttachments) { - if (attachment != null && attachment.annotTagRef.value.equals(JvmConstants.DEFAULTABLE_ARGS_ANOT_NAME)) { + if (attachment != null && + attachment.annotTagRef.getValue().equals(JvmConstants.DEFAULTABLE_ARGS_ANOT_NAME)) { Map annotFieldMap = (Map) ((BIRNode.BIRConstAnnotationAttachment) attachment).annotValue.value; diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGen.java index 003e3869bb48..354118d688ce 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGen.java @@ -118,9 +118,9 @@ import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_INIT_CLASS_NAME; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_STARTED; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_START_ATTEMPTED; -import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.PARENT_MODULE_START_ATTEMPTED; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.NO_OF_DEPENDANT_MODULES; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.OBJECT_SELF_INSTANCE; +import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.PARENT_MODULE_START_ATTEMPTED; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.STACK; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.STRAND; import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.STRAND_CLASS; @@ -196,7 +196,7 @@ public void genJMethodWithBObjectMethodCall(BIRFunction func, ClassWriter cw, BI BIRVarToJVMIndexMap indexMap = new BIRVarToJVMIndexMap(); indexMap.addIfNotExists(OBJECT_SELF_INSTANCE, symbolTable.anyType); indexMap.addIfNotExists(STRAND, symbolTable.stringType); - String funcName = func.name.value; + String funcName = func.name.getValue(); BType retType = getReturnType(func); String desc = JvmCodeGenUtil.getMethodDesc(func.type.paramTypes, retType); MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, funcName, desc, null, null); @@ -209,7 +209,7 @@ public void genJMethodWithBObjectMethodCall(BIRFunction func, ClassWriter cw, BI mv.visitVarInsn(ALOAD, 0); // load self String encodedMethodName = Utils.encodeFunctionIdentifier(funcName); for (BIRNode.BIRFunctionParameter parameter : func.parameters) { - instGen.generateVarLoad(mv, parameter, indexMap.addIfNotExists(parameter.name.value, parameter.type)); + instGen.generateVarLoad(mv, parameter, indexMap.addIfNotExists(parameter.name.getValue(), parameter.type)); } String methodDesc = JvmCodeGenUtil.getMethodDesc(func.type.paramTypes, retType, moduleClassName); mv.visitMethodInsn(INVOKESTATIC, splitClassName, encodedMethodName, methodDesc, false); @@ -222,7 +222,7 @@ public void genJMethodWithBObjectMethodCall(BIRFunction func, ClassWriter cw, BI String metaVarName = parameter.metaVarName; if (isValidArg(parameter) && isCompilerAddedVars(metaVarName)) { mv.visitLocalVariable(metaVarName, getJVMTypeSign(parameter.type), null, methodStartLabel, - methodEndLabel, indexMap.addIfNotExists(parameter.name.value, parameter.type)); + methodEndLabel, indexMap.addIfNotExists(parameter.name.getValue(), parameter.type)); } } JvmCodeGenUtil.visitMaxStackForMethod(mv, funcName, moduleClassName); @@ -269,7 +269,7 @@ public void genJMethodForBFunc(BIRFunction func, ClassWriter cw, BIRPackage modu indexMap.addIfNotExists(OBJECT_SELF_INSTANCE, symbolTable.anyType); } - String funcName = func.name.value; + String funcName = func.name.getValue(); BType retType = getReturnType(func); String desc; int invocationCountArgVarIndex = -1; @@ -489,7 +489,7 @@ private void genLocalVars(BIRVarToJVMIndexMap indexMap, MethodVisitor mv, List visitedScopesSet = new HashSet<>(); @@ -617,7 +617,7 @@ void generateBasicBlocks(MethodVisitor mv, LabelGenerator labelGen, JvmErrorGen for (int i = 0; i < func.basicBlocks.size(); i++) { BIRBasicBlock bb = func.basicBlocks.get(i); // create jvm label - Label bbLabel = labelGen.getLabel(funcName + bb.id.value); + Label bbLabel = labelGen.getLabel(funcName + bb.id.getValue()); mv.visitLabel(bbLabel); if (i == 0) { pushShort(mv, stateVarIndex, caseIndex); @@ -629,7 +629,7 @@ void generateBasicBlocks(MethodVisitor mv, LabelGenerator labelGen, JvmErrorGen .getLastScopeFromBBInsGen(mv, labelGen, instGen, localVarOffset, funcName, bb, visitedScopesSet, lastScope); - Label bbEndLabel = labelGen.getLabel(funcName + bb.id.value + "beforeTerm"); + Label bbEndLabel = labelGen.getLabel(funcName + bb.id.getValue() + "beforeTerm"); mv.visitLabel(bbEndLabel); String fullyQualifiedFuncName = getFullyQualifiedFuncName(func.type.tsymbol, funcName); @@ -714,7 +714,7 @@ private void processTerminator(MethodVisitor mv, BIRFunction func, BIRPackage mo } private boolean isModuleTestInitFunction(BIRFunction func) { - return func.name.value.equals( + return func.name.getValue().equals( MethodGenUtils .encodeModuleSpecialFuncName(".")); } @@ -754,7 +754,7 @@ private void generateFrameClassFieldLoad(List localVars, MethodV continue; } BType bType = JvmCodeGenUtil.getImpliedType(localVar.type); - int index = indexMap.addIfNotExists(localVar.name.value, bType); + int index = indexMap.addIfNotExists(localVar.name.getValue(), bType); mv.visitInsn(DUP); if (TypeTags.isIntegerTypeTag(bType.tag)) { @@ -893,7 +893,7 @@ private void generateFrameClassFieldUpdate(List localVars, Metho continue; } BType bType = JvmCodeGenUtil.getImpliedType(localVar.type); - int index = indexMap.addIfNotExists(localVar.name.value, bType); + int index = indexMap.addIfNotExists(localVar.name.getValue(), bType); mv.visitInsn(DUP); if (TypeTags.isIntegerTypeTag(bType.tag)) { @@ -1053,7 +1053,7 @@ private void generateGetFrame(BIRVarToJVMIndexMap indexMap, int localVarOffset, private void createLocalVariableTable(BIRFunction func, BIRVarToJVMIndexMap indexMap, int localVarOffset, MethodVisitor mv, Label methodStartLabel, LabelGenerator labelGen, Label methodEndLabel, boolean isObjectMethodSplit) { - String funcName = func.name.value; + String funcName = func.name.getValue(); // Add strand variable to LVT mv.visitLocalVariable(STRAND_LOCAL_VARIABLE_NAME, GET_STRAND, null, methodStartLabel, methodEndLabel, localVarOffset); @@ -1075,14 +1075,14 @@ private void createLocalVariableTable(BIRFunction func, BIRVarToJVMIndexMap inde startLabel = labelGen.getLabel(funcName + SCOPE_PREFIX + localVar.insScope.id()); } if (localVar.endBB != null) { - endLabel = labelGen.getLabel(funcName + localVar.endBB.id.value + "beforeTerm"); + endLabel = labelGen.getLabel(funcName + localVar.endBB.id.getValue() + "beforeTerm"); } } String metaVarName = localVar.metaVarName; if (isCompilerAddedVars(metaVarName)) { mv.visitLocalVariable(metaVarName, getJVMTypeSign(localVar.type), null, startLabel, endLabel, - indexMap.addIfNotExists(localVar.name.value, localVar.type)); + indexMap.addIfNotExists(localVar.name.getValue(), localVar.type)); } } } @@ -1090,7 +1090,7 @@ private void createLocalVariableTable(BIRFunction func, BIRVarToJVMIndexMap inde private boolean isValidArg(BIRVariableDcl localVar) { boolean localArg = localVar.kind == VarKind.LOCAL || localVar.kind == VarKind.ARG; boolean synArg = JvmCodeGenUtil.getImpliedType(localVar.type).tag == TypeTags.BOOLEAN && - localVar.name.value.startsWith("%syn"); + localVar.name.getValue().startsWith("%syn"); boolean lambdaMapArg = localVar.metaVarName != null && localVar.metaVarName.startsWith("$map$block$") && localVar.kind == VarKind.SYNTHETIC; return (localArg && !synArg) || lambdaMapArg; diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGenUtils.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGenUtils.java index fdb17dbbb156..9e5d54717c37 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGenUtils.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGenUtils.java @@ -69,7 +69,7 @@ static boolean hasInitFunction(BIRNode.BIRPackage pkg) { } static boolean isModuleInitFunction(BIRNode.BIRFunction func) { - return func.name.value.equals(encodeModuleSpecialFuncName(INIT_FUNCTION_SUFFIX)); + return func.name.getValue().equals(encodeModuleSpecialFuncName(INIT_FUNCTION_SUFFIX)); } public static void submitToScheduler(MethodVisitor mv, String strandMetadataClass, String workerName, @@ -91,14 +91,14 @@ public static String encodeModuleSpecialFuncName(String funcSuffix) { } static String calculateLambdaStopFuncName(PackageID id) { - String orgName = id.orgName.value; + String orgName = id.orgName.getValue(); String moduleName; if (id.isTestPkg) { - moduleName = id.name.value + Names.TEST_PACKAGE; + moduleName = id.name.getValue() + Names.TEST_PACKAGE; } else { - moduleName = id.name.value; + moduleName = id.name.getValue(); } - String version = getMajorVersion(id.version.value); + String version = getMajorVersion(id.version.getValue()); String funcSuffix = MethodGenUtils.STOP_FUNCTION_SUFFIX; String funcName; diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/optimizer/LargeMethodOptimizer.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/optimizer/LargeMethodOptimizer.java index 20aa3d646e15..997a1e2581a4 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/optimizer/LargeMethodOptimizer.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/optimizer/LargeMethodOptimizer.java @@ -490,7 +490,7 @@ private int getLastInsNumAndHandleTerminator(List bbs, Set possibleSplits, } currentBB.terminator = basicBlocks.get(bbNum).terminator; newBBList.add(currentBB); - changedLocalVarStartBB.put(basicBlocks.get(bbNum).id.value, currentBB.id.value); - changedLocalVarEndBB.put(basicBlocks.get(bbNum).id.value, currentBB.id.value); + changedLocalVarStartBB.put(basicBlocks.get(bbNum).id.getValue(), currentBB.id.getValue()); + changedLocalVarEndBB.put(basicBlocks.get(bbNum).id.getValue(), currentBB.id.getValue()); startInsNum = 0; bbNum += 1; continue; @@ -1398,7 +1398,7 @@ private void generateSplits(BIRFunction function, List possibleSplits, if (currentBB == null) { throw new IllegalStateException("currentBB cannot be null"); } - changedLocalVarStartBB.put(basicBlocks.get(bbNum).id.value, currentBB.id.value); + changedLocalVarStartBB.put(basicBlocks.get(bbNum).id.getValue(), currentBB.id.getValue()); if (!splitsInSameBBList.isEmpty()) { // current unfinished BB is passed to the function and a new one is returned from it currentBB = generateSplitsInSameBB(function, bbNum, splitsInSameBBList, newlyAddedFunctions, @@ -1415,7 +1415,7 @@ private void generateSplits(BIRFunction function, List possibleSplits, } currentBB.terminator = basicBlocks.get(bbNum).terminator; newBBList.add(currentBB); - changedLocalVarEndBB.put(basicBlocks.get(bbNum).id.value, currentBB.id.value); + changedLocalVarEndBB.put(basicBlocks.get(bbNum).id.getValue(), currentBB.id.getValue()); startInsNum = 0; bbNum += 1; if (splitNum < possibleSplits.size() && (possibleSplits.get(splitNum).startBBNum == bbNum)) { @@ -1468,7 +1468,7 @@ private void generateSplits(BIRFunction function, List possibleSplits, currentPackageId, newFuncName, args, splitFuncCallResultOp, parentFuncNewBB, Collections.emptyList(), Collections.emptySet(), lastInstruction.scope); newBBList.add(currentBB); - changedLocalVarEndBB.put(basicBlocks.get(bbNum).id.value, currentBB.id.value); + changedLocalVarEndBB.put(basicBlocks.get(bbNum).id.getValue(), currentBB.id.getValue()); currentBB = parentFuncNewBB; if (currSplit.returnValAssigned) { currentBB = handleNewFuncReturnVal(function, splitFuncCallResultOp, lastInstruction.scope, currentBB, @@ -1622,22 +1622,22 @@ private void setLocalVarStartEndBB(BIRFunction birFunction, List Map newBBs = new HashMap<>(); for (BIRBasicBlock newBB : newBBList) { - newBBs.put(newBB.id.value, newBB); + newBBs.put(newBB.id.getValue(), newBB); } for (BIRVariableDcl localVar : birFunction.localVars) { if (localVar.kind == VarKind.LOCAL) { if (localVar.startBB != null) { - if (changedLocalVarStartBB.containsKey(localVar.startBB.id.value)) { - localVar.startBB = newBBs.get(changedLocalVarStartBB.get(localVar.startBB.id.value)); + if (changedLocalVarStartBB.containsKey(localVar.startBB.id.getValue())) { + localVar.startBB = newBBs.get(changedLocalVarStartBB.get(localVar.startBB.id.getValue())); } else { - localVar.startBB = newBBs.get(localVar.startBB.id.value); + localVar.startBB = newBBs.get(localVar.startBB.id.getValue()); } } if (localVar.endBB != null) { - if (changedLocalVarEndBB.containsKey(localVar.endBB.id.value)) { - localVar.endBB = newBBs.get(changedLocalVarEndBB.get(localVar.endBB.id.value)); + if (changedLocalVarEndBB.containsKey(localVar.endBB.id.getValue())) { + localVar.endBB = newBBs.get(changedLocalVarEndBB.get(localVar.endBB.id.getValue())); } else { - localVar.endBB = newBBs.get(localVar.endBB.id.value); + localVar.endBB = newBBs.get(localVar.endBB.id.getValue()); } } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/split/JvmCreateTypeGen.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/split/JvmCreateTypeGen.java index dd383de6ed93..6765412801f4 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/split/JvmCreateTypeGen.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/split/JvmCreateTypeGen.java @@ -266,7 +266,7 @@ private int createTypesInstanceSplits(ClassWriter cw, List ty // Create the type for (BIRTypeDefinition optionalTypeDef : typeDefs) { - String name = optionalTypeDef.internalName.value; + String name = optionalTypeDef.internalName.getValue(); BType bType = optionalTypeDef.type; int bTypeTag = bType.tag; if (JvmCodeGenUtil.needNoTypeGeneration(bTypeTag)) { @@ -284,7 +284,7 @@ private int createTypesInstanceSplits(ClassWriter cw, List ty jvmRecordTypeGen.createRecordType(mv, (BRecordType) bType, typeOwnerClass, name); case TypeTags.OBJECT -> jvmObjectTypeGen.createObjectType(mv, (BObjectType) bType); case TypeTags.ERROR -> - jvmErrorTypeGen.createErrorType(mv, (BErrorType) bType, bType.tsymbol.name.value); + jvmErrorTypeGen.createErrorType(mv, (BErrorType) bType, bType.tsymbol.name.getValue()); case TypeTags.TUPLE -> jvmTupleTypeGen.createTupleType(mv, (BTupleType) bType); default -> jvmUnionTypeGen.createUnionType(mv, (BUnionType) bType); } @@ -318,7 +318,7 @@ private Map populateTypes(ClassWriter cw, List createLabelsForSwitch(MethodVisitor mv, int nameRegInd labels.add(i, new Label()); String name; if (decodeCase) { - name = decodeIdentifier(node.getName().value); + name = decodeIdentifier(node.getName().getValue()); } else { - name = node.getName().value; + name = node.getName().getValue(); } hashCodes[i] = name.hashCode(); i += 1; @@ -466,9 +466,9 @@ public static List