From 3b6bf30ad8576ce512441ffd4a0feb5bc25217f8 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Mon, 12 Aug 2024 13:16:09 +0530 Subject: [PATCH] Fix reading service type before modification --- .../codemodifier/contract/ContractInfoModifierTask.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java index 70a8d1106a..173e0caf83 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java @@ -62,6 +62,7 @@ import static io.ballerina.stdlib.http.compiler.Constants.COLON; import static io.ballerina.stdlib.http.compiler.Constants.HTTP; import static io.ballerina.stdlib.http.compiler.Constants.SERVICE_CONFIG_ANNOTATION; +import static io.ballerina.stdlib.http.compiler.Constants.SERVICE_TYPE; import static io.ballerina.stdlib.http.compiler.HttpServiceValidator.getServiceContractTypeDesc; /** @@ -177,7 +178,7 @@ private ServiceDeclarationNode updateServiceConfigAnnotation(TypeDescriptorNode boolean hasServiceType = fields.stream().anyMatch(field -> { if (field.kind().equals(SyntaxKind.SPECIFIC_FIELD)) { SpecificFieldNode specificField = (SpecificFieldNode) field; - return specificField.fieldName().toString().equals("serviceType"); + return specificField.fieldName().toString().trim().equals(SERVICE_TYPE); } return false; });