From 1a1fbb6a0cea0ad2356bbddab5ba3d6b0e6fa38f Mon Sep 17 00:00:00 2001 From: Mohamed Ishad Date: Mon, 9 Oct 2023 17:30:21 +0530 Subject: [PATCH 1/3] Apply code changes --- .../builder/syntaxtree/components/Expression.java | 9 +++++++++ .../syntaxtree/constants/SyntaxTreeConstants.java | 2 +- .../builder/syntaxtree/utils/MessageUtils.java | 15 +++++---------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/components/Expression.java b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/components/Expression.java index 23aab80..6e7f775 100644 --- a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/components/Expression.java +++ b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/components/Expression.java @@ -234,6 +234,15 @@ public static TypeTestExpressionNode getTypeTestExpressionNode(ExpressionNode ex ); } + public static TypeTestExpressionNode getUnaryTypeTestExpressionNode(ExpressionNode expression, + Node typeDescriptor) { + return NodeFactory.createTypeTestExpressionNode( + expression, + SyntaxTreeConstants.SYNTAX_TREE_KEYWORD_NOT_IS, + typeDescriptor + ); + } + public static CheckExpressionNode getCheckExpressionNode(ExpressionNode expression) { return NodeFactory.createCheckExpressionNode( SyntaxKind.CHECK_ACTION, diff --git a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java index 80a88a0..d477725 100644 --- a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java +++ b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java @@ -61,7 +61,6 @@ private SyntaxTreeConstants() { public static final Token SYNTAX_TREE_UNDERSCORE = AbstractNodeFactory.createIdentifierToken("_"); public static final Token SYNTAX_TREE_OPTIONAL_CHAINING = AbstractNodeFactory.createIdentifierToken("?."); public static final Token SYNTAX_TREE_AT = AbstractNodeFactory.createIdentifierToken("@"); - public static final Token SYNTAX_TREE_KEYWORD_NEW = AbstractNodeFactory.createIdentifierToken("new "); public static final Token SYNTAX_TREE_KEYWORD_IMPORT = AbstractNodeFactory.createIdentifierToken("import "); public static final Token SYNTAX_TREE_KEYWORD_CHECK = AbstractNodeFactory.createIdentifierToken("check "); @@ -74,6 +73,7 @@ private SyntaxTreeConstants() { public static final Token SYNTAX_TREE_KEYWORD_IF = AbstractNodeFactory.createIdentifierToken("if "); public static final Token SYNTAX_TREE_KEYWORD_ELSE = AbstractNodeFactory.createIdentifierToken("else "); public static final Token SYNTAX_TREE_KEYWORD_IS = AbstractNodeFactory.createIdentifierToken("is "); + public static final Token SYNTAX_TREE_KEYWORD_NOT_IS = AbstractNodeFactory.createIdentifierToken("!is"); public static final Token SYNTAX_TREE_KEYWORD_LISTENER = AbstractNodeFactory.createIdentifierToken("listener "); public static final Token SYNTAX_TREE_KEYWORD_SERVICE = AbstractNodeFactory.createIdentifierToken("service "); public static final Token SYNTAX_TREE_KEYWORD_ON = AbstractNodeFactory.createIdentifierToken("on "); diff --git a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java index 873d0e2..f2753fc 100644 --- a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java +++ b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java @@ -46,8 +46,7 @@ import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getFieldAccessExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getMethodCallExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getOptionalFieldAccessExpressionNode; -import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getTypeTestExpressionNode; -import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getUnaryExpressionNode; +import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getUnaryTypeTestExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Literal.getBooleanLiteralNode; import static io.ballerina.protoc.builder.syntaxtree.components.Literal.getNumericLiteralNode; import static io.ballerina.protoc.builder.syntaxtree.components.Statement.getCompoundAssignmentStatementNode; @@ -247,14 +246,10 @@ private static Function getValidationFunction(Message message) { function.addVariableStatement(count.getVariableDeclarationNode()); for (Field field : oneOfFieldMap.getValue()) { IfElse oneOfFieldCheck = new IfElse( - getUnaryExpressionNode( - getBracedExpressionNode( - getTypeTestExpressionNode( - getOptionalFieldAccessExpressionNode("r", field.getFieldName()), - getNilTypeDescriptorNode() - ) - ) - ) + getUnaryTypeTestExpressionNode( + getOptionalFieldAccessExpressionNode("r", field.getFieldName()), + getNilTypeDescriptorNode() + ) ); oneOfFieldCheck.addIfStatement( getCompoundAssignmentStatementNode( From 49226a88e7b1545d230351e8c63b1131af572e9f Mon Sep 17 00:00:00 2001 From: Mohamed Ishad Date: Mon, 9 Oct 2023 17:30:31 +0530 Subject: [PATCH 2/3] Fix testcases --- .../oneof_field_service_pb.bal | 38 +++++++++---------- .../helloWorldWithReservedNames_pb.bal | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal index 2b5143c..0840efb 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal @@ -166,23 +166,23 @@ public type Request1 record {| isolated function isValidRequest1(Request1 r) returns boolean { int otherCount = 0; - if !(r?.age is ()) { + if r?.age !is () { otherCount += 1; } - if !(r?.address is ()) { + if r?.address !is () { otherCount += 1; } - if !(r?.married is ()) { + if r?.married !is () { otherCount += 1; } int nameCount = 0; - if !(r?.first_name is ()) { + if r?.first_name !is () { nameCount += 1; } - if !(r?.last_name is ()) { + if r?.last_name !is () { nameCount += 1; } - if !(r?.'version is ()) { + if r?.'version !is () { nameCount += 1; } if (otherCount > 1 || nameCount > 1) { @@ -235,10 +235,10 @@ public type Address1 record {| isolated function isValidAddress1(Address1 r) returns boolean { int codeCount = 0; - if !(r?.house_number is ()) { + if r?.house_number !is () { codeCount += 1; } - if !(r?.street_number is ()) { + if r?.street_number !is () { codeCount += 1; } if (codeCount > 1) { @@ -285,37 +285,37 @@ public type ZZZ record {| isolated function isValidZzz(ZZZ r) returns boolean { int valueCount = 0; - if !(r?.one_a is ()) { + if r?.one_a !is () { valueCount += 1; } - if !(r?.one_b is ()) { + if r?.one_b !is () { valueCount += 1; } - if !(r?.one_c is ()) { + if r?.one_c !is () { valueCount += 1; } - if !(r?.one_d is ()) { + if r?.one_d !is () { valueCount += 1; } - if !(r?.one_e is ()) { + if r?.one_e !is () { valueCount += 1; } - if !(r?.one_f is ()) { + if r?.one_f !is () { valueCount += 1; } - if !(r?.one_g is ()) { + if r?.one_g !is () { valueCount += 1; } - if !(r?.one_h is ()) { + if r?.one_h !is () { valueCount += 1; } - if !(r?.one_i is ()) { + if r?.one_i !is () { valueCount += 1; } - if !(r?.one_j is ()) { + if r?.one_j !is () { valueCount += 1; } - if !(r?.one_k is ()) { + if r?.one_k !is () { valueCount += 1; } if (valueCount > 1) { diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal index 8998844..30f18bd 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal @@ -161,7 +161,7 @@ public type FieldRules record {| isolated function isValidFieldrules(FieldRules r) returns boolean { int typeCount = 0; - if !(r?.'enum is ()) { + if r?.'enum !is () { typeCount += 1; } if (typeCount > 1) { From fd3790af8561ea262cb6255b3a5b2835848be492 Mon Sep 17 00:00:00 2001 From: Mohamed Ishad Date: Mon, 16 Oct 2023 17:24:27 +0530 Subject: [PATCH 3/3] Remove wrapping braces in if conditions --- .../constants/SyntaxTreeConstants.java | 2 +- .../builder/syntaxtree/utils/MessageUtils.java | 5 +---- .../builder/syntaxtree/utils/ServerUtils.java | 17 ++++++----------- .../helloWorldNestedRepeatedMessages_pb.bal | 4 ++-- ...lloWorldNestedRepeatedMessages_pb_client.bal | 4 ++-- .../oneof_field_service_pb.bal | 6 +++--- .../tool_test_data_type_14/parent_pb.bal | 4 ++-- .../duplicate_output_type_pb.bal | 4 ++-- .../empty_message_types_pb.bal | 4 ++-- .../helloWorldWithReservedNames_pb.bal | 2 +- .../tool_test_external_imports/parent_pb.bal | 4 ++-- .../packageWithMessageImport_pb.bal | 4 ++-- .../packageWithMessageImport_pb_client.bal | 4 ++-- .../packageWithMultipleImports_pb.bal | 4 ++-- .../packageWithMultipleImports_pb_client.bal | 4 ++-- .../modules/message/messageWithService_pb.bal | 4 ++-- .../packageWithNestedSubmodules_pb.bal | 4 ++-- .../packageWithNestedSubmodules_pb_client.bal | 4 ++-- .../packageWithEnumImports_pb.bal | 4 ++-- .../packageWithEnumImports_pb_client.bal | 4 ++-- .../tool_test_server_6/helloWorldMessage_pb.bal | 8 ++++---- .../helloWorldMessage_pb_client.bal | 8 ++++---- .../helloWorldInputEmptyOutputMessage_pb.bal | 4 ++-- ...loWorldInputEmptyOutputMessage_pb_client.bal | 4 ++-- .../helloWorldTimestamp_pb.bal | 4 ++-- .../helloWorldTimestamp_pb_client.bal | 4 ++-- .../tool_test_server_9/dependingService_pb.bal | 4 ++-- .../dependingService_pb_client.bal | 4 ++-- 28 files changed, 62 insertions(+), 70 deletions(-) diff --git a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java index d477725..add0493 100644 --- a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java +++ b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/constants/SyntaxTreeConstants.java @@ -73,7 +73,7 @@ private SyntaxTreeConstants() { public static final Token SYNTAX_TREE_KEYWORD_IF = AbstractNodeFactory.createIdentifierToken("if "); public static final Token SYNTAX_TREE_KEYWORD_ELSE = AbstractNodeFactory.createIdentifierToken("else "); public static final Token SYNTAX_TREE_KEYWORD_IS = AbstractNodeFactory.createIdentifierToken("is "); - public static final Token SYNTAX_TREE_KEYWORD_NOT_IS = AbstractNodeFactory.createIdentifierToken("!is"); + public static final Token SYNTAX_TREE_KEYWORD_NOT_IS = AbstractNodeFactory.createIdentifierToken("!is "); public static final Token SYNTAX_TREE_KEYWORD_LISTENER = AbstractNodeFactory.createIdentifierToken("listener "); public static final Token SYNTAX_TREE_KEYWORD_SERVICE = AbstractNodeFactory.createIdentifierToken("service "); public static final Token SYNTAX_TREE_KEYWORD_ON = AbstractNodeFactory.createIdentifierToken("on "); diff --git a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java index f2753fc..3e20fbb 100644 --- a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java +++ b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/MessageUtils.java @@ -42,7 +42,6 @@ import static io.ballerina.protoc.GrpcConstants.ANN_DESCRIPTOR; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getBinaryExpressionNode; -import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getBracedExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getFieldAccessExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getMethodCallExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getOptionalFieldAccessExpressionNode; @@ -263,9 +262,7 @@ private static Function getValidationFunction(Message message) { } if (counts.size() > 0) { IfElse countCheck = new IfElse( - getBracedExpressionNode( - getCountCheckBinaryExpression(counts) - ) + getCountCheckBinaryExpression(counts) ); countCheck.addIfStatement( getReturnStatementNode( diff --git a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/ServerUtils.java b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/ServerUtils.java index 274232f..70ac637 100644 --- a/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/ServerUtils.java +++ b/protoc-cli/src/main/java/io/ballerina/protoc/builder/syntaxtree/utils/ServerUtils.java @@ -34,7 +34,6 @@ import static io.ballerina.protoc.builder.BallerinaFileBuilder.protofileModuleMap; import static io.ballerina.protoc.builder.balgen.BalGenConstants.COLON; import static io.ballerina.protoc.builder.balgen.BalGenConstants.PACKAGE_SEPARATOR; -import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getBracedExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getExplicitNewExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getFieldAccessExpressionNode; import static io.ballerina.protoc.builder.syntaxtree.components.Expression.getMethodCallExpressionNode; @@ -228,11 +227,9 @@ private static Function getNextFunction(Method method, String filename) { function.addVariableStatement(streamValue.getVariableDeclarationNode()); IfElse streamValueNilCheck = new IfElse( - getBracedExpressionNode( - getTypeTestExpressionNode( - getSimpleNameReferenceNode("streamValue"), - getNilTypeDescriptorNode() - ) + getTypeTestExpressionNode( + getSimpleNameReferenceNode("streamValue"), + getNilTypeDescriptorNode() ) ); streamValueNilCheck.addIfStatement( @@ -241,11 +238,9 @@ private static Function getNextFunction(Method method, String filename) { ) ); IfElse streamValueErrorCheck = new IfElse( - getBracedExpressionNode( - getTypeTestExpressionNode( - getSimpleNameReferenceNode("streamValue"), - SyntaxTreeConstants.SYNTAX_TREE_GRPC_ERROR - ) + getTypeTestExpressionNode( + getSimpleNameReferenceNode("streamValue"), + SyntaxTreeConstants.SYNTAX_TREE_GRPC_ERROR ) ); streamValueErrorCheck.addIfStatement( diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb.bal index 191c86a..e481263 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb.bal @@ -135,9 +135,9 @@ public class ResMessageStream { public isolated function next() returns record {|ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb_client.bal index bb881cb..98db4a9 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_client_9/helloWorldNestedRepeatedMessages_pb_client.bal @@ -135,9 +135,9 @@ public class ResMessageStream { public isolated function next() returns record {|ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal index 0840efb..ae6fa05 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_11/oneof_field_service_pb.bal @@ -185,7 +185,7 @@ isolated function isValidRequest1(Request1 r) returns boolean { if r?.'version !is () { nameCount += 1; } - if (otherCount > 1 || nameCount > 1) { + if otherCount > 1 || nameCount > 1 { return false; } return true; @@ -241,7 +241,7 @@ isolated function isValidAddress1(Address1 r) returns boolean { if r?.street_number !is () { codeCount += 1; } - if (codeCount > 1) { + if codeCount > 1 { return false; } return true; @@ -318,7 +318,7 @@ isolated function isValidZzz(ZZZ r) returns boolean { if r?.one_k !is () { valueCount += 1; } - if (valueCount > 1) { + if valueCount > 1 { return false; } return true; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_14/parent_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_14/parent_pb.bal index 7af2960..4d1bbab 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_14/parent_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_14/parent_pb.bal @@ -135,9 +135,9 @@ public class ParentMessageStream { public isolated function next() returns record {|ParentMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ParentMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_22/duplicate_output_type_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_22/duplicate_output_type_pb.bal index a03b638..720dd0c 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_22/duplicate_output_type_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_22/duplicate_output_type_pb.bal @@ -153,9 +153,9 @@ public class AlbumStream { public isolated function next() returns record {|Album value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|Album value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_24/empty_message_types_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_24/empty_message_types_pb.bal index a3abb3f..3af9ab4 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_24/empty_message_types_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_24/empty_message_types_pb.bal @@ -361,9 +361,9 @@ public class EmptyStream { public isolated function next() returns record {|Empty value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|Empty value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal index 30f18bd..98b35a0 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_data_type_9/helloWorldWithReservedNames_pb.bal @@ -164,7 +164,7 @@ isolated function isValidFieldrules(FieldRules r) returns boolean { if r?.'enum !is () { typeCount += 1; } - if (typeCount > 1) { + if typeCount > 1 { return false; } return true; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_external_imports/parent_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_external_imports/parent_pb.bal index 7af2960..4d1bbab 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_external_imports/parent_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_external_imports/parent_pb.bal @@ -135,9 +135,9 @@ public class ParentMessageStream { public isolated function next() returns record {|ParentMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ParentMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb.bal index 7adcd76..1ecb860 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb.bal @@ -158,9 +158,9 @@ public class ResMessageStream { public isolated function next() returns record {|message:ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|message:ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb_client.bal index c4a8ed5..12a55ef 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_2/packageWithMessageImport_pb_client.bal @@ -158,9 +158,9 @@ public class ResMessageStream { public isolated function next() returns record {|message:ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|message:ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb.bal index 07ef0b3..213e4b6 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb.bal @@ -143,9 +143,9 @@ public class ResMessage2Stream { public isolated function next() returns record {|message2:ResMessage2 value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|message2:ResMessage2 value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb_client.bal index ee9fae0..1665486 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_3/packageWithMultipleImports_pb_client.bal @@ -143,9 +143,9 @@ public class ResMessage2Stream { public isolated function next() returns record {|message2:ResMessage2 value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|message2:ResMessage2 value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_4/modules/message/messageWithService_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_4/modules/message/messageWithService_pb.bal index a54e7ed..5f290a7 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_4/modules/message/messageWithService_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_4/modules/message/messageWithService_pb.bal @@ -135,9 +135,9 @@ public class ResMessageStream { public isolated function next() returns record {|ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb.bal index ddaf8f8..b0f2706 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb.bal @@ -143,9 +143,9 @@ public class ResMessageStream { public isolated function next() returns record {|message2:ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|message2:ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb_client.bal index adb7a03..37643bb 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_5/packageWithNestedSubmodules_pb_client.bal @@ -143,9 +143,9 @@ public class ResMessageStream { public isolated function next() returns record {|message2:ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|message2:ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb.bal index bc81233..8a4405c 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb.bal @@ -137,9 +137,9 @@ public class MessageStream { public isolated function next() returns record {|Message value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|Message value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb_client.bal index 070f9c7..43df614 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_packaging_with_enum_imports/packageWithEnumImports_pb_client.bal @@ -137,9 +137,9 @@ public class MessageStream { public isolated function next() returns record {|Message value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|Message value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb.bal index d369888..92c8642 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb.bal @@ -83,9 +83,9 @@ public class HelloResponseStream { public isolated function next() returns record {|HelloResponse value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|HelloResponse value;|} nextRecord = {value: streamValue.value}; @@ -107,9 +107,9 @@ public class ByeResponseStream { public isolated function next() returns record {|ByeResponse value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ByeResponse value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb_client.bal index 0178279..12a2c26 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_6/helloWorldMessage_pb_client.bal @@ -83,9 +83,9 @@ public class HelloResponseStream { public isolated function next() returns record {|HelloResponse value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|HelloResponse value;|} nextRecord = {value: streamValue.value}; @@ -107,9 +107,9 @@ public class ByeResponseStream { public isolated function next() returns record {|ByeResponse value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ByeResponse value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb.bal index 68e7f7b..e5c213a 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb.bal @@ -42,9 +42,9 @@ public class HelloResponseStream { public isolated function next() returns record {|HelloResponse value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|HelloResponse value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb_client.bal index acc4352..ca35fca 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_7/helloWorldInputEmptyOutputMessage_pb_client.bal @@ -42,9 +42,9 @@ public class HelloResponseStream { public isolated function next() returns record {|HelloResponse value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|HelloResponse value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb.bal index 5536175..09ae619 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb.bal @@ -208,9 +208,9 @@ public class GreetingStream { public isolated function next() returns record {|Greeting value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|Greeting value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb_client.bal index 05a9c05..b6d2825 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_8/helloWorldTimestamp_pb_client.bal @@ -208,9 +208,9 @@ public class GreetingStream { public isolated function next() returns record {|Greeting value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|Greeting value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb.bal index 16dd71e..c06b541 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb.bal @@ -53,9 +53,9 @@ public class ResMessageStream { public isolated function next() returns record {|ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ResMessage value;|} nextRecord = {value: streamValue.value}; diff --git a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb_client.bal b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb_client.bal index a9efe9c..18bf6d2 100644 --- a/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb_client.bal +++ b/tooling-tests/src/test/resources/test-src/generated-sources/tool_test_server_9/dependingService_pb_client.bal @@ -53,9 +53,9 @@ public class ResMessageStream { public isolated function next() returns record {|ResMessage value;|}|grpc:Error? { var streamValue = self.anydataStream.next(); - if (streamValue is ()) { + if streamValue is () { return streamValue; - } else if (streamValue is grpc:Error) { + } else if streamValue is grpc:Error { return streamValue; } else { record {|ResMessage value;|} nextRecord = {value: streamValue.value};