From d3f9172110326e5a6d3c99d02105ce396f3991f2 Mon Sep 17 00:00:00 2001 From: Felix Schnabel Date: Sat, 13 Jul 2024 02:58:08 +0200 Subject: [PATCH 1/5] Replace Paths.get with Path.of --- .../cli/handlers/help/BbeHelpProvider.java | 4 +- .../cli/handlers/help/BbeTopicsProvider.java | 4 +- .../io/ballerina/shell/EvaluatorImpl.java | 4 +- .../ballerina/runtime/profiler/Profiler.java | 17 ++++--- .../codegen/ProfilerMethodWrapper.java | 4 +- .../runtime/profiler/ui/FileUtils.java | 3 +- .../runtime/profiler/ui/FrontEnd.java | 3 +- .../runtime/profiler/ui/HttpServer.java | 3 +- .../providers/toml/TomlConstants.java | 3 +- .../runtime/internal/launch/LaunchUtils.java | 7 ++- .../TransactionResourceManager.java | 7 ++- .../io/ballerina/runtime/test/TestUtils.java | 5 +- .../java/io/ballerina/cli/cmd/AddCommand.java | 3 +- .../io/ballerina/cli/cmd/BuildCommand.java | 3 +- .../io/ballerina/cli/cmd/CleanCommand.java | 3 +- .../io/ballerina/cli/cmd/CommandUtil.java | 9 ++-- .../java/io/ballerina/cli/cmd/DocCommand.java | 15 +++--- .../io/ballerina/cli/cmd/GraphCommand.java | 3 +- .../io/ballerina/cli/cmd/InitCommand.java | 3 +- .../java/io/ballerina/cli/cmd/NewCommand.java | 11 ++--- .../io/ballerina/cli/cmd/PackCommand.java | 3 +- .../io/ballerina/cli/cmd/ProfileCommand.java | 5 +- .../io/ballerina/cli/cmd/PushCommand.java | 3 +- .../java/io/ballerina/cli/cmd/RunCommand.java | 7 ++- .../io/ballerina/cli/cmd/TestCommand.java | 5 +- .../ballerina/cli/launcher/LauncherUtils.java | 5 +- .../cli/task/CreateExecutableTask.java | 7 ++- .../cli/task/CreateTestExecutableTask.java | 3 +- .../ballerina/cli/task/DumpBuildTimeTask.java | 5 +- .../cli/task/RunNativeImageTestTask.java | 3 +- .../ballerina/cli/task/RunProfilerTask.java | 5 +- .../io/ballerina/cli/task/RunTestsTask.java | 3 +- .../io/ballerina/cli/utils/NativeUtils.java | 3 +- .../io/ballerina/cli/utils/TestUtils.java | 11 ++--- .../io/ballerina/cli/utils/TokenUpdater.java | 4 +- .../io/ballerina/cli/cmd/BaseCommandTest.java | 5 +- .../ballerina/cli/cmd/BuildCommandTest.java | 7 ++- .../cli/cmd/BuildNativeImageCommandTest.java | 7 ++- .../ballerina/cli/cmd/CleanCommandTest.java | 5 +- .../ballerina/cli/cmd/CommandOutputUtils.java | 4 +- .../io/ballerina/cli/cmd/CommandUtilTest.java | 4 +- .../io/ballerina/cli/cmd/DocCommandTest.java | 3 +- .../ballerina/cli/cmd/GraphCommandTest.java | 7 ++- .../io/ballerina/cli/cmd/NewCommandTest.java | 25 +++++----- .../io/ballerina/cli/cmd/PackCommandTest.java | 11 ++--- .../io/ballerina/cli/cmd/PrintUtilsTest.java | 4 +- .../ballerina/cli/cmd/ProfileCommandTest.java | 7 ++- .../io/ballerina/cli/cmd/PullCommandTest.java | 13 +++-- .../io/ballerina/cli/cmd/PushCommandTest.java | 33 +++++++------ .../cli/cmd/RunBuildToolsTaskTest.java | 7 ++- .../io/ballerina/cli/cmd/RunCommandTest.java | 13 +++-- .../io/ballerina/cli/cmd/TestCommandTest.java | 7 ++- .../cli/cmd/TestNativeImageCommandTest.java | 9 ++-- .../io/ballerina/cli/cmd/ToolCommandTest.java | 5 +- .../ballerina/cli/utils/TestCentralUtils.java | 3 +- .../ballerinalang/central/client/Utils.java | 5 +- .../central/client/TestCentralApiClient.java | 5 +- .../central/client/TestUtils.java | 5 +- .../io/ballerina/projects/BalaWriter.java | 23 +++++---- .../projects/CompilerPluginManager.java | 3 +- .../ballerina/projects/JBallerinaBackend.java | 7 ++- .../projects/JBallerinaBalaWriter.java | 11 ++--- .../java/io/ballerina/projects/Package.java | 6 +-- .../projects/directory/BuildProject.java | 3 +- .../projects/internal/BalaFiles.java | 9 ++-- .../projects/internal/ManifestBuilder.java | 5 +- .../projects/internal/PackageDiagnostic.java | 7 ++- .../environment/BallerinaDistribution.java | 3 +- .../environment/BallerinaUserHome.java | 3 +- .../repositories/FileSystemRepository.java | 3 +- .../repositories/MavenPackageRepository.java | 4 +- .../io/ballerina/projects/util/FileUtils.java | 3 +- .../ballerina/projects/util/ProjectUtils.java | 11 ++--- .../fs/ClasspathPackageRepository.java | 3 +- .../fs/LocalFSPackageRepository.java | 7 +-- .../toml/model/DependencyMetadata.java | 3 +- .../compiler/FileSystemProgramDirectory.java | 3 +- .../compiler/SourceDirectoryManager.java | 3 +- .../packaging/converters/PathConverter.java | 5 +- .../packaging/converters/ZipConverter.java | 5 +- .../compiler/packaging/repo/BinaryRepo.java | 3 +- .../compiler/packaging/repo/CacheRepo.java | 3 +- .../compiler/packaging/repo/JarRepo.java | 3 +- .../compiler/packaging/repo/PathBalaRepo.java | 3 +- .../compiler/util/FileUtils.java | 3 +- .../wso2/ballerinalang/util/RepoUtils.java | 9 ++-- .../projects/BallerinaTomlTests.java | 3 +- .../projects/CyclicDependenciesTest.java | 3 +- .../projects/DependenciesTomlTests.java | 3 +- .../io/ballerina/projects/DotGraphsTests.java | 3 +- .../FileSystemRepositoryGetPackagesTests.java | 3 +- .../projects/FileSystemRepositoryTests.java | 3 +- .../FileSystemRepositoryValidationTests.java | 3 +- .../projects/MavenPackageRepositoryTests.java | 3 +- .../ballerina/projects/ProjectPathsTest.java | 7 ++- .../ballerina/projects/ProjectUtilsTests.java | 3 +- .../VersionConflictResolutionTests.java | 3 +- .../AbstractPackageResolutionTest.java | 3 +- .../packages/internal/TestCaseFilePaths.java | 17 ++++--- .../projects/utils/TestFileUtils.java | 3 +- .../toml/InvalidSettingsTomlTest.java | 3 +- .../toml/ManifestProcessorTest.java | 19 ++++---- .../toml/TomlFileToManifestTest.java | 5 +- .../compiler/BLangNodeTransformerTest.java | 7 ++- .../compiler/parser/test/ParserTestUtils.java | 3 +- .../parser/test/SyntaxTreeJSONGenerator.java | 5 +- .../compiler/parser/test/TestParser.java | 4 +- .../AbstractIncrementalParserTest.java | 5 +- .../syntax/actions/AbstractActionTest.java | 6 +-- .../declarations/AbstractDeclarationTest.java | 10 ++-- .../expressions/AbstractExpressionsTest.java | 8 ++-- .../test/syntax/misc/AbstractMiscTest.java | 5 +- .../statements/AbstractStatementTest.java | 9 ++-- .../syntax/trivia/AbstractTriviaTest.java | 7 +-- .../test/syntax/types/AbstractTypesTest.java | 13 ++--- .../test/tree/AbstractSyntaxTreeAPITest.java | 7 ++- .../test/tree/DeprecatedSyntaxAPITest.java | 5 +- .../parser/test/tree/DiagnosticsAPITest.java | 4 +- .../parser/test/tree/NodeListAPITest.java | 6 +-- .../internal/treegen/targets/Target.java | 3 +- .../codeactions/test/CodeActionUtils.java | 7 ++- .../ballerinalang/birspec/BIRTestUtils.java | 5 +- .../commons/toml/common/TomlCommonUtil.java | 3 +- .../commons/toml/util/FileUtils.java | 5 +- .../langserver/common/utils/PathUtil.java | 5 +- .../connector/BallerinaConnectorService.java | 5 +- .../example/BallerinaExampleService.java | 3 +- .../BallerinaTomlCompletionExtension.java | 3 +- .../langserver/util/TestUtil.java | 3 +- .../codeaction/AbstractCodeActionTest.java | 3 +- .../langserver/definition/DefinitionTest.java | 7 ++- .../exprscheme/TestExpressionFileScheme.java | 3 +- .../document/SyntaxTreeLocateTest.java | 3 +- .../langserver/formatting/FormattingTest.java | 5 +- .../rangeformat/RangeFormattingTest.java | 3 +- .../langserver/references/ReferenceTest.java | 3 +- .../langserver/references/ReferencesTest.java | 5 +- .../langserver/rename/RenameTestUtil.java | 5 +- .../langserver/util/FileUtils.java | 5 +- .../workspace/TestWorkspaceManager.java | 3 +- .../bindgen/command/BindgenCommand.java | 9 ++-- .../bindgen/command/BindingsGenerator.java | 25 +++++----- .../bindgen/utils/BindgenFileGenerator.java | 9 ++-- .../bindgen/utils/BindgenMvnResolver.java | 13 +++-- .../bindgen/BindgenCommandTest.java | 47 +++++++++---------- .../BindgenOptionalParamTypesTest.java | 8 +--- .../BindgenOptionalReturnTypesTest.java | 8 +--- .../bindgen/BindgenOptionalTypesTest.java | 8 +--- .../bindgen/BindgenUnitBaseTest.java | 27 +++++------ .../bindgen/FieldsTestResource.java | 9 ++-- .../bindgen/MavenSupportTest.java | 23 +++++---- .../datamapper/util/FileUtils.java | 3 +- .../datamapper/util/TestUtil.java | 3 +- .../schema/generator/ConfigSchemaGenTask.java | 3 +- .../generator/ConfigSchemaGenTaskTest.java | 5 +- .../debugadapter/DebugProjectCache.java | 3 +- .../debugadapter/runner/BPackageRunner.java | 4 +- .../runner/BSingleFileRunner.java | 3 +- .../debugadapter/utils/PackageUtils.java | 7 ++- .../utils/ProjectSourceResolver.java | 11 ++--- .../debugadapter/runtime/DebuggerRuntime.java | 3 +- .../ballerinalang/diagramutil/TestUtil.java | 5 +- .../docgen/docs/BallerinaDocGenerator.java | 5 +- .../docgen/docs/utils/BallerinaDocUtils.java | 5 +- .../docgen/docs/utils/PathToJson.java | 3 +- .../docgen/tests/GenDocsForBalaTest.java | 3 +- .../formatter/cli/FormatCmd.java | 3 +- .../formatter/cli/FormatUtil.java | 9 ++-- .../formatter/cli/FormatCmdTest.java | 5 +- .../formatter/core/FormatterUtils.java | 3 +- .../formatter/core/FormatterTest.java | 27 +++++------ .../formatter/core/ParserTestFormatter.java | 7 ++- .../formatter/core/RangeFormatterTest.java | 9 ++-- .../core/actions/CheckingActionsTest.java | 4 +- .../core/actions/FlushActionsTest.java | 4 +- .../core/actions/QueryActionsTest.java | 4 +- .../core/actions/SendReceiveActionsTest.java | 4 +- .../core/actions/StartActionsTest.java | 4 +- .../core/actions/TrapActionsTest.java | 4 +- .../core/actions/TypeCastActionsTest.java | 4 +- .../core/actions/WaitActionsTest.java | 4 +- .../LocalConfigurationTest.java | 3 +- .../RemoteConfigurationTest.java | 4 +- .../ClassDefinitionDeclarationsTest.java | 4 +- .../FunctionDefinitionDeclarationsTest.java | 4 +- .../declarations/ImportDeclarationsTest.java | 4 +- .../ModuleEnumDeclarationsTest.java | 4 +- .../ModuleTypeDefinitionDeclarationsTest.java | 4 +- .../ModuleVariableDeclarationsTest.java | 4 +- .../ServiceListenerDeclarationsTest.java | 4 +- .../expressions/AdditiveExpressionsTest.java | 4 +- .../BinaryBitwiseExpressionsTest.java | 4 +- .../ConditionalExpressionsTest.java | 4 +- .../expressions/ConstantExpressionsTest.java | 4 +- .../expressions/EqualityExpressionsTest.java | 4 +- .../core/expressions/LetExpressionsTest.java | 4 +- .../expressions/LiteralExpressionsTest.java | 4 +- .../expressions/LogicalExpressionsTest.java | 4 +- .../MultiplicativeExpressionsTest.java | 4 +- .../core/expressions/NewExpressionsTest.java | 4 +- .../ObjectConstructorExpressionsTest.java | 4 +- .../OptionalFieldAccessExpressionsTest.java | 4 +- .../expressions/QueryExpressionsTest.java | 4 +- .../expressions/RangeExpressionsTest.java | 4 +- .../RawTemplateExpressionsTest.java | 4 +- .../RelationalExpressionsTest.java | 4 +- .../expressions/ShiftExpressionsTest.java | 4 +- .../StringTemplateExpressionsTest.java | 4 +- .../expressions/TypeTestExpressionsTest.java | 4 +- .../expressions/UnaryExpressionsTest.java | 4 +- .../XMLTemplateExpressionsTest.java | 4 +- .../formatter/core/misc/BlocksTest.java | 4 +- .../formatter/core/misc/LineBreaksTest.java | 4 +- .../formatter/core/misc/LineWrappingTest.java | 4 +- .../formatter/core/misc/MetadataTest.java | 4 +- .../formatter/core/misc/RangesTest.java | 3 +- .../statements/AssignmentStatementsTest.java | 4 +- .../core/statements/BlockStatementsTest.java | 4 +- .../core/statements/BreakStatementsTest.java | 4 +- .../core/statements/CallStatementsTest.java | 4 +- .../CompoundAssignmentStatementsTest.java | 4 +- .../statements/ContinueStatementsTest.java | 4 +- .../core/statements/DoStatementsTest.java | 4 +- .../statements/ForEachStatementsTest.java | 4 +- .../core/statements/ForkStatementsTest.java | 4 +- .../core/statements/IfElseStatementsTest.java | 4 +- .../LocalTypeDefinitionStatementsTest.java | 4 +- .../core/statements/LockStatementsTest.java | 4 +- .../core/statements/MatchStatementsTest.java | 4 +- .../core/statements/PanicStatementsTest.java | 4 +- .../core/statements/ReturnStatementsTest.java | 4 +- .../core/statements/WhileStatementsTest.java | 4 +- .../XMLNSDeclarationStatementsTest.java | 4 +- .../core/types/BehaviouralTypesTest.java | 4 +- .../formatter/core/types/OtherTypesTest.java | 4 +- .../core/types/SequenceTypesTest.java | 4 +- .../formatter/core/types/SimpleTypesTest.java | 4 +- .../core/types/StructuredTypesTest.java | 4 +- .../jsonmapper/JsonToRecordMapperTests.java | 3 +- .../utils/BallerinaToDependancyToml.java | 5 +- .../stdlib/utils/BuildLangLib.java | 5 +- .../ballerina/shell/service/ShellWrapper.java | 4 +- .../test/AbstractShellServiceTest.java | 3 +- .../JsonToRecordConverterTests.java | 3 +- .../PartialParserTests.java | 3 +- .../io/ballerina/PerformanceAnalyzerTest.java | 3 +- .../maven/MavenResolverTest.java | 4 +- .../semver/checker/cmd/SemverCmd.java | 3 +- .../test/FileReaderUtils.java | 4 +- .../TesterinaCompilerPluginUtils.java | 3 +- .../testerina/natives/io/FileUtils.java | 8 ++-- .../ballerinalang/test/runtime/BTestMain.java | 9 ++-- .../test/runtime/util/CodeCoverageUtils.java | 3 +- .../toml/parser/test/ParserTestUtils.java | 3 +- .../parser/test/SyntaxTreeJSONGenerator.java | 9 ++-- .../toml/parser/test/TestTomlValidator.java | 5 +- .../parser/test/modifier/ModifierTest.java | 3 +- .../test/syntax/AbstractTomlParserTest.java | 5 +- .../validator/BoilerplateGeneratorTest.java | 9 ++-- .../test/validator/CustomErrorTest.java | 3 +- .../parser/test/validator/SchemaTest.java | 7 ++- .../test/validator/TomlValidateTest.java | 3 +- .../XMLToRecordConverterTests.java | 3 +- .../io/ballerina/projects/test/BaseTest.java | 7 ++- .../test/DependencyFilePathsTest.java | 11 ++--- .../projects/test/DependencyGraphTests.java | 5 +- .../test/HierarchicalPackageNameTests.java | 5 +- .../test/OldPackageMigrationTests.java | 3 +- .../PackageResolutionIntegrationTests.java | 9 ++-- .../projects/test/PackageResolutionTests.java | 5 +- .../PreReleaseVersionResolutionTests.java | 3 +- .../projects/test/SubsequentBuildTests.java | 3 +- .../projects/test/TestBalaProject.java | 5 +- .../projects/test/TestBalaWriter.java | 19 ++++---- .../projects/test/TestBirAndJarCache.java | 3 +- .../projects/test/TestBuildProject.java | 47 +++++++++---------- .../TestBuildProjectWithGeneratedSources.java | 3 +- .../test/TestConcurrentProjectAccess.java | 5 +- .../projects/test/TestExportModules.java | 3 +- .../projects/test/TestSingleFileProject.java | 5 +- .../ballerina/projects/test/TestTarget.java | 3 +- .../projects/test/TestUnknownTypeProject.java | 3 +- .../plugins/CompilerPluginNegativeTests.java | 3 +- .../test/plugins/CompilerPluginTests.java | 13 +++-- .../plugins/LanguageServerExtensionTests.java | 11 ++--- .../combined/CombinedCompilerPlugin.java | 4 +- .../logging/appender/FileAppenderPlugin.java | 5 +- .../org/ballerinalang/test/BCompileUtil.java | 13 +++-- .../test/context/BMainInstance.java | 18 ++++--- .../test/context/BServerInstance.java | 16 +++---- .../test/grpc/ServicePackagingTestCase.java | 7 ++- .../jvm/JarRunFunctionPositiveTestCase.java | 3 +- .../test/packaging/ConfigTestCase.java | 7 ++- .../packaging/ListDependencyTestCase.java | 3 +- .../test/packaging/ModuleBuildTestCase.java | 19 ++++---- .../packaging/PackagingNegativeTestCase.java | 5 +- .../test/packaging/PackagingTestCase.java | 11 ++--- .../test/packaging/RepoHierarchyTestCase.java | 5 +- .../packaging/SingleBalBuildTestCase.java | 3 +- ...ngleBalBuildWithSiddhiRuntimeTestCase.java | 5 +- .../run/BalxRunFunctionNegativeTestCase.java | 5 +- .../run/BalxRunFunctionPositiveTestCase.java | 5 +- .../test/utils/BallerinaTestDebugPoint.java | 5 +- .../ProcessStreamConnectionProvider.java | 5 +- .../debugger/test/BaseTestCase.java | 5 +- .../remote/BallerinaRunRemoteDebugTest.java | 4 +- .../test/async/AsyncFunctionsTest.java | 6 +-- .../test/bindgen/BindgenTestCase.java | 3 +- .../test/configurables/ConfigurableTest.java | 24 +++++----- .../streaming/TableDataStreamingTestCase.java | 8 ++-- .../TypeIdViaDifferentVersionsTest.java | 14 +++--- .../ForwardReferenceListenerVarTest.java | 4 +- .../identifier/IdentifierLiteralTest.java | 7 ++- .../IsolatedInferenceWithTestsTest.java | 8 ++-- .../test/listener/LaunchListenerTestCase.java | 9 ++-- .../test/packaging/MavenTestCase.java | 3 +- .../packaging/ModuleExecutionFlowTests.java | 35 +++++++------- .../packaging/MultipleModuleVersionTests.java | 11 +++-- .../test/profiler/ProfilerTest.java | 7 ++- ...nlyIntersectionViaMultipleModulesTest.java | 14 +++--- ...lyIntersectionViaMultipleModulesTest2.java | 14 +++--- ...lyIntersectionViaMultipleModulesTest3.java | 14 +++--- .../run/BalRunFunctionNegativeTestCase.java | 5 +- .../run/BalRunFunctionPositiveTestCase.java | 7 +-- .../test/run/BasicJavaJarRunTestCase.java | 5 +- .../test/runtime/api/RuntimeAPITest.java | 25 +++++----- .../semver/SemverValidatorNegativeTest.java | 3 +- .../test/semver/SemverValidatorTest.java | 3 +- .../test/testarina/TestarinaTestCase.java | 3 +- .../test/troubleshoot/StrandDumpTest.java | 21 ++++----- .../ballerinalang/test/util/SQLDBUtils.java | 4 +- .../java/io/ballerina/test/SemTypeTest.java | 3 +- .../ballerinalang/test/ParserTestRunner.java | 3 +- .../test/bir/BirVariableOptimizationTest.java | 3 +- .../test/bir/RecordDesugarTest.java | 3 +- .../PathConverterIntegrationTest.java | 7 ++- .../typechecker/ErrorOptimizationTest.java | 6 +-- .../test/typechecker/NilOptimizationTest.java | 6 +-- .../testerina/test/BaseTestCase.java | 7 +-- .../testerina/test/BasicCasesTest.java | 5 +- .../test/CodegenCodeCoverageTest.java | 5 +- .../testerina/test/MockTest.java | 5 +- .../test/ModuleExecutionFlowTest.java | 4 +- .../testerina/test/ModuleExecutionTest.java | 4 +- ...uleExecutionWithInitStartFailuresTest.java | 4 +- .../test/ModuleGracefulStopTest.java | 4 +- .../testerina/test/RerunFailedTest.java | 4 +- .../TestExecutionWithInitFailuresTest.java | 4 +- .../negative/InvalidDataProviderTestCase.java | 3 +- .../testerina/test/utils/AssertionUtils.java | 4 +- .../testerina/test/utils/FileUtils.java | 3 +- 351 files changed, 960 insertions(+), 1209 deletions(-) diff --git a/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeHelpProvider.java b/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeHelpProvider.java index 3128b20510da..49d7d419bf96 100644 --- a/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeHelpProvider.java +++ b/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeHelpProvider.java @@ -21,7 +21,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.Arrays; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -54,7 +54,7 @@ public String getDescription(String topic) throws HelpProviderException { private static String readFileAsString(String file) throws HelpProviderException { String content; try { - content = Files.readString(Paths.get(file)); + content = Files.readString(Path.of(file)); } catch (IOException e) { throw new HelpProviderException("Error occurred while executing the command"); } diff --git a/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeTopicsProvider.java b/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeTopicsProvider.java index 90af306ea714..a72413ff08ff 100644 --- a/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeTopicsProvider.java +++ b/ballerina-shell/modules/shell-cli/src/main/java/io/ballerina/shell/cli/handlers/help/BbeTopicsProvider.java @@ -24,7 +24,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -88,7 +88,7 @@ public List getTopicList() { private String readFileAsString(String file) { String content = null; try { - content = Files.readString(Paths.get(file)); + content = Files.readString(Path.of(file)); } catch (IOException e) { addDebugDiagnostic("Error loading the file : " + e.getMessage()); } diff --git a/ballerina-shell/modules/shell-core/src/main/java/io/ballerina/shell/EvaluatorImpl.java b/ballerina-shell/modules/shell-core/src/main/java/io/ballerina/shell/EvaluatorImpl.java index 088d2eed03bf..ec9673a2aa13 100644 --- a/ballerina-shell/modules/shell-core/src/main/java/io/ballerina/shell/EvaluatorImpl.java +++ b/ballerina-shell/modules/shell-core/src/main/java/io/ballerina/shell/EvaluatorImpl.java @@ -36,7 +36,7 @@ import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.Collection; import java.util.HashSet; import java.util.Optional; @@ -166,7 +166,7 @@ public String getBufferFileUri() throws IOException { @Override public void evaluateDeclarationFile(String filePath) throws BallerinaShellException { try { - String statements = Files.readString(Paths.get(filePath), Charset.defaultCharset()); + String statements = Files.readString(Path.of(filePath), Charset.defaultCharset()); Collection nodes = treeParser.parseDeclarations(statements); Collection snippets = snippetFactory.createSnippets(nodes); getValue(Optional.ofNullable(invoker.getCompilation(snippets))); diff --git a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/Profiler.java b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/Profiler.java index d27a2cdf794f..2f35ad7a84ec 100644 --- a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/Profiler.java +++ b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/Profiler.java @@ -35,7 +35,6 @@ import java.net.URLClassLoader; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; @@ -81,11 +80,11 @@ private void addShutdownHookAndCleanup() { try { long profilerTotalTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS) - profilerStartTime; - Files.deleteIfExists(Paths.get(Constants.TEMP_JAR_FILE_NAME)); + Files.deleteIfExists(Path.of(Constants.TEMP_JAR_FILE_NAME)); OUT_STREAM.printf("%s[6/6] Generating output...%s%n", Constants.ANSI_CYAN, Constants.ANSI_RESET); JsonParser jsonParser = new JsonParser(); HttpServer httpServer = new HttpServer(); - String cpuFilePath = Paths.get(currentDir, CPU_PRE_JSON).toString(); + String cpuFilePath = Path.of(currentDir, CPU_PRE_JSON).toString(); jsonParser.initializeCPUParser(cpuFilePath); deleteFileIfExists(cpuFilePath); OUT_STREAM.printf(" Execution time: %d seconds %n", profilerTotalTime / 1000); @@ -104,7 +103,7 @@ private void deleteFileIfExists(String filePath) { return; } try { - Files.delete(Paths.get(filePath)); + Files.delete(Path.of(filePath)); } catch (IOException e) { throw new ProfilerException("Failed to delete file: " + filePath + "%n", e); } @@ -173,7 +172,7 @@ private void addToUsedArgs(String[] args, List usedArgs, int i) { private void extractProfiler() throws ProfilerException { OUT_STREAM.printf("%s[1/6] Initializing...%s%n", Constants.ANSI_CYAN, Constants.ANSI_RESET); try { - Path profilerRuntimePath = Paths.get("io/ballerina/runtime/profiler/runtime"); + Path profilerRuntimePath = Path.of("io/ballerina/runtime/profiler/runtime"); new ProcessBuilder("jar", "xvf", "Profiler.jar", profilerRuntimePath.toString()).start().waitFor(); } catch (IOException | InterruptedException exception) { throw new ProfilerException(exception); @@ -183,8 +182,8 @@ private void extractProfiler() throws ProfilerException { private void createTempJar() { try { OUT_STREAM.printf("%s[2/6] Copying executable...%s%n", Constants.ANSI_CYAN, Constants.ANSI_RESET); - Path sourcePath = Paths.get(balJarName); - Path destinationPath = Paths.get(Constants.TEMP_JAR_FILE_NAME); + Path sourcePath = Path.of(balJarName); + Path destinationPath = Path.of(Constants.TEMP_JAR_FILE_NAME); Files.copy(sourcePath, destinationPath); } catch (IOException e) { throw new ProfilerException("Error occurred while copying the file: " + balJarName, e); @@ -241,7 +240,7 @@ private void modifyJar() throws InterruptedException, IOException { for (String instrumentedFilePath : instrumentedPaths) { FileUtils.deleteDirectory(new File(instrumentedFilePath)); } - Path filePath = Paths.get("io/ballerina/runtime/profiler/runtime"); + Path filePath = Path.of("io/ballerina/runtime/profiler/runtime"); FileUtils.deleteDirectory(new File(filePath.toString())); profilerMethodWrapper.invokeMethods(profilerDebugArg); } @@ -258,7 +257,7 @@ private void loadDirectories(List changedDirs) { } private void listAllFiles(final File userDirectory) { - String absolutePath = Paths.get(Constants.TEMP_JAR_FILE_NAME).toFile().getAbsolutePath(); + String absolutePath = Path.of(Constants.TEMP_JAR_FILE_NAME).toFile().getAbsolutePath(); analyseInstrumentedDirectories(userDirectory, absolutePath.replaceAll(Constants.TEMP_JAR_FILE_NAME, "")); } diff --git a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/codegen/ProfilerMethodWrapper.java b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/codegen/ProfilerMethodWrapper.java index ecf3e5a996a5..58b59c1b97e4 100644 --- a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/codegen/ProfilerMethodWrapper.java +++ b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/codegen/ProfilerMethodWrapper.java @@ -34,7 +34,7 @@ import java.net.URL; import java.net.URLClassLoader; import java.nio.charset.StandardCharsets; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.jar.Attributes; @@ -66,7 +66,7 @@ public void invokeMethods(String debugArg) throws IOException, InterruptedExcept if (debugArg != null) { commands.add(debugArg); } - commands.add(Paths.get(System.getProperty(USER_DIR), Constants.TEMP_JAR_FILE_NAME).toString()); + commands.add(Path.of(System.getProperty(USER_DIR), Constants.TEMP_JAR_FILE_NAME).toString()); if (balJarArgs != null) { commands.add(balJarArgs); } diff --git a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FileUtils.java b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FileUtils.java index 542a5a0090d4..8663592e4f8b 100644 --- a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FileUtils.java +++ b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FileUtils.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; public final class FileUtils { @@ -34,7 +33,7 @@ private FileUtils() { } static String readFileAsString(String file) throws IOException { - Path path = Paths.get(file); + Path path = Path.of(file); int count = 0; while (!Files.exists(path)) { if (count++ > MAX_WAIT_TIME_FOR_FILE) { diff --git a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FrontEnd.java b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FrontEnd.java index 22eb789fc411..e83b0b8b528b 100644 --- a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FrontEnd.java +++ b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/FrontEnd.java @@ -28,7 +28,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import static io.ballerina.runtime.profiler.util.Constants.BALLERINA_HOME; import static io.ballerina.runtime.profiler.util.Constants.HTML_TEMPLATE_FILE; @@ -52,7 +51,7 @@ String getSiteData(String contents) { } public String readFileAsString() throws IOException { - Path resourceFilePath = Paths.get(System.getenv(BALLERINA_HOME)).resolve("resources") + Path resourceFilePath = Path.of(System.getenv(BALLERINA_HOME)).resolve("resources") .resolve("profiler").resolve(HTML_TEMPLATE_FILE); if (!Files.exists(resourceFilePath)) { throw new ProfilerRuntimeException("resource file not found: " + HTML_TEMPLATE_FILE); diff --git a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/HttpServer.java b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/HttpServer.java index 8ea2d34844a6..1b2ab91e919c 100644 --- a/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/HttpServer.java +++ b/bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/ui/HttpServer.java @@ -29,7 +29,6 @@ import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; @@ -52,7 +51,7 @@ public void initializeHTMLExport() throws IOException { String profilerOutputDir = System.getProperty(WORKING_DIRECTORY); OUT_STREAM.printf(" Output: " + Constants.ANSI_YELLOW + "%s" + File.separator + HTML_PROFILER_REPORT + Constants.ANSI_RESET + "%n", profilerOutputDir); - Path resourcePath = Paths.get(System.getenv(BALLERINA_HOME)).resolve("resources") + Path resourcePath = Path.of(System.getenv(BALLERINA_HOME)).resolve("resources") .resolve("profiler"); try { diff --git a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/configurable/providers/toml/TomlConstants.java b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/configurable/providers/toml/TomlConstants.java index bdd8de1bdbfc..7d28f92110cd 100644 --- a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/configurable/providers/toml/TomlConstants.java +++ b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/configurable/providers/toml/TomlConstants.java @@ -21,7 +21,6 @@ import io.ballerina.runtime.internal.util.RuntimeUtils; import java.nio.file.Path; -import java.nio.file.Paths; /** * Constants used by toml parser. @@ -36,7 +35,7 @@ public final class TomlConstants { public static final String CONFIG_DATA_ENV_VARIABLE = "BAL_CONFIG_DATA"; public static final String MODULES_ROOT = "modules"; public static final String TEST_DIR_NAME = "tests"; - public static final Path DEFAULT_CONFIG_PATH = Paths.get(RuntimeUtils.USER_DIR, CONFIG_FILE_NAME); + public static final Path DEFAULT_CONFIG_PATH = Path.of(RuntimeUtils.USER_DIR, CONFIG_FILE_NAME); private TomlConstants() { } diff --git a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/launch/LaunchUtils.java b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/launch/LaunchUtils.java index da78817910b3..d7c8f54b025b 100644 --- a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/launch/LaunchUtils.java +++ b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/launch/LaunchUtils.java @@ -38,7 +38,6 @@ import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -147,7 +146,7 @@ private static String populateConfigDetails(List paths, Map paths, Map argList; public InitCommand() { - this.userDir = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); + this.userDir = Path.of(System.getProperty(ProjectConstants.USER_DIR)); this.errStream = System.err; this.exitWhenFinish = true; CommandUtil.initJarFs(); diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/NewCommand.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/NewCommand.java index 37a396eb1625..c1f77ec5ad6d 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/NewCommand.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/NewCommand.java @@ -32,7 +32,6 @@ import java.nio.file.AccessDeniedException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -112,10 +111,10 @@ public void execute() { return; } - Path packagePath = Paths.get(argList.get(0)); - Path currentDir = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); + Path packagePath = Path.of(argList.get(0)); + Path currentDir = Path.of(System.getProperty(ProjectConstants.USER_DIR)); if (!packagePath.isAbsolute()) { - packagePath = Paths.get(currentDir.toString(), packagePath.toString()).normalize(); + packagePath = Path.of(currentDir.toString(), packagePath.toString()).normalize(); } List filesInDir = new ArrayList<>(); @@ -301,8 +300,8 @@ public void execute() { } if (Files.exists(packagePath)) { // If the provided path argument is relative, print it as it is - if (!Paths.get(argList.get(0)).isAbsolute()) { - packagePath = Paths.get(argList.get(0)); + if (!Path.of(argList.get(0)).isAbsolute()) { + packagePath = Path.of(argList.get(0)); } errStream.println("Created new package '" + packageName + "' at " + packagePath + "."); } diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PackCommand.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PackCommand.java index 3de702bc97ac..0336049be75c 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PackCommand.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PackCommand.java @@ -23,7 +23,6 @@ import java.io.PrintStream; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -98,7 +97,7 @@ public class PackCommand implements BLauncherCmd { private Boolean optimizeDependencyCompilation; public PackCommand() { - this.projectPath = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); + this.projectPath = Path.of(System.getProperty(ProjectConstants.USER_DIR)); this.outStream = System.out; this.errStream = System.err; this.exitWhenFinish = true; diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/ProfileCommand.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/ProfileCommand.java index a962c6a76312..bcf270755634 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/ProfileCommand.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/ProfileCommand.java @@ -39,7 +39,6 @@ import java.io.PrintStream; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -98,7 +97,7 @@ public class ProfileCommand implements BLauncherCmd { private static final String PROFILE_CMD = "bal profile [--debug ] []\n "; public ProfileCommand() { - this.projectPath = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); + this.projectPath = Path.of(System.getProperty(ProjectConstants.USER_DIR)); this.outStream = System.err; this.errStream = System.err; } @@ -154,7 +153,7 @@ private String[] getArgumentsFromArgList() { String[] args = new String[0]; if (!argList.isEmpty()) { if (!argList.get(0).equals("--")) { // project path provided - this.projectPath = Paths.get(argList.get(0)); + this.projectPath = Path.of(argList.get(0)); if (argList.size() > 2 && argList.get(1).equals("--")) { // args to main provided args = argList.subList(2, argList.size()).toArray(new String[0]); } diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PushCommand.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PushCommand.java index e56bca657100..90ea7af412ae 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PushCommand.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PushCommand.java @@ -54,7 +54,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.Arrays; import java.util.Optional; @@ -106,7 +105,7 @@ public class PushCommand implements BLauncherCmd { private boolean exitWhenFinish; public PushCommand() { - this.userDir = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); + this.userDir = Path.of(System.getProperty(ProjectConstants.USER_DIR)); this.errStream = System.err; this.outStream = System.out; this.exitWhenFinish = true; diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/RunCommand.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/RunCommand.java index f97fd8a383bc..14010c596033 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/RunCommand.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/RunCommand.java @@ -47,7 +47,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.PathMatcher; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -143,7 +142,7 @@ public class RunCommand implements BLauncherCmd { \s"""; public RunCommand() { - this.projectPath = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); + this.projectPath = Path.of(System.getProperty(ProjectConstants.USER_DIR)); this.outStream = System.err; this.errStream = System.err; } @@ -191,7 +190,7 @@ public void execute() { String[] args = new String[0]; if (!argList.isEmpty()) { if (!argList.get(0).equals("--")) { // project path provided - this.projectPath = Paths.get(argList.get(0)); + this.projectPath = Path.of(argList.get(0)); if (RunCommand.JAR_EXTENSION_MATCHER.matches(this.projectPath)) { CommandUtil.printError(this.errStream, "unsupported option(s) provided for jar execution", runCmd, true); @@ -221,7 +220,7 @@ public void execute() { if (this.watch) { try { ProjectWatcher projectWatcher = new ProjectWatcher( - this, Paths.get(this.projectPath.toString()), outStream); + this, Path.of(this.projectPath.toString()), outStream); projectWatcher.watch(); } catch (IOException e) { throw createLauncherException("unable to watch the project:" + e.getMessage()); diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/TestCommand.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/TestCommand.java index c14799723c88..8240f19b876b 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/TestCommand.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/TestCommand.java @@ -41,7 +41,6 @@ import java.io.PrintStream; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -66,7 +65,7 @@ public class TestCommand implements BLauncherCmd { private final boolean exitWhenFinish; public TestCommand() { - this.projectPath = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); + this.projectPath = Path.of(System.getProperty(ProjectConstants.USER_DIR)); this.outStream = System.out; this.errStream = System.err; this.exitWhenFinish = true; @@ -239,7 +238,7 @@ public void execute() { String[] cliArgs = new String[0]; if (!argList.isEmpty()) { if (!argList.get(0).matches(ProjectConstants.CONFIG_ARGS_PATTERN)) { - this.projectPath = Paths.get(argList.get(0)); + this.projectPath = Path.of(argList.get(0)); if (argList.size() > 1) { cliArgs = argList.subList(1, argList.size()).toArray(new String[0]); } diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/launcher/LauncherUtils.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/launcher/LauncherUtils.java index f4b163040d58..5514f45bc55a 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/launcher/LauncherUtils.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/launcher/LauncherUtils.java @@ -33,7 +33,6 @@ import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -56,10 +55,10 @@ public static Path getSourceRootPath(String sourceRoot) { // Get source root path. Path sourceRootPath; if (sourceRoot == null || sourceRoot.isEmpty()) { - sourceRootPath = Paths.get(System.getProperty("user.dir")); + sourceRootPath = Path.of(System.getProperty("user.dir")); } else { try { - sourceRootPath = Paths.get(sourceRoot).toRealPath(LinkOption.NOFOLLOW_LINKS); + sourceRootPath = Path.of(sourceRoot).toRealPath(LinkOption.NOFOLLOW_LINKS); } catch (IOException e) { throw new RuntimeException("error reading from directory: " + sourceRoot + " reason: " + e.getMessage(), e); diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateExecutableTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateExecutableTask.java index 9ceae719f331..e803670114a9 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateExecutableTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateExecutableTask.java @@ -36,7 +36,6 @@ import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import static io.ballerina.cli.launcher.LauncherUtils.createLauncherException; import static io.ballerina.cli.utils.FileUtils.getFileNameWithoutExtension; @@ -60,7 +59,7 @@ public CreateExecutableTask(PrintStream out, String output, Target target, boole this.target = target; this.isHideTaskOutput = isHideTaskOutput; if (output != null) { - this.output = Paths.get(output); + this.output = Path.of(output); } } @@ -73,7 +72,7 @@ public void execute(Project project) { } } - this.currentDir = Paths.get(System.getProperty(USER_DIR)); + this.currentDir = Path.of(System.getProperty(USER_DIR)); if (target == null) { target = getTarget(project); } @@ -183,7 +182,7 @@ private Path getExecutablePath(Project project) { // If the --output does not have an extension, append the .jar extension if (!FileUtils.hasExtension(this.output)) { - return Paths.get(this.output.toString() + BLANG_COMPILED_JAR_EXT); + return Path.of(this.output.toString() + BLANG_COMPILED_JAR_EXT); } return this.output; diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateTestExecutableTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateTestExecutableTask.java index 03a12e07f211..64ab0d001343 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateTestExecutableTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CreateTestExecutableTask.java @@ -45,7 +45,6 @@ import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -245,7 +244,7 @@ private void perModuleFatJarGeneration(Map testSuiteMap, Targ // Filter the testDependencies from the testSuite's test dependencies Collection requiredDependencies = testSuite.getTestExecutionDependencies().stream() - .map(Paths::get).toList(); + .map(Path::of).toList(); HashSet filteredTestDependencies = new HashSet<>(); requiredDependencies.forEach(neededDependency -> { String comparingStr = MODIFIED_JAR_SUFFIX; diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/DumpBuildTimeTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/DumpBuildTimeTask.java index 8fe967b96c1f..d788d73d10d0 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/DumpBuildTimeTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/DumpBuildTimeTask.java @@ -31,7 +31,6 @@ import java.io.Writer; import java.nio.charset.StandardCharsets; import java.nio.file.Path; -import java.nio.file.Paths; import static io.ballerina.cli.launcher.LauncherUtils.createLauncherException; @@ -43,7 +42,7 @@ public class DumpBuildTimeTask implements Task { private static final String BUILD_TIME_JSON = "build-time.json"; private final transient PrintStream out; - private final Path currentDir = Paths.get(System.getProperty("user.dir")); + private final Path currentDir = Path.of(System.getProperty("user.dir")); public DumpBuildTimeTask(PrintStream out) { this.out = out; @@ -55,7 +54,7 @@ public void execute(Project project) { BuildTime.getInstance().totalDuration = System.currentTimeMillis() - BuildTime.getInstance().timestamp; BuildTime.getInstance().offline = project.buildOptions().offlineBuild(); Path buildTimeFile = getBuildTimeFilePath(project); - Path buildTimeFileRelativePath = Paths.get(System.getProperty("user.dir")).relativize(buildTimeFile); + Path buildTimeFileRelativePath = Path.of(System.getProperty("user.dir")).relativize(buildTimeFile); this.out.println("\nDumping build time information\n\t" + buildTimeFileRelativePath); persistBuildTimeToFile(buildTimeFile); } diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunNativeImageTestTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunNativeImageTestTask.java index 645b8b5b6189..d9501a3d51f0 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunNativeImageTestTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunNativeImageTestTask.java @@ -52,7 +52,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -329,7 +328,7 @@ private int runTestSuiteWithNativeImage(Package currentPackage, Target target, nativeImageCommand += File.separator + BIN_DIR_NAME + File.separator + (NativeUtils.OS.contains("win") ? "native-image.cmd" : "native-image"); - File commandExecutable = Paths.get(nativeImageCommand).toFile(); + File commandExecutable = Path.of(nativeImageCommand).toFile(); if (!commandExecutable.exists()) { throw new ProjectException("Cannot find '" + commandExecutable.getName() + "' in the GRAALVM_HOME/bin " + "directory. Install it using: gu install native-image"); diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunProfilerTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunProfilerTask.java index ad533ec2f1eb..1e41192540d3 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunProfilerTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunProfilerTask.java @@ -28,7 +28,6 @@ import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; @@ -52,14 +51,14 @@ public class RunProfilerTask implements Task { private final PrintStream err; private static final String JAVA_OPTS = "JAVA_OPTS"; private static final String CURRENT_DIR_KEY = "current.dir"; - private static final Path TARGET_OUTPUT_PATH = Paths.get(System.getProperty(USER_DIR)); + private static final Path TARGET_OUTPUT_PATH = Path.of(System.getProperty(USER_DIR)); public RunProfilerTask(PrintStream errStream) { this.err = errStream; } private void initiateProfiler(Project project) { - String profilerSource = Paths.get(System.getProperty(BALLERINA_HOME), "bre", "lib", + String profilerSource = Path.of(System.getProperty(BALLERINA_HOME), "bre", "lib", "ballerina-profiler-1.0.jar").toString(); Path sourcePath = Path.of(profilerSource); Path targetPath = getTargetProfilerPath(project); diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunTestsTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunTestsTask.java index d6f54a96534d..23a77a564242 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunTestsTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunTestsTask.java @@ -45,7 +45,6 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -336,7 +335,7 @@ public String getAgentCommand(Target target, Package currentPackage, Set private List getAllSourceFilePaths(String projectRootString) throws IOException { List sourceFilePaths = new ArrayList<>(); List paths; - try (Stream stream = Files.walk(Paths.get(projectRootString), 3)) { + try (Stream stream = Files.walk(Path.of(projectRootString), 3)) { paths = stream.toList(); } diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/NativeUtils.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/NativeUtils.java index 2a4eae1000d1..c96915ff1c5b 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/NativeUtils.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/NativeUtils.java @@ -50,7 +50,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; @@ -271,7 +270,7 @@ public static List getURLList(List jarFilePaths) { for (String jarFilePath : jarFilePaths) { try { - urlList.add(Paths.get(jarFilePath).toUri().toURL()); + urlList.add(Path.of(jarFilePath).toUri().toURL()); } catch (MalformedURLException e) { // This path cannot get executed throw new RuntimeException("Failed to create classloader with all jar files", e); diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TestUtils.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TestUtils.java index a353342ada34..08a85132a2ed 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TestUtils.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TestUtils.java @@ -59,7 +59,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -212,7 +211,7 @@ public static void generateTesterinaReports(Project project, TestReport testRepo try (Writer writer = new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8)) { writer.write(new String(content.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8)); out.println("\tView the test report at: " + - FILE_PROTOCOL + Paths.get(htmlFile.getPath()).toAbsolutePath().normalize()); + FILE_PROTOCOL + Path.of(htmlFile.getPath()).toAbsolutePath().normalize()); } } } else { @@ -231,7 +230,7 @@ public static void generateTesterinaReports(Project project, TestReport testRepo * @return path of the report tools template */ public static Path getReportToolsPath() { - return Paths.get(System.getProperty(BALLERINA_HOME)).resolve(BALLERINA_HOME_LIB). + return Path.of(System.getProperty(BALLERINA_HOME)).resolve(BALLERINA_HOME_LIB). resolve(TesterinaConstants.TOOLS_DIR_NAME).resolve(TesterinaConstants.COVERAGE_DIR). resolve(REPORT_ZIP_NAME); } @@ -337,7 +336,7 @@ public static boolean createTestSuitesForProject(Project project, Target target, * @return Path to the json file */ public static Path getJsonFilePath(Path testsCachePath) { - return Paths.get(testsCachePath.toString(), TesterinaConstants.TESTERINA_TEST_SUITE); + return Path.of(testsCachePath.toString(), TesterinaConstants.TESTERINA_TEST_SUITE); } public static String getJsonFilePathInFatJar(String separator) { @@ -347,7 +346,7 @@ public static String getJsonFilePathInFatJar(String separator) { } public static void clearFailedTestsJson(Path targetPath) { - Path rerunTestJsonPath = Paths.get(targetPath.toString(), RERUN_TEST_JSON_FILE); + Path rerunTestJsonPath = Path.of(targetPath.toString(), RERUN_TEST_JSON_FILE); if (Files.exists(rerunTestJsonPath)) { try { Files.delete(rerunTestJsonPath); @@ -369,7 +368,7 @@ public static void cleanTempCache(Project project, Path cachesRoot) { * @return jacoco agent jar path */ public static String getJacocoAgentJarPath() { - return Paths.get(System.getProperty(BALLERINA_HOME)).resolve(BALLERINA_HOME_BRE) + return Path.of(System.getProperty(BALLERINA_HOME)).resolve(BALLERINA_HOME_BRE) .resolve(BALLERINA_HOME_LIB).resolve(TesterinaConstants.AGENT_FILE_NAME).toString(); } diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TokenUpdater.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TokenUpdater.java index 1041b115f7aa..cd8455eb1c6d 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TokenUpdater.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/TokenUpdater.java @@ -30,7 +30,7 @@ import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.Collections; import static io.ballerina.cli.launcher.LauncherUtils.createLauncherException; @@ -79,7 +79,7 @@ static class TokenUpdateHandler implements HttpHandler { public void handle(HttpExchange httpExchange) { String token = getToken(httpExchange.getRequestURI().getPath()); String currentUsersHomeDir = System.getProperty("user.home"); - String settingsTomlPath = String.valueOf(Paths.get(currentUsersHomeDir, ".ballerina", SETTINGS_FILE_NAME)); + String settingsTomlPath = String.valueOf(Path.of(currentUsersHomeDir, ".ballerina", SETTINGS_FILE_NAME)); FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(settingsTomlPath); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BaseCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BaseCommandTest.java index 795ded5d5033..8f28489847f9 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BaseCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BaseCommandTest.java @@ -35,7 +35,6 @@ import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.util.stream.Stream; @@ -57,7 +56,7 @@ public abstract class BaseCommandTest { public void setup() throws IOException { System.setProperty("java.command", "java"); this.tmpDir = Files.createTempDirectory("b7a-cmd-test-" + System.nanoTime()); - this.homeCache = Paths.get("build", "userHome"); + this.homeCache = Path.of("build", "userHome"); this.console = new ByteArrayOutputStream(); this.printStream = new PrintStream(this.console); } @@ -129,7 +128,7 @@ protected void cacheBalaToCentralRepository(Path balaProjectDirectory, String or try (Stream files = Files.walk(balaProjectDirectory)) { files.forEach(a -> { - Path b = Paths.get(String.valueOf(balaDestPath), + Path b = Path.of(String.valueOf(balaDestPath), a.toString().substring(balaProjectDirectory.toString().length())); try { if (!a.toString().equals(String.valueOf(balaProjectDirectory))) { diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildCommandTest.java index d3cda0caba6f..331812a62539 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildCommandTest.java @@ -44,7 +44,6 @@ import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; @@ -68,9 +67,9 @@ */ public class BuildCommandTest extends BaseCommandTest { private Path testResources; - private static final Path testBuildDirectory = Paths.get("build").toAbsolutePath(); + private static final Path testBuildDirectory = Path.of("build").toAbsolutePath(); private static final Path testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY); - Path customUserHome = Paths.get("build", "user-home"); + Path customUserHome = Path.of("build", "user-home"); Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build(); ProjectEnvironmentBuilder projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment); @@ -82,7 +81,7 @@ public void setup() throws IOException { this.testResources = super.tmpDir.resolve("build-test-resources"); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), new BuildCommandTest.Copy(Paths.get(testResourcesURI), + Files.walkFileTree(Path.of(testResourcesURI), new BuildCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildNativeImageCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildNativeImageCommandTest.java index de34ef7c8c37..be6b31a963a6 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildNativeImageCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/BuildNativeImageCommandTest.java @@ -32,7 +32,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Objects; import static io.ballerina.projects.util.ProjectConstants.DIST_CACHE_DIRECTORY; @@ -54,14 +53,14 @@ public void setup() throws IOException { super.setup(); try { this.testResources = super.tmpDir.resolve("native-image-resources"); - Path testBuildDirectory = Paths.get("build").toAbsolutePath(); + Path testBuildDirectory = Path.of("build").toAbsolutePath(); this.testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY); - Path customUserHome = Paths.get("build", "user-home"); + Path customUserHome = Path.of("build", "user-home"); Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build(); projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), new TestCommandTest.Copy(Paths.get(testResourcesURI), + Files.walkFileTree(Path.of(testResourcesURI), new TestCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CleanCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CleanCommandTest.java index 2602697508d7..9ee1f1a9f2d9 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CleanCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CleanCommandTest.java @@ -29,7 +29,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Objects; import static io.ballerina.cli.cmd.CommandOutputUtils.getOutput; @@ -50,7 +49,7 @@ public void setup() throws IOException { this.testResources = super.tmpDir.resolve("build-test-resources"); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), new BuildCommandTest.Copy(Paths.get(testResourcesURI), + Files.walkFileTree(Path.of(testResourcesURI), new BuildCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); @@ -104,7 +103,7 @@ public void testCleanCommandInProjectWithCustomTarget() throws IOException { @Test(description = "Test clean command on a ballerina project with custom target dir.") public void testCleanCommandNonExistentTargetAndGenerated() throws IOException { Path projectPath = this.testResources.resolve("validProjectWithTargetAndGenerated"); - Path customTargetDir = Paths.get("customTargetDirNotExists"); + Path customTargetDir = Path.of("customTargetDirNotExists"); Path generatedDir = projectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT); Assert.assertTrue(Files.notExists(customTargetDir)); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandOutputUtils.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandOutputUtils.java index d6db5cd7f148..c391bc2fecea 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandOutputUtils.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandOutputUtils.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import static io.ballerina.cli.utils.OsUtils.isWindows; @@ -40,8 +39,7 @@ */ public final class CommandOutputUtils { - private static final Path commandOutputsDir = Paths - .get("src", "test", "resources", "test-resources", "command-outputs"); + private static final Path commandOutputsDir = Path.of("src/test/resources/test-resources/command-outputs"); private CommandOutputUtils() { } diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandUtilTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandUtilTest.java index e10dc6cb910a..f4be8be0fa56 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandUtilTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/CommandUtilTest.java @@ -33,7 +33,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import static io.ballerina.cli.cmd.CommandOutputUtils.readFileAsString; import static io.ballerina.cli.cmd.CommandUtil.writeBallerinaToml; @@ -48,8 +47,7 @@ */ public class CommandUtilTest { - private static final Path COMMAND_UTIL_RESOURCE_DIR = Paths - .get("src", "test", "resources", "test-resources", "command-util"); + private static final Path COMMAND_UTIL_RESOURCE_DIR = Path.of("src/test/resources/test-resources/command-util"); @Test(description = "Test write new project Ballerina.toml from template package.json") public void testWriteBallerinaToml() throws IOException { diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java index cdc7ae08ffa4..a24000b1605d 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java @@ -27,7 +27,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Objects; import static io.ballerina.cli.cmd.CommandOutputUtils.getOutput; @@ -48,7 +47,7 @@ public void setup() throws IOException { this.testResources = super.tmpDir.resolve("build-test-resources"); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), new BuildCommandTest.Copy(Paths.get(testResourcesURI), + Files.walkFileTree(Path.of(testResourcesURI), new BuildCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/GraphCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/GraphCommandTest.java index e75483758f24..1d84e44e4bc3 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/GraphCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/GraphCommandTest.java @@ -44,7 +44,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; import java.util.Objects; @@ -67,9 +66,9 @@ public class GraphCommandTest extends BaseCommandTest { @BeforeClass public void setup() throws IOException { super.setup(); - Path testBuildDirectory = Paths.get("build").toAbsolutePath(); + Path testBuildDirectory = Path.of("build").toAbsolutePath(); testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY); - Path customUserHome = Paths.get("build", "user-home"); + Path customUserHome = Path.of("build", "user-home"); Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build(); projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment); this.testResources = super.tmpDir.resolve("build-test-resources"); @@ -395,7 +394,7 @@ public void testBalGraphWithMissingTransitiveDependency() throws IOException { private void copyTestResourcesToTmpDir() throws URISyntaxException, IOException { URI testResourcesURI = Objects.requireNonNull(getClass().getClassLoader().getResource("test-resources")) .toURI(); - Path originalTestResources = Paths.get(testResourcesURI); + Path originalTestResources = Path.of(testResourcesURI); Files.walkFileTree(originalTestResources, new BuildCommandTest.Copy(originalTestResources, this.testResources)); } diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java index 4b629d382738..a25725186fb5 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java @@ -38,7 +38,6 @@ import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; @@ -73,7 +72,7 @@ public Object[][] provideInvalidProjectNames() { @BeforeClass public void setup() throws IOException { super.setup(); - testResources = Paths.get("src/test/resources/test-resources"); + testResources = Path.of("src/test/resources/test-resources"); centralCache = homeCache.resolve("repositories/central.ballerina.io").resolve("bala"); Files.createDirectories(centralCache); @@ -112,7 +111,7 @@ public void testNewCommandWithAbsolutePaths(String packagePath) throws IOExcepti Assert.assertTrue(Files.exists(packageDir)); Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.BALLERINA_TOML))); - String name = Paths.get(args[0]).getFileName().toString(); + String name = Path.of(args[0]).getFileName().toString(); String tomlContent = Files.readString( packageDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); String expectedContent = "[package]\n" + @@ -166,7 +165,7 @@ public void testNewCommandInExistingDirectory() throws IOException { Assert.assertTrue(Files.exists(packageDir)); Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.BALLERINA_TOML))); - String name = Paths.get(args[0]).getFileName().toString(); + String name = Path.of(args[0]).getFileName().toString(); String tomlContent = Files.readString( packageDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); String expectedContent = "[package]\n" + @@ -224,7 +223,7 @@ public void testNewCommandInExistingDirectoryWithExistingBalFilesForDefaultTempl Assert.assertTrue(Files.exists(packageDir)); Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.BALLERINA_TOML))); - String name = Paths.get(args[0]).getFileName().toString(); + String name = Path.of(args[0]).getFileName().toString(); String tomlContent = Files.readString( packageDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); String expectedContent = "[package]\n" + @@ -320,7 +319,7 @@ public void testNewCommandWithExistingPackageFilesDefaultTemplate() throws IOExc Assert.assertTrue(Files.exists(tempPackageDir)); Assert.assertTrue(Files.exists(tempPackageDir.resolve(ProjectConstants.BALLERINA_TOML))); - String name = Paths.get(args[0]).getFileName().toString(); + String name = Path.of(args[0]).getFileName().toString(); String tomlContent = Files.readString( tempPackageDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); String expectedContent = "[package]\n" + @@ -414,7 +413,7 @@ public void testNewCommandWithRelativePath() throws IOException { packagePath = ".\\relative_project_name"; } String[] args = {packagePath}; - Path packageDir = Paths.get(packagePath); + Path packageDir = Path.of(packagePath); NewCommand newCommand = new NewCommand(printStream, false); new CommandLine(newCommand).parseArgs(args); newCommand.execute(); @@ -423,11 +422,11 @@ public void testNewCommandWithRelativePath() throws IOException { // - Ballerina.toml // - main.bal - Path currentDir = Paths.get(System.getProperty(ProjectConstants.USER_DIR)); - Path relativeToCurrentDir = Paths.get(currentDir.toString(), packagePath).normalize(); + Path currentDir = Path.of(System.getProperty(ProjectConstants.USER_DIR)); + Path relativeToCurrentDir = Path.of(currentDir.toString(), packagePath).normalize(); Assert.assertTrue(Files.exists(relativeToCurrentDir)); Assert.assertTrue(Files.exists(relativeToCurrentDir.resolve(ProjectConstants.BALLERINA_TOML))); - String name = Paths.get(args[0]).getFileName().toString(); + String name = Path.of(args[0]).getFileName().toString(); String tomlContent = Files.readString( relativeToCurrentDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); String expectedContent = "[package]\n" + @@ -483,7 +482,7 @@ public void testNewCommandWithMain(String packagePath) throws IOException { Assert.assertTrue(Files.exists(packageDir)); Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.BALLERINA_TOML))); - String packageName = Paths.get(args[0]).getFileName().toString(); + String packageName = Path.of(args[0]).getFileName().toString(); String tomlContent = Files.readString( packageDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); String expectedContent = "[package]\n" + @@ -567,7 +566,7 @@ public void testNewCommandWithLib(String packagePath) throws IOException { String tomlContent = Files.readString( packageDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); - String packageName = Paths.get(args[0]).getFileName().toString(); + String packageName = Path.of(args[0]).getFileName().toString(); String expectedTomlContent = "[package]\n" + "org = \"" + System.getProperty("user.name").replaceAll("[^a-zA-Z0-9_]", "_") + "\"\n" + "name = \"" + packageName + "\"\n" + @@ -601,7 +600,7 @@ public void testNewCommandWithTool() throws IOException { Assert.assertTrue(Files.exists(packageDir)); Assert.assertTrue(Files.isDirectory(packageDir)); Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.BALLERINA_TOML))); - String packageName = Paths.get(args[0]).getFileName().toString(); + String packageName = Path.of(args[0]).getFileName().toString(); String tomlContent = Files.readString( packageDir.resolve(ProjectConstants.BALLERINA_TOML), StandardCharsets.UTF_8); String expectedContent = "[package]\n" + diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PackCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PackCommandTest.java index db46b804948a..f35c317e27c2 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PackCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PackCommandTest.java @@ -19,7 +19,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; import java.util.Objects; @@ -42,7 +41,7 @@ public class PackCommandTest extends BaseCommandTest { private static final String VALID_PROJECT = "validApplicationProject"; private Path testResources; - private static final Path logFile = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt") + private static final Path logFile = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt") .toAbsolutePath(); @Override @@ -53,12 +52,12 @@ public void setup() throws IOException { this.testResources = super.tmpDir.resolve("build-test-resources"); URI testResourcesURI = Objects.requireNonNull(getClass().getClassLoader().getResource("test-resources")) .toURI(); - Path testResourcesPath = Paths.get(testResourcesURI); + Path testResourcesPath = Path.of(testResourcesURI); Files.walkFileTree(testResourcesPath, new BuildCommandTest.Copy(testResourcesPath, this.testResources)); // Copy the compiler plugin jars to the test resources directory - Path compilerPluginJarsPath = Paths.get("build", "compiler-plugin-jars"); + Path compilerPluginJarsPath = Path.of("build", "compiler-plugin-jars"); Files.walkFileTree(compilerPluginJarsPath, new BuildCommandTest.Copy(compilerPluginJarsPath, this.testResources.resolve("compiler-plugin-jars"))); @@ -92,7 +91,7 @@ public void testPackProject(Boolean optimizeDependencyCompilation) throws IOExce @Test(description = "Pack a ballerina project with the engagement of all type of compiler plugins", dataProvider = "optimizeDependencyCompilation") public void testRunBalProjectWithAllCompilerPlugins(Boolean optimizeDependencyCompilation) throws IOException { - Path compilerPluginPath = Paths.get("./src/test/resources/test-resources/compiler-plugins"); + Path compilerPluginPath = Path.of("./src/test/resources/test-resources/compiler-plugins"); BCompileUtil.compileAndCacheBala(compilerPluginPath.resolve("log_creator_pkg_provided_code_analyzer_im") .toAbsolutePath().toString()); BCompileUtil.compileAndCacheBala(compilerPluginPath.resolve("log_creator_pkg_provided_code_generator_im") @@ -322,7 +321,7 @@ public void testPackEmptyProjectWithCompilerPlugin() throws IOException { @Test(description = "Pack an empty package with compiler plugin") public void testPackEmptyProjectWithBuildTools() throws IOException { - Path testDistCacheDirectory = Paths.get("build").toAbsolutePath().resolve(DIST_CACHE_DIRECTORY); + Path testDistCacheDirectory = Path.of("build").toAbsolutePath().resolve(DIST_CACHE_DIRECTORY); BCompileUtil.compileAndCacheBala(testResources.resolve("buildToolResources").resolve("tools") .resolve("ballerina-generate-file").toString(), testDistCacheDirectory); Path projectPath = this.testResources.resolve("emptyProjectWithBuildTool"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PrintUtilsTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PrintUtilsTest.java index 274c70a34496..6519bab7d161 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PrintUtilsTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PrintUtilsTest.java @@ -34,7 +34,6 @@ import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; /** @@ -46,8 +45,7 @@ public class PrintUtilsTest { private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); private static final PrintStream originalOut = System.out; private static final PrintStream errStream = System.err; - private static final Path PRINT_UTILS_OUTPUT_DIR = Paths - .get("src", "test", "resources", "test-resources", "print-utils-output"); + private static final Path PRINT_UTILS_OUTPUT_DIR = Path.of("src/test/resources/test-resources/print-utils-output"); @DataProvider(name = "searchResultsWithTerminalWidth") public Object[][] provideSearchResultsWithTerminalWidth() diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java index 950b39dd8cca..6afb8b485bf8 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java @@ -39,7 +39,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; import java.util.Objects; @@ -56,7 +55,7 @@ public class ProfileCommandTest extends BaseCommandTest { private Path testResources; - private static final Path logFile = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt") + private static final Path logFile = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt") .toAbsolutePath(); @BeforeSuite @@ -73,7 +72,7 @@ public void setup() throws IOException { this.testResources = super.tmpDir.resolve("build-test-resources"); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Path resourceURI = Paths.get(testResourcesURI); + Path resourceURI = Path.of(testResourcesURI); Files.walkFileTree(resourceURI, new BuildCommandTest.Copy(resourceURI, this.testResources)); } catch (URISyntaxException e) { @@ -160,7 +159,7 @@ public void testProfileEmptyProject() throws IOException { @Test(description = "Profile an empty package with code generator build tools") public void testProfileEmptyProjectWithBuildTools() throws IOException { - Path testDistCacheDirectory = Paths.get("build").toAbsolutePath().resolve(DIST_CACHE_DIRECTORY); + Path testDistCacheDirectory = Path.of("build").toAbsolutePath().resolve(DIST_CACHE_DIRECTORY); BCompileUtil.compileAndCacheBala(testResources.resolve("buildToolResources").resolve("tools") .resolve("ballerina-generate-file").toString()); Path projectPath = this.testResources.resolve("emptyProjectWithBuildTool"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java index c2cc362f11f8..4b5fe7384829 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java @@ -32,7 +32,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; /** * Pull command tests. @@ -149,11 +148,11 @@ public void testPullCommandWithHelp() throws IOException { @Test(description = "Pull a package from custom remote repository") public void testPullCustom() throws SettingsTomlException, IOException { - Path customrRepoPath = Paths.get("src", "test", "resources", "test-resources", "custom-repo", + Path customrRepoPath = Path.of("src", "test", "resources", "test-resources", "custom-repo", "repositories", "repo-push-pull"); - Path settingsTomlPath = Paths.get("src", "test", "resources", "test-resources", "custom-repo", + Path settingsTomlPath = Path.of("src", "test", "resources", "test-resources", "custom-repo", "Settings.toml"); - Path mockBallerinaHome = Paths.get("build").resolve("ballerina-home"); + Path mockBallerinaHome = Path.of("build").resolve("ballerina-home"); PullCommand pullCommand = new PullCommand(printStream, false); new CommandLine(pullCommand).parseArgs("luheerathan/pact1:0.1.0", "--repository=repo-push-pull"); @@ -171,11 +170,11 @@ public void testPullCustom() throws SettingsTomlException, IOException { @Test(description = "Pull a package from custom remote repository(not exist in Settings.toml)") public void testPullNonExistingCustom() throws SettingsTomlException, IOException { - Path customrRepoPath = Paths.get("src", "test", "resources", "test-resources", "custom-repo", + Path customrRepoPath = Path.of("src", "test", "resources", "test-resources", "custom-repo", "repositories", "repo-push-pull"); - Path settingsTomlPath = Paths.get("src", "test", "resources", "test-resources", "custom-repo", + Path settingsTomlPath = Path.of("src", "test", "resources", "test-resources", "custom-repo", "Settings.toml"); - Path mockBallerinaHome = Paths.get("build").resolve("ballerina-home"); + Path mockBallerinaHome = Path.of("build").resolve("ballerina-home"); PullCommand pullCommand = new PullCommand(printStream, false); new CommandLine(pullCommand).parseArgs("luheerathan/pact1:0.1.0", "--repository=repo-push-pul"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java index 52c40e13027f..2c63bb2e0438 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java @@ -44,7 +44,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Objects; import static io.ballerina.cli.cmd.CommandOutputUtils.getOutput; @@ -70,8 +69,8 @@ public void setup() throws IOException { this.testResources = super.tmpDir.resolve("build-test-resources"); URI testResourcesURI = Objects.requireNonNull(getClass().getClassLoader().getResource("test-resources")) .toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), - new BuildCommandTest.Copy(Paths.get(testResourcesURI), this.testResources)); + Files.walkFileTree(Path.of(testResourcesURI), + new BuildCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); } @@ -81,9 +80,9 @@ public void setup() throws IOException { @Override public void afterMethod() throws IOException { super.afterMethod(); - Path validBalProject = Paths.get("build").resolve("validProjectWithTarget"); + Path validBalProject = Path.of("build").resolve("validProjectWithTarget"); ProjectUtils.deleteDirectory(validBalProject); - validBalProject = Paths.get("build").resolve("tool-gayals"); + validBalProject = Path.of("build").resolve("tool-gayals"); ProjectUtils.deleteDirectory(validBalProject); } @@ -109,8 +108,8 @@ public void testPushPackageCustom() throws IOException { String expected = "Successfully pushed src/test/resources/test-resources/custom-repo/" + "luheerathan-pact1-any-0.1.0.bala to 'repo-push-pull' repository.\n"; - Path mockRepo = Paths.get("build").resolve("ballerina-home").resolve("repositories").resolve("repo-push-pull"); - Path balaPath = Paths.get("src", "test", "resources", "test-resources", "custom-repo", + Path mockRepo = Path.of("build").resolve("ballerina-home").resolve("repositories").resolve("repo-push-pull"); + Path balaPath = Path.of("src", "test", "resources", "test-resources", "custom-repo", "luheerathan-pact1-any-0.1.0.bala"); PushCommand pushCommand = new PushCommand(null, printStream, printStream, false, balaPath); String[] args = { "--repository=repo-push-pull" }; @@ -128,8 +127,8 @@ public void testPushPackageCustom() throws IOException { String pomFile = packageName + "-" + version + POM_EXTENSION; String pushPullPath = mockRepo.resolve(org).resolve(packageName).resolve(version).toAbsolutePath().toString(); for (String ext : new String[]{".sha1", ".md5", ""}) { - Assert.assertTrue(Paths.get(pushPullPath, artifact + ext).toFile().exists()); - Assert.assertTrue(Paths.get(pushPullPath, pomFile + ext).toFile().exists()); + Assert.assertTrue(Path.of(pushPullPath, artifact + ext).toFile().exists()); + Assert.assertTrue(Path.of(pushPullPath, pomFile + ext).toFile().exists()); } } @@ -138,8 +137,8 @@ public void testPushPackageNonExistingCustom() throws IOException { String expected = "ballerina: unsupported repository 'repo-push-pul' found. " + "Only 'local' repository and repositories mentioned in the Settings.toml are supported.\n"; - Path mockRepo = Paths.get("build").resolve("ballerina-home").resolve("repositories").resolve("repo-push-pull"); - Path balaPath = Paths.get("src", "test", "resources", "test-resources", "custom-repo", + Path mockRepo = Path.of("build").resolve("ballerina-home").resolve("repositories").resolve("repo-push-pull"); + Path balaPath = Path.of("src", "test", "resources", "test-resources", "custom-repo", "luheerathan-pact1-any-0.1.0.bala"); PushCommand pushCommand = new PushCommand(null, printStream, printStream, false, balaPath); String[] args = { "--repository=repo-push-pul" }; @@ -185,7 +184,7 @@ public void testPushWithInvalidFileExtension() throws IOException { @Test(description = "Push package with custom path") public void testPushWithCustomPath() throws IOException { - Path validBalProject = Paths.get("build").resolve("validProjectWithTarget"); + Path validBalProject = Path.of("build").resolve("validProjectWithTarget"); FileUtils.copyDirectory( this.testResources.resolve("validProjectWithTarget").toFile(), validBalProject.toFile()); @@ -199,7 +198,7 @@ public void testPushWithCustomPath() throws IOException { String[] args = { "--repository=local" }; new CommandLine(pushCommand).parseArgs(args); - Path mockRepo = Paths.get("build").resolve("ballerina-home"); + Path mockRepo = Path.of("build").resolve("ballerina-home"); try (MockedStatic repoUtils = Mockito.mockStatic(RepoUtils.class)) { repoUtils.when(RepoUtils::createAndGetHomeReposPath).thenReturn(mockRepo); @@ -223,7 +222,7 @@ public void testPushWithCustomPath() throws IOException { @Test(description = "Push a tool to local repository") public void testPushToolToLocal() throws IOException { - Path validBalProject = Paths.get("build").resolve("tool-gayals"); + Path validBalProject = Path.of("build").resolve("tool-gayals"); FileUtils.copyDirectory( this.testResources.resolve("tool-gayals").toFile(), validBalProject.toFile()); @@ -237,7 +236,7 @@ public void testPushToolToLocal() throws IOException { String[] args = { "--repository=local" }; new CommandLine(pushCommand).parseArgs(args); - Path mockRepo = Paths.get("build").resolve("ballerina-home"); + Path mockRepo = Path.of("build").resolve("ballerina-home"); try (MockedStatic repoUtils = Mockito.mockStatic(RepoUtils.class)) { repoUtils.when(RepoUtils::createAndGetHomeReposPath).thenReturn(mockRepo); @@ -345,13 +344,13 @@ public void testPushCommandWithHelp() throws IOException { @Test public void testPushToCustomRepo() throws IOException { - Path validBalProject = Paths.get("build").resolve("validProjectWithTarget"); + Path validBalProject = Path.of("build").resolve("validProjectWithTarget"); FileUtils.copyDirectory( this.testResources.resolve("validProjectWithTarget").toFile(), validBalProject.toFile()); FileUtils.moveDirectory( validBalProject.resolve("target-dir").toFile(), validBalProject.resolve("target").toFile()); - Path mockRepo = Paths.get("build").resolve("ballerina-home"); + Path mockRepo = Path.of("build").resolve("ballerina-home"); // Test if no arguments was passed in String[] args = { "--repository=local" }; PushCommand pushCommand = new PushCommand(validBalProject, printStream, printStream, false); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java index 65e7d15ddac8..bbcabb350e33 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java @@ -37,7 +37,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; @@ -52,14 +51,14 @@ */ public class RunBuildToolsTaskTest extends BaseCommandTest { private Path buildToolResources; - private static final Path testBuildDirectory = Paths.get("build").toAbsolutePath(); + private static final Path testBuildDirectory = Path.of("build").toAbsolutePath(); private static final Path testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY); Path mockCentralBalaDirPath = testDistCacheDirectory.resolve("bala"); private static final long TWO_DAYS = 2 * 24 * 60 * 60 * 1000; private static final long HALF_DAY = 12 * 60 * 60 * 1000; - private static final Path LOG_FILE = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt") + private static final Path LOG_FILE = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt") .toAbsolutePath(); @Override @@ -72,7 +71,7 @@ public void setup() throws IOException { try { Path testResources = super.tmpDir.resolve("build-tool-test-resources"); this.buildToolResources = testResources.resolve("buildToolResources"); - Path testResourcesPath = Paths.get( + Path testResourcesPath = Path.of( Objects.requireNonNull(getClass().getClassLoader().getResource("test-resources")).toURI()); Files.walkFileTree(testResourcesPath, new BuildCommandTest.Copy(testResourcesPath, testResources)); } catch (Exception e) { diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java index b157d0e487e4..0705df93011d 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java @@ -28,7 +28,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; import java.util.Objects; @@ -46,7 +45,7 @@ public class RunCommandTest extends BaseCommandTest { private Path testResources; private Path testDistCacheDirectory; private ProjectEnvironmentBuilder projectEnvironmentBuilder; - static Path logFile = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath(); + static Path logFile = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath(); @BeforeSuite public void setupSuite() throws IOException { @@ -60,14 +59,14 @@ public void setup() throws IOException { super.setup(); try { this.testResources = super.tmpDir.resolve("build-test-resources"); - Path testBuildDirectory = Paths.get("build").toAbsolutePath(); + Path testBuildDirectory = Path.of("build").toAbsolutePath(); this.testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY); - Path customUserHome = Paths.get("build", "user-home"); + Path customUserHome = Path.of("build", "user-home"); Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build(); this.projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), new BuildCommandTest.Copy(Paths.get(testResourcesURI), + Files.walkFileTree(Path.of(testResourcesURI), new BuildCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); @@ -299,10 +298,10 @@ public void testRunWithCustomTarget() { @Test(description = "Run a ballerina project with the engagement of all type of compiler plugins", dataProvider = "optimizeDependencyCompilation") public void testRunBalProjectWithAllCompilerPlugins(Boolean optimizeDependencyCompilation) throws IOException { - Path logFile = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath(); + Path logFile = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath(); Files.createDirectories(logFile.getParent()); Files.writeString(logFile, ""); - Path compilerPluginPath = Paths.get("./src/test/resources/test-resources").resolve("compiler-plugins"); + Path compilerPluginPath = Path.of("./src/test/resources/test-resources").resolve("compiler-plugins"); BCompileUtil.compileAndCacheBala(compilerPluginPath.resolve("log_creator_pkg_provided_code_analyzer_im"), testDistCacheDirectory, projectEnvironmentBuilder); BCompileUtil.compileAndCacheBala(compilerPluginPath.resolve("log_creator_pkg_provided_code_generator_im"), diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java index 5b8695ad3be4..c85daf5bb15d 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java @@ -49,7 +49,6 @@ import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; @@ -87,14 +86,14 @@ public void setup() throws IOException { super.setup(); try { this.testResources = super.tmpDir.resolve("test-cmd-test-resources"); - Path testBuildDirectory = Paths.get("build").toAbsolutePath(); + Path testBuildDirectory = Path.of("build").toAbsolutePath(); this.testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY); - Path customUserHome = Paths.get("build", "user-home"); + Path customUserHome = Path.of("build", "user-home"); Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build(); projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), new TestCommandTest.Copy(Paths.get(testResourcesURI), + Files.walkFileTree(Path.of(testResourcesURI), new TestCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java index 7326d1e1da28..239ace50224c 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java @@ -16,7 +16,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Objects; import static io.ballerina.projects.util.ProjectConstants.DIST_CACHE_DIRECTORY; @@ -30,7 +29,7 @@ public class TestNativeImageCommandTest extends BaseCommandTest { private Path testResources; private Path testDistCacheDirectory; ProjectEnvironmentBuilder projectEnvironmentBuilder; - private static final Path LOG_FILE = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt") + private static final Path LOG_FILE = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt") .toAbsolutePath(); @Override @@ -41,14 +40,14 @@ public void setup() throws IOException { Files.writeString(LOG_FILE, ""); try { this.testResources = super.tmpDir.resolve("test-cmd-test-resources"); - Path testBuildDirectory = Paths.get("build").toAbsolutePath(); + Path testBuildDirectory = Path.of("build").toAbsolutePath(); this.testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY); - Path customUserHome = Paths.get("build", "user-home"); + Path customUserHome = Path.of("build", "user-home"); Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build(); projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment); URI testResourcesURI = Objects.requireNonNull( getClass().getClassLoader().getResource("test-resources")).toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), new TestCommandTest.Copy(Paths.get(testResourcesURI), + Files.walkFileTree(Path.of(testResourcesURI), new TestCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ToolCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ToolCommandTest.java index 96347c2eedd8..27f96ed6274c 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ToolCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ToolCommandTest.java @@ -36,7 +36,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Objects; import java.util.Optional; @@ -59,8 +58,8 @@ public void setup() throws IOException { this.testResources = super.tmpDir.resolve("build-test-resources"); URI testResourcesURI = Objects.requireNonNull(getClass().getClassLoader().getResource("test-resources")) .toURI(); - Files.walkFileTree(Paths.get(testResourcesURI), - new BuildCommandTest.Copy(Paths.get(testResourcesURI), this.testResources)); + Files.walkFileTree(Path.of(testResourcesURI), + new BuildCommandTest.Copy(Path.of(testResourcesURI), this.testResources)); } catch (URISyntaxException e) { Assert.fail("error loading resources"); } diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/utils/TestCentralUtils.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/utils/TestCentralUtils.java index 46ca64ed95e6..e12148d23b22 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/utils/TestCentralUtils.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/utils/TestCentralUtils.java @@ -9,7 +9,6 @@ import org.wso2.ballerinalang.util.RepoUtils; import java.nio.file.Path; -import java.nio.file.Paths; import static io.ballerina.projects.util.ProjectUtils.getAccessTokenOfCLI; @@ -18,7 +17,7 @@ */ public class TestCentralUtils { - private static final Path UTILS_TEST_RESOURCES = Paths.get("src/test/resources/test-resources/central-utils"); + private static final Path UTILS_TEST_RESOURCES = Path.of("src/test/resources/test-resources/central-utils"); @Test(description = "Test get access token from Settings.toml") public void testGetAccessTokenOfCliFromSettings() throws SettingsTomlException { diff --git a/cli/central-client/src/main/java/org/ballerinalang/central/client/Utils.java b/cli/central-client/src/main/java/org/ballerinalang/central/client/Utils.java index 15a2ebbfb4a4..f744b86ad5ec 100644 --- a/cli/central-client/src/main/java/org/ballerinalang/central/client/Utils.java +++ b/cli/central-client/src/main/java/org/ballerinalang/central/client/Utils.java @@ -52,7 +52,6 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.security.DigestInputStream; import java.security.MessageDigest; @@ -316,7 +315,7 @@ private static void handleNightlyBuild(boolean isNightlyBuild, Path balaCacheWit LogFormatter logFormatter) throws CentralClientException { if (isNightlyBuild) { // If its a nightly build tag the file as a module from nightly - Path nightlyBuildMetaFile = Paths.get(balaCacheWithPkgPath.toString(), "nightly.build"); + Path nightlyBuildMetaFile = Path.of(balaCacheWithPkgPath.toString(), "nightly.build"); if (!nightlyBuildMetaFile.toFile().exists()) { createMetaFile(nightlyBuildMetaFile, logFormatter, "error occurred while creating nightly.build file."); } @@ -334,7 +333,7 @@ private static void handlePackageDeprecation(String deprecateMsg, Path balaCache LogFormatter logFormatter) throws CentralClientException { if (deprecateMsg != null) { // If its a deprecated package tag a file to denote as deprecated - Path deprecateMsgFile = Paths.get(balaCacheWithPkgPath.toString(), DEPRECATED_META_FILE_NAME); + Path deprecateMsgFile = Path.of(balaCacheWithPkgPath.toString(), DEPRECATED_META_FILE_NAME); if (!deprecateMsgFile.toFile().exists()) { createMetaFile(deprecateMsgFile, logFormatter, "error occurred while creating the file '" + DEPRECATED_META_FILE_NAME + "'"); diff --git a/cli/central-client/src/test/java/org/ballerinalang/central/client/TestCentralApiClient.java b/cli/central-client/src/test/java/org/ballerinalang/central/client/TestCentralApiClient.java index b186ab9bde36..3450d1f985f4 100644 --- a/cli/central-client/src/test/java/org/ballerinalang/central/client/TestCentralApiClient.java +++ b/cli/central-client/src/test/java/org/ballerinalang/central/client/TestCentralApiClient.java @@ -57,7 +57,6 @@ import java.net.HttpURLConnection; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; import static java.util.concurrent.TimeUnit.SECONDS; @@ -86,7 +85,7 @@ public class TestCentralApiClient extends CentralAPIClient { private ByteArrayOutputStream console; public static final String ERROR_CONNECTION_RESET = "error: Connection reset"; - private static final Path UTILS_TEST_RESOURCES = Paths.get("src/test/resources/test-resources/utils"); + private static final Path UTILS_TEST_RESOURCES = Path.of("src/test/resources/test-resources/utils"); private static final Path TMP_DIR = UTILS_TEST_RESOURCES.resolve("temp-test-central-api-client"); private static final String TEST_BAL_VERSION = "slp5"; private static final String ANY_PLATFORM = "any"; @@ -650,7 +649,7 @@ public void testSearchPackageWithBadRequest() throws IOException, CentralClientE private void setBallerinaHome() { final String ballerinaInstallDirProp = "ballerina.home"; if (System.getProperty(ballerinaInstallDirProp) == null) { - System.setProperty(ballerinaInstallDirProp, String.valueOf(Paths.get("build"))); + System.setProperty(ballerinaInstallDirProp, String.valueOf(Path.of("build"))); } } diff --git a/cli/central-client/src/test/java/org/ballerinalang/central/client/TestUtils.java b/cli/central-client/src/test/java/org/ballerinalang/central/client/TestUtils.java index 7e66fdef72af..2b74d4f81435 100644 --- a/cli/central-client/src/test/java/org/ballerinalang/central/client/TestUtils.java +++ b/cli/central-client/src/test/java/org/ballerinalang/central/client/TestUtils.java @@ -34,7 +34,6 @@ import java.net.HttpURLConnection; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -58,8 +57,8 @@ */ public class TestUtils { - private static final Path UTILS_TEST_RESOURCES = Paths.get("src/test/resources/test-resources/utils"); - private final Path tempBalaCache = Paths.get("build").resolve("temp-test-utils-bala-cache"); + private static final Path UTILS_TEST_RESOURCES = Path.of("src/test/resources/test-resources/utils"); + private final Path tempBalaCache = Path.of("build").resolve("temp-test-utils-bala-cache"); @BeforeClass public void setUp() throws IOException { diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BalaWriter.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BalaWriter.java index 960615af9fec..0d5e8ca23d67 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BalaWriter.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BalaWriter.java @@ -49,7 +49,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -147,7 +146,7 @@ private void addBalaJson(ZipOutputStream balaOutputStream) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); String balaJson = gson.toJson(new BalaJson()); try { - putZipEntry(balaOutputStream, Paths.get(BALA_JSON), + putZipEntry(balaOutputStream, Path.of(BALA_JSON), new ByteArrayInputStream(balaJson.getBytes(Charset.defaultCharset()))); } catch (IOException e) { throw new ProjectException("Failed to write 'bala.json' file: " + e.getMessage(), e); @@ -189,7 +188,7 @@ private void addPackageJson(ZipOutputStream balaOutputStream, Optional entry : cachedResources.entrySet()) { - putZipEntry(balaOutputStream, Paths.get(entry.getKey()), new ByteArrayInputStream(entry.getValue())); + putZipEntry(balaOutputStream, Path.of(entry.getKey()), new ByteArrayInputStream(entry.getValue())); } } } @@ -412,7 +411,7 @@ private void addDependenciesJson(ZipOutputStream balaOutputStream) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); try { - putZipEntry(balaOutputStream, Paths.get(DEPENDENCY_GRAPH_JSON), + putZipEntry(balaOutputStream, Path.of(DEPENDENCY_GRAPH_JSON), new ByteArrayInputStream(gson.toJson(depGraphJson).getBytes(Charset.defaultCharset()))); } catch (IOException e) { throw new ProjectException("Failed to write '" + DEPENDENCY_GRAPH_JSON + "' file: " + e.getMessage(), e); @@ -427,7 +426,7 @@ private Path updateModuleDirectoryToMatchNamingInBala(Path relativePath) { String packageName = this.packageContext.packageName().toString(); Path modulePath = moduleRootPath.resolve(moduleRootPath.relativize(relativePath).subpath(0, 1)); Path pathInsideModule = modulePath.relativize(relativePath); - String moduleName = Optional.ofNullable(modulePath.getFileName()).orElse(Paths.get("")).toString(); + String moduleName = Optional.ofNullable(modulePath.getFileName()).orElse(Path.of("")).toString(); String updatedModuleName = packageName + ProjectConstants.DOT + moduleName; Path updatedModulePath = moduleRootPath.resolve(updatedModuleName); return updatedModulePath.resolve(pathInsideModule); @@ -495,7 +494,7 @@ private ModuleDependency createModuleDependencyEntry(Package pkg, } private Path getIconPath(String icon) { - Path iconPath = Paths.get(icon); + Path iconPath = Path.of(icon); if (!iconPath.isAbsolute()) { iconPath = this.packageContext.project().sourceRoot().resolve(iconPath); } @@ -522,7 +521,7 @@ protected void putDirectoryToZipFile(Path sourceDir, Path pathInZipFile, ZipOutp putDirectoryToZipFile(sourceDir.resolve(file.getName()), pathInZipFile, out); } else { Path fileNameInBala = - pathInZipFile.resolve(sourceDir.relativize(Paths.get(file.getPath()))); + pathInZipFile.resolve(sourceDir.relativize(Path.of(file.getPath()))); putZipEntry(out, fileNameInBala, new FileInputStream(sourceDir + File.separator + file.getName())); } @@ -547,7 +546,7 @@ private String convertPathSeperator(Path file) { if (File.separatorChar == '\\') { String replaced; // Following is to evade spotbug issue if file is null - replaced = Optional.ofNullable(file.getFileName()).orElse(Paths.get("")).toString(); + replaced = Optional.ofNullable(file.getFileName()).orElse(Path.of("")).toString(); Path parent = file.getParent(); while (parent != null) { replaced = parent.getFileName() + UNIX_FILE_SEPARATOR + replaced; diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/CompilerPluginManager.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/CompilerPluginManager.java index 9e4145a098f7..25b64409b3ce 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/CompilerPluginManager.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/CompilerPluginManager.java @@ -22,7 +22,6 @@ import io.ballerina.projects.plugins.CompilerPlugin; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -169,7 +168,7 @@ private static CompilerPluginInfo loadCompilerPlugin(CompilerPluginDescriptor pl String pluginClassName = pluginDescriptor.plugin().getClassName(); List jarLibraryPaths = pluginDescriptor.getCompilerPluginDependencies() .stream() - .map(Paths::get) + .map(Path::of) .toList(); CompilerPlugin compilerPlugin; diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java index 6ecd546befeb..7a596d9e4db0 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java @@ -55,7 +55,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -317,7 +316,7 @@ private List getPlatformLibraries(PackageId packageId) { if (Objects.equals(dependencyScope, PlatformLibraryScope.PROVIDED) && !Objects.equals(packageId, this.packageContext().packageId())) { dependencyFilePath = getPlatformLibPathFromProvided(platform, groupId, artifactId, version); - Path jarPath = Paths.get(dependencyFilePath); + Path jarPath = Path.of(dependencyFilePath); if (!jarPath.isAbsolute()) { jarPath = this.packageContext().project().sourceRoot().resolve(jarPath); } @@ -328,7 +327,7 @@ private List getPlatformLibraries(PackageId packageId) { dependency.put(JarLibrary.KEY_PATH, dependencyFilePath); } // If the path is relative we will convert to absolute relative to Ballerina.toml file - Path jarPath = Paths.get(dependencyFilePath); + Path jarPath = Path.of(dependencyFilePath); if (!jarPath.isAbsolute()) { jarPath = pkg.project().sourceRoot().resolve(jarPath); } @@ -699,7 +698,7 @@ private Path emitGraalExecutable(Path executableFilePath, List emitR nativeImageCommand += File.separator + BIN_DIR_NAME + File.separator + (OS.contains("win") ? "native-image.cmd" : "native-image"); - File commandExecutable = Paths.get(nativeImageCommand).toFile(); + File commandExecutable = Path.of(nativeImageCommand).toFile(); if (!commandExecutable.exists()) { throw new ProjectException("cannot find '" + commandExecutable.getName() + "' in the GRAALVM_HOME/bin " + "directory. Install it using: gu install native-image"); 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 25aeaefb1914..7ff7cea5dcf0 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 @@ -35,7 +35,6 @@ import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -97,7 +96,7 @@ protected Optional addPlatformLibs(ZipOutputStream balaOutputStream) // null check is added for spot bug with the toml validation filename cannot be null String fileName = Optional.ofNullable(libPath.getFileName()) .map(Path::toString).orElse(ANNON); - Path entryPath = Paths.get(PLATFORM) + Path entryPath = Path.of(PLATFORM) .resolve(target) .resolve(fileName); // create a zip entry for each file @@ -159,7 +158,7 @@ protected void addCompilerPlugin(ZipOutputStream balaOutputStream) throws IOExce // null check is added for spot bug with the toml validation filename cannot be null String fileName = Optional.ofNullable(libPath.getFileName()) .map(Path::toString).orElse(ANNON); - Path entryPath = Paths.get("compiler-plugin").resolve("libs").resolve(fileName); + Path entryPath = Path.of("compiler-plugin").resolve("libs").resolve(fileName); // create a zip entry for each file putZipEntry(balaOutputStream, entryPath, new FileInputStream(libPath.toString())); compilerPluginLibPaths.add(entryPath.toString()); @@ -176,7 +175,7 @@ protected void addCompilerPlugin(ZipOutputStream balaOutputStream) throws IOExce .registerTypeHierarchyAdapter(String.class, new JsonStringsAdaptor()).setPrettyPrinting().create(); try { - putZipEntry(balaOutputStream, Paths.get(COMPILER_PLUGIN, COMPILER_PLUGIN_JSON), + putZipEntry(balaOutputStream, Path.of(COMPILER_PLUGIN, COMPILER_PLUGIN_JSON), new ByteArrayInputStream( gson.toJson(compilerPluginJson).getBytes(Charset.defaultCharset()))); } catch (IOException e) { @@ -209,7 +208,7 @@ protected void addBalTool(ZipOutputStream balaOutputStream) throws IOException { // null check is added for spot bug with the toml validation filename cannot be null String fileName = Optional.ofNullable(libPath.getFileName()) .map(Path::toString).orElse(ANNON); - Path entryPath = Paths.get(TOOL).resolve(LIBS).resolve(fileName); + Path entryPath = Path.of(TOOL).resolve(LIBS).resolve(fileName); // create a zip entry for each file putZipEntry(balaOutputStream, entryPath, new FileInputStream(libPath.toString())); balToolLibPaths.add(entryPath.toString()); @@ -222,7 +221,7 @@ protected void addBalTool(ZipOutputStream balaOutputStream) throws IOException { .registerTypeHierarchyAdapter(String.class, new JsonStringsAdaptor()).setPrettyPrinting().create(); try { - putZipEntry(balaOutputStream, Paths.get(TOOL, BAL_TOOL_JSON), + putZipEntry(balaOutputStream, Path.of(TOOL, BAL_TOOL_JSON), new ByteArrayInputStream( gson.toJson(balToolJson).getBytes(Charset.defaultCharset()))); } catch (IOException e) { diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Package.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Package.java index c92df7c1fcf4..28f7ba13fcd6 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Package.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Package.java @@ -264,7 +264,7 @@ Package duplicate(Project project) { * in form of a {@code DiagnosticResult} instance. *

* Here is a sample usage of this API:

-     *   Project project = BuildProject.load(Paths.get(...));
+     *   Project project = BuildProject.load(Path.of(...));
      *   Package currentPackage = project.currentPackage();
      *   DiagnosticResult diagnosticsResult = currentPackage.runCodeGenAndModifyPlugins();
      *
@@ -320,7 +320,7 @@ public DiagnosticResult runCodeGenAndModifyPlugins() {
      * reported by the code generator tasks in form of a {@code CodeGeneratorResult} instance.
      * 

* Here is a sample usage of this API:

-     *   Project project = BuildProject.load(Paths.get(...));
+     *   Project project = BuildProject.load(Path.of(...));
      *   Package currentPackage = project.currentPackage();
      *   Package packageWithGenFiles = currentPackage.runCodeGeneratorPlugins();
      *
@@ -362,7 +362,7 @@ public CodeGeneratorResult runCodeGeneratorPlugins() {
      * reported by the code modifier tasks in form of a {@code CodeModifierResult} instance.
      * 

* Here is a sample usage of this API:

-     *   Project project = BuildProject.load(Paths.get(...));
+     *   Project project = BuildProject.load(Path.of(...));
      *   Package currentPackage = project.currentPackage();
      *   Package packageWithGenFiles = currentPackage.runCodeModifierPlugins();
      *
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/directory/BuildProject.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/directory/BuildProject.java
index 371dbcfcc5eb..79b3a743830c 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/directory/BuildProject.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/directory/BuildProject.java
@@ -51,7 +51,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -523,7 +522,7 @@ public Path targetDir() {
         if (this.buildOptions().getTargetPath() == null) {
             return this.sourceRoot.resolve(ProjectConstants.TARGET_DIR_NAME);
         } else {
-            return Paths.get(this.buildOptions().getTargetPath());
+            return Path.of(this.buildOptions().getTargetPath());
         }
     }
 
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/BalaFiles.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/BalaFiles.java
index c9f6349e9ef9..466ba29d1736 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/BalaFiles.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/BalaFiles.java
@@ -50,7 +50,6 @@
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -398,9 +397,9 @@ private static void extractCompilerPluginLibraries(CompilerPluginJson compilerPl
                 try {
                     Files.createDirectories(libPath.getParent());
                     // TODO: Need to refactor this fix
-                    Path libPathInZip = Paths.get(dependencyPath);
+                    Path libPathInZip = Path.of(dependencyPath);
                     if (!dependencyPath.contains(COMPILER_PLUGIN_DIR)) {
-                        libPathInZip = Paths.get(COMPILER_PLUGIN_DIR, String.valueOf(libPathInZip));
+                        libPathInZip = Path.of(COMPILER_PLUGIN_DIR, String.valueOf(libPathInZip));
                     }
                     Files.copy(zipFileSystem.getPath(String.valueOf(libPathInZip)), libPath);
                 } catch (IOException e) {
@@ -424,9 +423,9 @@ private static void extractBalToolLibraries(Optional balToolJson, P
             if (!Files.exists(libPath)) {
                 try {
                     Files.createDirectories(libPath.getParent());
-                    Path libPathInZip = Paths.get(dependencyPath);
+                    Path libPathInZip = Path.of(dependencyPath);
                     if (!dependencyPath.contains(TOOL_DIR)) {
-                        libPathInZip = Paths.get(TOOL_DIR, String.valueOf(libPathInZip));
+                        libPathInZip = Path.of(TOOL_DIR, String.valueOf(libPathInZip));
                     }
                     Files.copy(zipFileSystem.getPath(String.valueOf(libPathInZip)), libPath);
                 } catch (IOException e) {
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/ManifestBuilder.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/ManifestBuilder.java
index 0eb8542d253c..368c9ed635b6 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/ManifestBuilder.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/ManifestBuilder.java
@@ -56,7 +56,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -421,7 +420,7 @@ private PackageDescriptor getPackageDescriptor(TomlTableNode tomlTableNode) {
 
     private void validateIconPathForPng(String icon, TomlTableNode pkgNode) {
         if (icon != null && hasPngExtension(icon)) {
-            Path iconPath = Paths.get(icon);
+            Path iconPath = Path.of(icon);
             if (!iconPath.isAbsolute()) {
                 iconPath = this.projectPath.resolve(iconPath);
             }
@@ -553,7 +552,7 @@ private PackageManifest.Platform getDependencyPlatform(TopLevelNode dependencyNo
                         Map platformEntryMap = new HashMap<>();
                         String pathValue = getStringValueFromPlatformEntry(platformEntryTable, PATH);
                         if (pathValue != null) {
-                            Path path = Paths.get(pathValue);
+                            Path path = Path.of(pathValue);
                             if (!path.isAbsolute()) {
                                 path = this.projectPath.resolve(path);
                             }
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/PackageDiagnostic.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/PackageDiagnostic.java
index ec1502a9bb37..a28fac53fd67 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/PackageDiagnostic.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/PackageDiagnostic.java
@@ -34,7 +34,6 @@
 import java.io.File;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 import java.util.Optional;
 
@@ -65,13 +64,13 @@ public PackageDiagnostic(Diagnostic diagnostic, ModuleDescriptor moduleDescripto
         String filePath;
         ModuleName moduleName = moduleDescriptor.name();
         String diagnosticPath = diagnostic.location().lineRange().filePath();
-        Path modulesRoot = Paths.get(ProjectConstants.MODULES_ROOT);
+        Path modulesRoot = Path.of(ProjectConstants.MODULES_ROOT);
         if (project.kind().equals(ProjectKind.BALA_PROJECT)) {
             Path modulePath = modulesRoot.resolve(moduleName.toString());
             filePath = project.sourceRoot().resolve(modulePath).resolve(
                     diagnosticPath).toString();
         } else {
-            Path generatedRoot = Paths.get(ProjectConstants.GENERATED_MODULES_ROOT);
+            Path generatedRoot = Path.of(ProjectConstants.GENERATED_MODULES_ROOT);
             if (!moduleName.isDefaultModuleName()) {
                 Path generatedPath = generatedRoot.
                         resolve(moduleName.moduleNamePart());
@@ -122,7 +121,7 @@ public String toString() {
         if (this.project != null && ProjectKind.BALA_PROJECT.equals(this.project.kind())) {
             filePath = moduleDescriptor.org() + "/" +
                     moduleDescriptor.name().toString() + "/" +
-                    moduleDescriptor.version() + "::" + Optional.of(Paths.get(filePath).getFileName()).get();
+                    moduleDescriptor.version() + "::" + Optional.of(Path.of(filePath).getFileName()).get();
         }
         // Handle null location based diagnostics
         if (this.diagnostic.location() instanceof NullLocation) {
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaDistribution.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaDistribution.java
index 25e84ec84e9c..7da5c7c53e65 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaDistribution.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaDistribution.java
@@ -26,7 +26,6 @@
 
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Represents the Ballerina distribution and responsible for initializing the {@code CompilerContext}, distribution
@@ -51,7 +50,7 @@ public static BallerinaDistribution from(Environment environment) {
         if (ballerinaHome == null) {
             throw new IllegalStateException("ballerina.home property is not set");
         }
-        return from(environment, Paths.get(ballerinaHome));
+        return from(environment, Path.of(ballerinaHome));
     }
 
     public static BallerinaDistribution from(Environment environment, Path ballerinaHomeDirPath) {
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaUserHome.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaUserHome.java
index 904b0392b524..c2d2432b6c1e 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaUserHome.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/environment/BallerinaUserHome.java
@@ -17,7 +17,6 @@
 import java.nio.file.AccessDeniedException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -86,7 +85,7 @@ public static BallerinaUserHome from(Environment environment) {
             throw new ProjectException("unable to get user home directory");
         }
 
-        Path homeRepoPath = Paths.get(userHomeDir, ProjectConstants.HOME_REPO_DEFAULT_DIRNAME);
+        Path homeRepoPath = Path.of(userHomeDir, ProjectConstants.HOME_REPO_DEFAULT_DIRNAME);
         return from(environment, homeRepoPath);
     }
 
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/FileSystemRepository.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/FileSystemRepository.java
index 53d2c3c75d9b..79a236328616 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/FileSystemRepository.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/FileSystemRepository.java
@@ -45,7 +45,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -123,7 +122,7 @@ void updateDeprecatedStatusForPackage(PackageDescriptor descriptor) {
         Path balaPath = getPackagePath(descriptor.org().value(), descriptor.name().value(),
                 descriptor.version().value().toString());
         if (balaPath != null && Files.exists(balaPath)) {
-            Path deprecateMsgMetaFile = Paths.get(balaPath.toString(), ProjectConstants.DEPRECATED_META_FILE_NAME);
+            Path deprecateMsgMetaFile = Path.of(balaPath.toString(), ProjectConstants.DEPRECATED_META_FILE_NAME);
             if (descriptor.getDeprecated() && !deprecateMsgMetaFile.toFile().exists()) {
                 FileUtils.addDeprecatedMetaFile(deprecateMsgMetaFile, descriptor.getDeprecationMsg());
             }
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/MavenPackageRepository.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/MavenPackageRepository.java
index 0791f2305a60..19a7dba1d834 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/MavenPackageRepository.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/repositories/MavenPackageRepository.java
@@ -39,13 +39,11 @@
 import org.ballerinalang.toml.exceptions.SettingsTomlException;
 import org.wso2.ballerinalang.util.RepoUtils;
 
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -190,7 +188,7 @@ public boolean getPackageFromRemoteRepo(String org,
             try (BufferedReader bufferedReader = Files.newBufferedReader(packageJsonPath, StandardCharsets.UTF_8)) {
                 JsonObject resultObj = new Gson().fromJson(bufferedReader, JsonObject.class);
                 String platform = resultObj.get(PLATFORM).getAsString();
-                Path actualBalaPath = Paths.get(this.repoLocation).resolve(org).resolve(name)
+                Path actualBalaPath = Path.of(this.repoLocation).resolve(org).resolve(name)
                         .resolve(version).resolve(platform);
                 FileUtils.copyDirectory(temporaryExtractionPath.toFile(),
                         actualBalaPath.toFile());
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/FileUtils.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/FileUtils.java
index 7aeba0b3936b..40558de1348a 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/FileUtils.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/FileUtils.java
@@ -34,7 +34,6 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.PathMatcher;
-import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -74,7 +73,7 @@ private FileUtils() {
      * @return File name without extension.
      */
     public static String getFileNameWithoutExtension(String filePath) {
-        Path fileName = Paths.get(filePath).getFileName();
+        Path fileName = Path.of(filePath).getFileName();
         if (null != fileName) {
             int index = indexOfExtension(fileName.toString());
             return index == -1 ? fileName.toString() :
diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/ProjectUtils.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/ProjectUtils.java
index 5a852a292f00..da43638ffb7d 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/ProjectUtils.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/util/ProjectUtils.java
@@ -76,7 +76,6 @@
 import java.nio.file.Files;
 import java.nio.file.LinkOption;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -472,7 +471,7 @@ public static Path getRelativeBalaPath(String org, String pkgName, String versio
         if (platform == null || platform.isEmpty()) {
             platform = "any";
         }
-        return Paths.get(org, pkgName, version, platform);
+        return Path.of(org, pkgName, version, platform);
     }
 
     public static String getJarFileName(Package pkg) {
@@ -504,7 +503,7 @@ public static String getVersionFromBalaName(String balaName) {
     private static final HashSet excludeExtensions = new HashSet<>(Lists.of("DSA", "SF"));
 
     public static Path getBalHomePath() {
-        return Paths.get(System.getProperty(BALLERINA_HOME));
+        return Path.of(System.getProperty(BALLERINA_HOME));
     }
 
     public static Path getBallerinaRTJarPath() {
@@ -677,10 +676,10 @@ public static Path createAndGetHomeReposPath() {
             if (userHomeDir == null || userHomeDir.isEmpty()) {
                 throw new BLangCompilerException("Error creating home repository: unable to get user home directory");
             }
-            homeRepoPath = Paths.get(userHomeDir, ProjectConstants.HOME_REPO_DEFAULT_DIRNAME);
+            homeRepoPath = Path.of(userHomeDir, ProjectConstants.HOME_REPO_DEFAULT_DIRNAME);
         } else {
             // User has specified the home repo path with env variable.
-            homeRepoPath = Paths.get(homeRepoDir);
+            homeRepoPath = Path.of(homeRepoDir);
         }
 
         homeRepoPath = homeRepoPath.toAbsolutePath();
@@ -1118,7 +1117,7 @@ public static boolean isProjectUpdated(Project project) {
      * @return temporary target path
      */
     public static String getTemporaryTargetPath() {
-        return Paths.get(System.getProperty("java.io.tmpdir"))
+        return Path.of(System.getProperty("java.io.tmpdir"))
                 .resolve("ballerina-cache" + System.nanoTime()).toString();
     }
 
diff --git a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/ClasspathPackageRepository.java b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/ClasspathPackageRepository.java
index 116735705c35..5f7bf1e27f6f 100644
--- a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/ClasspathPackageRepository.java
+++ b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/ClasspathPackageRepository.java
@@ -27,7 +27,6 @@
 import java.nio.file.FileSystemAlreadyExistsException;
 import java.nio.file.FileSystems;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -65,7 +64,7 @@ private static Path generatePath(Class providerClassRef, Strin
                 pathUri = URI.create("file:" + classPath + basePath);
             }
             initFS(pathUri);
-            return Paths.get(pathUri);
+            return Path.of(pathUri);
         } catch (URISyntaxException | IOException e) {
             throw new RuntimeException(e);
         }
diff --git a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java
index 4d8f7351808a..0f3a0f3848bb 100644
--- a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java
+++ b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java
@@ -19,7 +19,8 @@
 
 import org.wso2.ballerinalang.compiler.util.Name;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * This represents a local file system based {@link org.ballerinalang.repository.PackageRepository}.
@@ -29,10 +30,10 @@
 public class LocalFSPackageRepository extends GeneralFSPackageRepository {
 
     public LocalFSPackageRepository(String basePath) {
-        super(Paths.get(basePath));
+        super(Path.of(basePath));
     }
 
     public LocalFSPackageRepository(String basePath, String orgName) {
-        super(Paths.get(basePath), new Name(orgName));
+        super(Path.of(basePath), new Name(orgName));
     }
 }
diff --git a/compiler/ballerina-lang/src/main/java/org/ballerinalang/toml/model/DependencyMetadata.java b/compiler/ballerina-lang/src/main/java/org/ballerinalang/toml/model/DependencyMetadata.java
index d7c31817a4de..7069d859b74e 100644
--- a/compiler/ballerina-lang/src/main/java/org/ballerinalang/toml/model/DependencyMetadata.java
+++ b/compiler/ballerina-lang/src/main/java/org/ballerinalang/toml/model/DependencyMetadata.java
@@ -20,7 +20,6 @@
 import org.ballerinalang.toml.util.PathUtils;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Defines dependency object fields. The same object will be used to define patches.
@@ -58,7 +57,7 @@ public Path getPath() {
         if (PathUtils.getPath(this.path) == null) {
             return null;
         }
-        return Paths.get(PathUtils.getPath(this.path));
+        return Path.of(PathUtils.getPath(this.path));
     }
 
     /**
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/FileSystemProgramDirectory.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/FileSystemProgramDirectory.java
index 90bddfaa827a..7406a2ee6280 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/FileSystemProgramDirectory.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/FileSystemProgramDirectory.java
@@ -37,7 +37,6 @@
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -111,7 +110,7 @@ public InputStream getLockFileContent() {
     public Path saveCompiledProgram(InputStream source, String fileName) {
         // When building a single bal file the executable (balx) should be generated in the current directory of
         // the user
-        Path targetFilePath = Paths.get(fileName);
+        Path targetFilePath = Path.of(fileName);
         try {
             outStream.println("    " + fileName);
             Files.copy(source, targetFilePath, StandardCopyOption.REPLACE_EXISTING);
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 9e5b9ab7a4b3..50688607dae6 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
@@ -36,7 +36,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 import java.util.stream.Stream;
 
@@ -153,7 +152,7 @@ private SourceDirectory initializeAndGetSourceDirectory(CompilerContext context)
                 throw new IllegalArgumentException("invalid project directory path");
             }
         
-            Path sourceRoot = Paths.get(srcDirPathName);
+            Path sourceRoot = Path.of(srcDirPathName);
         
             if (Files.notExists(sourceRoot)) {
                 throw new BLangCompilerException("'" + sourceRoot + "' project directory does not exist.");
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/PathConverter.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/PathConverter.java
index 75f58471bf57..43db3c4fc019 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/PathConverter.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/PathConverter.java
@@ -33,7 +33,6 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.PathMatcher;
-import java.nio.file.Paths;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -120,8 +119,8 @@ public Stream expandBal(Path path) {
         if (Files.isDirectory(path)) {
             try {
                 List excludePaths = new ArrayList<>();
-                excludePaths.add(Paths.get(ProjectDirConstants.TEST_DIR_NAME));
-                excludePaths.add(Paths.get(ProjectDirConstants.RESOURCE_DIR_NAME));
+                excludePaths.add(Path.of(ProjectDirConstants.TEST_DIR_NAME));
+                excludePaths.add(Path.of(ProjectDirConstants.RESOURCE_DIR_NAME));
                 FilterSearch filterSearch = new FilterSearch<>(excludePaths);
                 Files.walkFileTree(path, filterSearch);
                 return filterSearch.getPathList().stream().sorted();
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/ZipConverter.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/ZipConverter.java
index cd1068652df9..d703edd2a25c 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/ZipConverter.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/converters/ZipConverter.java
@@ -32,7 +32,6 @@
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Comparator;
@@ -74,14 +73,14 @@ private static Path pathWithinZip(URI pathToZip) {
                     pathToZip.getPath() + "!/",
                     pathToZip.getQuery(), pathToZip.getFragment());
             initFS(pathInZip);
-            return Paths.get(pathInZip);
+            return Path.of(pathInZip);
         } catch (URISyntaxException ignore) {
             // This exception occurs when trying to read the bala which is inside the package zip. An exception can
             // occur when creating the URI needed to create the zip file system provider which will be used to read the
             // content inside the zip/jar file. So if such an error occurs, we just return the path to the zip/jar file
             // instead of throwing the exception.
         }
-        return Paths.get(pathToZip);
+        return Path.of(pathToZip);
     }
 
     @SuppressWarnings("resource")
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/BinaryRepo.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/BinaryRepo.java
index fe46f5c63e2b..9d4c759689e2 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/BinaryRepo.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/BinaryRepo.java
@@ -9,7 +9,6 @@
 import org.wso2.ballerinalang.compiler.util.ProjectDirConstants;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import static org.wso2.ballerinalang.compiler.packaging.Patten.LATEST_VERSION_DIR;
 import static org.wso2.ballerinalang.compiler.packaging.Patten.path;
@@ -23,7 +22,7 @@ public class BinaryRepo implements Repo {
     private final ZipConverter converter;
 
     public BinaryRepo(Path pathToHiddenDir, CompilerPhase compilerPhase) {
-        this(pathToHiddenDir, Paths.get(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME), compilerPhase);
+        this(pathToHiddenDir, Path.of(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME), compilerPhase);
     }
 
     public BinaryRepo(ZipConverter converter, CompilerPhase compilerPhase) {
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/CacheRepo.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/CacheRepo.java
index 3c73aa448b27..d8c1f32ea966 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/CacheRepo.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/CacheRepo.java
@@ -4,7 +4,6 @@
 import org.wso2.ballerinalang.compiler.util.ProjectDirConstants;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Calculate path pattens for project and home cache.
@@ -12,6 +11,6 @@
 public class CacheRepo extends BinaryRepo {
 
     public CacheRepo(Path path, String cacheName, CompilerPhase compilerPhase) {
-        super(path, Paths.get(ProjectDirConstants.CACHES_DIR_NAME, cacheName), compilerPhase);
+        super(path, Path.of(ProjectDirConstants.CACHES_DIR_NAME, cacheName), compilerPhase);
     }
 }
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/JarRepo.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/JarRepo.java
index cf449f01fe81..f1a46072ea77 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/JarRepo.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/JarRepo.java
@@ -7,7 +7,6 @@
 
 import java.net.URI;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Calculate path pattens within meta-inf dir of jars (or exploded jars).
@@ -17,7 +16,7 @@ public class JarRepo implements Repo {
     private final ZipConverter converter;
 
     public JarRepo(URI jarLocation) {
-        this.converter = new ZipConverter(Paths.get(jarLocation));
+        this.converter = new ZipConverter(Path.of(jarLocation));
     }
 
     @Override
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/PathBalaRepo.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/PathBalaRepo.java
index 71aa4b38f547..bbcc783742ea 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/PathBalaRepo.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/packaging/repo/PathBalaRepo.java
@@ -31,7 +31,6 @@
 
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 import java.util.Optional;
 import java.util.regex.Matcher;
@@ -53,7 +52,7 @@ public PathBalaRepo(Manifest manifest, Map dependencyManife
         this.manifest = manifest;
         this.dependencyManifests = dependencyManifests;
         // path value for zip converter does'nt matter
-        this.zipConverter = new ZipConverter(Paths.get(""));
+        this.zipConverter = new ZipConverter(Path.of(""));
     }
     
     @Override
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/util/FileUtils.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/util/FileUtils.java
index f4d2cf32b227..54081d6b35e0 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/util/FileUtils.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/util/FileUtils.java
@@ -30,7 +30,6 @@
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.HashMap;
 import java.util.Map;
@@ -63,7 +62,7 @@ public static void deleteFile(Path filePath) throws IOException {
      */
     static void generateBala(BLangPackage bLangPackage, String projectPath, Stream paths) {
         PackageID packageID = bLangPackage.packageID;
-        Path destPath = Paths.get(projectPath, ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path destPath = Path.of(projectPath, ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                   ProjectDirConstants.CACHES_DIR_NAME,
                                   ProjectDirConstants.BALLERINA_CENTRAL_DIR_NAME,
                                   packageID.getOrgName().getValue(),
diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/util/RepoUtils.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/util/RepoUtils.java
index b6bdde5c622b..5ea369d0ca4c 100644
--- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/util/RepoUtils.java
+++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/util/RepoUtils.java
@@ -34,7 +34,6 @@
 import java.nio.file.Files;
 import java.nio.file.LinkOption;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.Properties;
@@ -88,10 +87,10 @@ public static Path createAndGetHomeReposPath() {
             if (userHomeDir == null || userHomeDir.isEmpty()) {
                 throw new BLangCompilerException("Error creating home repository: unable to get user home directory");
             }
-            homeRepoPath = Paths.get(userHomeDir, ProjectDirConstants.HOME_REPO_DEFAULT_DIRNAME);
+            homeRepoPath = Path.of(userHomeDir, ProjectDirConstants.HOME_REPO_DEFAULT_DIRNAME);
         } else {
             // User has specified the home repo path with env variable.
-            homeRepoPath = Paths.get(homeRepoDir);
+            homeRepoPath = Path.of(homeRepoDir);
         }
 
         homeRepoPath = homeRepoPath.toAbsolutePath();
@@ -170,7 +169,7 @@ public static String getStagingURL() {
     }
 
     public static Path getLibDir() {
-        return Paths.get(System.getProperty(BALLERINA_INSTALL_DIR_PROP, ".")).resolve("lib");
+        return Path.of(System.getProperty(BALLERINA_INSTALL_DIR_PROP, ".")).resolve("lib");
     }
 
     /**
@@ -192,7 +191,7 @@ public static Path createAndGetLibsRepoPath() {
             return null;
         }
 
-        return Paths.get(ballerinaHome).resolve(ProjectDirConstants.BALLERINA_HOME_LIB);
+        return Path.of(ballerinaHome).resolve(ProjectDirConstants.BALLERINA_HOME_LIB);
     }
 
     private static boolean getBooleanProp(String key) {
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java
index 91bae1a45de7..b08a93609366 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -46,7 +45,7 @@
  */
 public class BallerinaTomlTests {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path BAL_TOML_REPO = RESOURCE_DIRECTORY.resolve("ballerina-toml");
 
     @Test
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java
index 93a42401aec7..787517edfaf1 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java
@@ -26,7 +26,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
@@ -35,7 +34,7 @@
  * Contains test cases to validate the detection of cyclic dependencies in {@code DependencyGraph}.
  */
 public class CyclicDependenciesTest {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources", "cyclic-graphs");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources", "cyclic-graphs");
 
     private static final ResolutionEngine.DependencyNode PACKAGE_01 = createNode("nipyf", "js", "1.0.2");
     private static final ResolutionEngine.DependencyNode PACKAGE_02 = createNode("nipyf", "toml", "1.0.0");
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java
index f12dc4abf056..8c49aab61a92 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java
@@ -27,7 +27,6 @@
 import java.io.PrintStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -39,7 +38,7 @@
  */
 public class DependenciesTomlTests {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path DEPENDENCIES_TOML_REPO = RESOURCE_DIRECTORY.resolve("dependencies-toml");
     static final PrintStream OUT = System.out;
 
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java
index 47148ca575d6..afcc7a417412 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java
@@ -27,7 +27,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.StringJoiner;
@@ -38,7 +37,7 @@
  * @since 2.0.0
  */
 public class DotGraphsTests {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources",
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources",
             "dot-graphs");
 
     @Test(enabled = false)
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java
index cdf070aa7eaa..bbc7d22a5570 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java
@@ -27,7 +27,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 import java.util.Map;
 
@@ -39,7 +38,7 @@
  * @since 2201.2.1
  */
 public class FileSystemRepositoryGetPackagesTests {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources", "repository-resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources", "repository-resources");
     private Map> nonEmptyRepoPackages;
     private Map> emptyRepoPackages;
     private Environment environment;
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java
index d68450b701e8..079835e679b5 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java
@@ -27,7 +27,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -51,7 +50,7 @@ protected List getIncompatibleVer(List versions, PackageOrg org, Pac
         }
     }
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path TEST_REPO = RESOURCE_DIRECTORY.resolve("test-repo");
     private FileSystemRepository fileSystemRepository;
 
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java
index 97ba3d2d647c..caf496f0595a 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java
@@ -9,7 +9,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 /**
@@ -18,7 +17,7 @@
  * @since 2.0.0
  */
 public class FileSystemRepositoryValidationTests {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path TEST_REPO = RESOURCE_DIRECTORY.resolve("test-repo");
     private FileSystemRepository fileSystemRepository;
 
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java
index 2c0a4511c862..001bf9a11d89 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java
@@ -29,7 +29,6 @@
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -87,7 +86,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
         }
     }
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path TEST_REPO = RESOURCE_DIRECTORY.resolve("custom-repo-resources")
             .resolve("local-custom-repo");
     private MavenPackageRepository customPackageRepository;
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java
index 9a4edbec8e76..70d406b0c9d9 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Tests the ProjectPaths util.
@@ -198,7 +197,7 @@ public void testPackageRootWithDirectory() {
 
     @Test(expectedExceptions = ProjectException.class)
     public void testPackageRootNegative() {
-        Assert.assertEquals(ProjectPaths.packageRoot(Paths.get("/tmp")), buildProjectPath);
+        Assert.assertEquals(ProjectPaths.packageRoot(Path.of("/tmp")), buildProjectPath);
     }
 
     @Test(expectedExceptions = ProjectException.class)
@@ -235,7 +234,7 @@ public void testIsBallerinaSourceFile() {
 
         Assert.assertFalse(ProjectPaths.isBalFile(buildProjectPath.resolve("Ballerina.toml")));
         Assert.assertFalse(ProjectPaths.isBalFile(buildProjectPath));
-        Assert.assertFalse(ProjectPaths.isBalFile(Paths.get("/tmp/non-existent-path")));
+        Assert.assertFalse(ProjectPaths.isBalFile(Path.of("/tmp/non-existent-path")));
     }
 
     @Test
@@ -248,7 +247,7 @@ public void testIsBallerinaStandaloneFile() {
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(
                 buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1")
                                 .resolve(ProjectConstants.TEST_DIR_NAME).resolve("main_test.bal")));
-        Assert.assertFalse(ProjectPaths.isStandaloneBalFile(Paths.get("/tmp/non-existent-path")));
+        Assert.assertFalse(ProjectPaths.isStandaloneBalFile(Path.of("/tmp/non-existent-path")));
 
         Assert.assertTrue(ProjectPaths.isStandaloneBalFile(
                 buildProjectPath.resolve("test-utils").resolve("utils.bal")));
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java
index 9a928d91af6f..faaaff414b6f 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java
@@ -31,7 +31,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -43,7 +42,7 @@
  */
 public class ProjectUtilsTests {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path PROJECT_UTILS_RESOURCES = RESOURCE_DIRECTORY.resolve("project-utils");
     private static Path tempDirectory;
     private static BuildJson buildJson;
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/VersionConflictResolutionTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/VersionConflictResolutionTests.java
index f42581bc7e37..6735be931401 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/VersionConflictResolutionTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/VersionConflictResolutionTests.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.List;
 
@@ -41,7 +40,7 @@
  */
 public class VersionConflictResolutionTests {
     private static final Gson gson = new Gson();
-    private static final Path testSourcesDirectory = Paths.get(
+    private static final Path testSourcesDirectory = Path.of(
             "src/test/resources/project_api/version_conflicts").toAbsolutePath().normalize();
 
     private static final PackageDescriptor rootPkgDesc = PackageDescriptor.from(PackageOrg.from("samjs"),
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/AbstractPackageResolutionTest.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/AbstractPackageResolutionTest.java
index 9f5f8c4a65dd..436ed633197f 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/AbstractPackageResolutionTest.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/AbstractPackageResolutionTest.java
@@ -28,7 +28,6 @@
 import org.testng.Assert;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.StringJoiner;
 
@@ -41,7 +40,7 @@
  */
 public abstract class AbstractPackageResolutionTest {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources",
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources",
             "package-resolution");
 
     public void runTestCase(String testSuiteDirName, String testCaseDirName, boolean sticky) {
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/internal/TestCaseFilePaths.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/internal/TestCaseFilePaths.java
index b57002051ead..683ade1276fc 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/internal/TestCaseFilePaths.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/test/resolution/packages/internal/TestCaseFilePaths.java
@@ -19,7 +19,6 @@
 
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Optional;
 
 /**
@@ -102,7 +101,7 @@ private TestCaseFilePathsBuilder() {
         }
 
         public static TestCaseFilePaths build(Path testSuitePath, Path testCasePath) {
-            Path appPath = getFilePath(testSuitePath, testCasePath, Paths.get(Constants.APP_FILE_NAME));
+            Path appPath = getFilePath(testSuitePath, testCasePath, Path.of(Constants.APP_FILE_NAME));
             if (appPath == null) {
                 throw new IllegalStateException(Constants.APP_FILE_NAME +
                         " cannot be found in neither testcase dir `" +
@@ -111,18 +110,18 @@ public static TestCaseFilePaths build(Path testSuitePath, Path testCasePath) {
             }
 
             Path centralRepoPath = getFilePath(testSuitePath, testCasePath,
-                    Paths.get(Constants.REPO_DIR_NAME).resolve(Constants.CENTRAL_REPO_FILE_NAME));
+                    Path.of(Constants.REPO_DIR_NAME).resolve(Constants.CENTRAL_REPO_FILE_NAME));
             Path distRepoPath = getFilePath(testSuitePath, testCasePath,
-                    Paths.get(Constants.REPO_DIR_NAME).resolve(Constants.DIST_REPO_FILE_NAME));
+                    Path.of(Constants.REPO_DIR_NAME).resolve(Constants.DIST_REPO_FILE_NAME));
             Path localRepoDirPath = getFilePath(testSuitePath, testCasePath,
-                    Paths.get(Constants.REPO_DIR_NAME).resolve(Constants.LOCAL_REPO_DIR_NAME));
+                    Path.of(Constants.REPO_DIR_NAME).resolve(Constants.LOCAL_REPO_DIR_NAME));
 
-            Path depsTomlPath = getFilePath(testSuitePath, testCasePath, Paths.get(Constants.DEPS_TOML_FILE_NAME));
-            Path balTomlPath = getFilePath(testSuitePath, testCasePath, Paths.get(Constants.BAL_TOML_FILE_NAME));
+            Path depsTomlPath = getFilePath(testSuitePath, testCasePath, Path.of(Constants.DEPS_TOML_FILE_NAME));
+            Path balTomlPath = getFilePath(testSuitePath, testCasePath, Path.of(Constants.BAL_TOML_FILE_NAME));
             Path expGraphStickyPath = getFilePath(testSuitePath, testCasePath,
-                    Paths.get(Constants.EXP_GRAPH_STICKY_FILE_NAME));
+                    Path.of(Constants.EXP_GRAPH_STICKY_FILE_NAME));
             Path expGraphNoStickyPath = getFilePath(testSuitePath, testCasePath,
-                    Paths.get(Constants.EXP_GRAPH_NO_STICKY_FILE_NAME));
+                    Path.of(Constants.EXP_GRAPH_NO_STICKY_FILE_NAME));
 
             return new TestCaseFilePaths(centralRepoPath, distRepoPath, localRepoDirPath,
                     appPath, depsTomlPath, balTomlPath, expGraphStickyPath, expGraphNoStickyPath);
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java
index b274c52cabf0..3bb9a5fa9c05 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java
@@ -25,7 +25,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test {@code FileUtils} class.
@@ -34,7 +33,7 @@
  */
 public class TestFileUtils {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path UTIL_RESOURCES = RESOURCE_DIRECTORY.resolve("utils");
 
     @DataProvider(name = "providePngFiles")
diff --git a/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/InvalidSettingsTomlTest.java b/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/InvalidSettingsTomlTest.java
index 01c17834d620..a1e55f16461b 100644
--- a/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/InvalidSettingsTomlTest.java
+++ b/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/InvalidSettingsTomlTest.java
@@ -29,7 +29,6 @@
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.Objects;
 
@@ -42,7 +41,7 @@ public class InvalidSettingsTomlTest {
     public void testParseTomlContentFromFile() throws IOException, URISyntaxException {
         URI settingsTomlURI = Objects.requireNonNull(getClass().getClassLoader().getResource("invalid-settings.toml"))
                 .toURI();
-        Path settingsFilePath = Paths.get(settingsTomlURI);
+        Path settingsFilePath = Path.of(settingsTomlURI);
 
         TomlDocument settingsTomlDocument = TomlDocument
                 .from(String.valueOf(settingsFilePath.getFileName()), Files.readString(settingsFilePath));
diff --git a/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/ManifestProcessorTest.java b/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/ManifestProcessorTest.java
index 830636860cb5..94535ccf07ca 100644
--- a/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/ManifestProcessorTest.java
+++ b/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/ManifestProcessorTest.java
@@ -27,7 +27,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Locale;
 
 /**
@@ -161,18 +160,18 @@ public void testDependenciesIrregularPath() throws TomlException, IOException {
         Files.createFile(balaPath);
 
         if (balaPath.toString().contains("\\")) {
-            balaPath = Paths.get(balaPath.toString().replace("\\", "/"));
+            balaPath = Path.of(balaPath.toString().replace("\\", "/"));
         } else {
-            balaPath = Paths.get(balaPath.toString().replace("/", "\\"));
+            balaPath = Path.of(balaPath.toString().replace("/", "\\"));
         }
 
         Manifest manifest = ManifestProcessor.parseTomlContentFromString(this.validProjectBlock + "[dependencies] \n " +
                 "string-utils = {path = '" + balaPath + "', version = \"1.1.5\"} \n");
         Path manifestPath = manifest.getDependencies().get(0).getMetadata().getPath();
         if (manifestPath.toString().contains("\\")) {
-            manifestPath = Paths.get(manifestPath.toString().replace("\\", "/"));
+            manifestPath = Path.of(manifestPath.toString().replace("\\", "/"));
         } else {
-            manifestPath = Paths.get(manifestPath.toString().replace("/", "\\"));
+            manifestPath = Path.of(manifestPath.toString().replace("/", "\\"));
         }
 
         Assert.assertEquals(manifest.getDependencies().get(0).getModuleID(), "string-utils");
@@ -254,20 +253,20 @@ public void testNativeLibWithIrregularPath() throws TomlException, IOException {
         Files.createFile(libPath);
 
         if (libPath.toString().contains("\\")) {
-            libPath = Paths.get(libPath.toString().replace("\\", "/"));
+            libPath = Path.of(libPath.toString().replace("\\", "/"));
         } else {
-            libPath = Paths.get(libPath.toString().replace("/", "\\"));
+            libPath = Path.of(libPath.toString().replace("/", "\\"));
         }
         Manifest manifest = ManifestProcessor.parseTomlContentFromString(this.validProjectBlock +
                 "[platform] \n target = \"java17\" \n \n " +
                 "[[platform.libraries]] \n " +
                 "artifactId = \"utils\" \n path = '" + libPath + "'\n groupId = \"wso2\" \n " +
                 "modules = [\"mymodule\"] ");
-        Path manifestPath = Paths.get(manifest.platform.libraries.get(0).getPath());
+        Path manifestPath = Path.of(manifest.platform.libraries.get(0).getPath());
         if (manifestPath.toString().contains("\\")) {
-            manifestPath = Paths.get(manifestPath.toString().replace("\\", "/"));
+            manifestPath = Path.of(manifestPath.toString().replace("\\", "/"));
         } else {
-            manifestPath = Paths.get(manifestPath.toString().replace("/", "\\"));
+            manifestPath = Path.of(manifestPath.toString().replace("/", "\\"));
         }
         Assert.assertEquals(manifestPath.toString(), libPath.toString());
     }
diff --git a/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/TomlFileToManifestTest.java b/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/TomlFileToManifestTest.java
index cac51c198755..e165a8f26cdf 100644
--- a/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/TomlFileToManifestTest.java
+++ b/compiler/ballerina-lang/src/test/java/org/ballerinalang/toml/TomlFileToManifestTest.java
@@ -28,7 +28,6 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test class to populate a Manifest object from a toml file.
@@ -39,7 +38,7 @@ public class TomlFileToManifestTest {
     @Test(description = "Test which covers all the attributes tested above")
     public void testTomlFile() throws URISyntaxException {
         URI ballerinaTomlURI = getClass().getClassLoader().getResource("Ballerina.toml").toURI();
-        Path ballerinTomlPath = Paths.get(ballerinaTomlURI);
+        Path ballerinTomlPath = Path.of(ballerinaTomlURI);
         
         Manifest manifest = TomlParserUtils.getManifest(ballerinTomlPath.getParent());
         Assert.assertEquals(manifest.getProject().getOrgName(), "foo");
@@ -57,7 +56,7 @@ public void testTomlFile() throws URISyntaxException {
           expectedExceptionsMessageRegExp = ".*expected begin_array but was string at path.*")
     public void testInvalidTomlFile() throws URISyntaxException, IOException, TomlException {
         URI ballerinaTomlURI = getClass().getClassLoader().getResource("invalid-ballerina.toml").toURI();
-        Path ballerinTomlPath = Paths.get(ballerinaTomlURI);
+        Path ballerinTomlPath = Path.of(ballerinaTomlURI);
         ManifestProcessor.parseTomlContentFromFile(ballerinTomlPath);
     }
 }
diff --git a/compiler/ballerina-lang/src/test/java/org/wso2/ballerinalang/compiler/BLangNodeTransformerTest.java b/compiler/ballerina-lang/src/test/java/org/wso2/ballerinalang/compiler/BLangNodeTransformerTest.java
index a5ab3766832a..3f66bfd86d4c 100644
--- a/compiler/ballerina-lang/src/test/java/org/wso2/ballerinalang/compiler/BLangNodeTransformerTest.java
+++ b/compiler/ballerina-lang/src/test/java/org/wso2/ballerinalang/compiler/BLangNodeTransformerTest.java
@@ -34,7 +34,6 @@
 import java.lang.reflect.Modifier;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -50,7 +49,7 @@
  */
 public class BLangNodeTransformerTest {
     private static final Logger LOGGER = LoggerFactory.getLogger(BLangNodeTransformerTest.class);
-    public static final Path RES_DIR = Paths.get("src/test/resources/node-tree/").toAbsolutePath();
+    public static final Path RES_DIR = Path.of("src/test/resources/node-tree/").toAbsolutePath();
 
     @Test(dataProvider = "testTransformationTestProvider", enabled = false)
     public void testTransformation(String configName, String sourcePackage)
@@ -243,10 +242,10 @@ private static JsonObject fileContentAsObject(String filePath) {
     }
 
     private static Project loadProject(String sourceFilePath) {
-        Path sourcePath = Paths.get(sourceFilePath);
+        Path sourcePath = Path.of(sourceFilePath);
         String sourceFileName = sourcePath.getFileName().toString();
         Path sourceRoot = RES_DIR.resolve(sourcePath.getParent());
-        Path projectPath = Paths.get(sourceRoot.toString(), sourceFileName);
+        Path projectPath = Path.of(sourceRoot.toString(), sourceFileName);
         return ProjectLoader.loadProject(projectPath);
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/ParserTestUtils.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/ParserTestUtils.java
index 6a6ee2be437f..70d6c7456d6b 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/ParserTestUtils.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/ParserTestUtils.java
@@ -45,7 +45,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 import static io.ballerina.compiler.internal.syntax.SyntaxUtils.isSTNodePresent;
@@ -66,7 +65,7 @@
  */
 public final class ParserTestUtils {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     /**
      * WARNING: Enabling this flag will update all the assertion files in unit tests.
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/SyntaxTreeJSONGenerator.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/SyntaxTreeJSONGenerator.java
index d2f1bad77efe..964c43b4d16b 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/SyntaxTreeJSONGenerator.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/SyntaxTreeJSONGenerator.java
@@ -38,7 +38,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 import static io.ballerinalang.compiler.parser.test.ParserTestConstants.CHILDREN_FIELD;
@@ -65,7 +64,7 @@ public final class SyntaxTreeJSONGenerator {
     private static final ParserRuleContext PARSER_CONTEXT = ParserRuleContext.COMP_UNIT;
 
     private static final PrintStream STANDARD_OUT = System.out;
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     private SyntaxTreeJSONGenerator() {
     }
@@ -76,7 +75,7 @@ public static void main(String[] args) throws IOException {
 
         // Using a file source as input
         String path = "test_parser.bal";
-        String jsonString = generateJSON(Paths.get(path), PARSER_CONTEXT);
+        String jsonString = generateJSON(Path.of(path), PARSER_CONTEXT);
         STANDARD_OUT.println(jsonString);
     }
 
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/TestParser.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/TestParser.java
index c3e6344bf0dc..031e312b9865 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/TestParser.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/TestParser.java
@@ -25,7 +25,7 @@
 import java.io.PrintStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the parser.
@@ -39,7 +39,7 @@ private TestParser() {
 
     public static void main(String[] args) throws IOException {
         String path = TestParser.class.getClassLoader().getResource("test_parser.bal").getPath();
-        String content = new String(Files.readAllBytes(Paths.get(path)), StandardCharsets.UTF_8);
+        String content = new String(Files.readAllBytes(Path.of(path)), StandardCharsets.UTF_8);
         testParser(content);
     }
 
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/incremental/AbstractIncrementalParserTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/incremental/AbstractIncrementalParserTest.java
index 705fce6eb502..5f937dd7979a 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/incremental/AbstractIncrementalParserTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/incremental/AbstractIncrementalParserTest.java
@@ -29,7 +29,6 @@
 import org.bitbucket.cowwoc.diffmatchpatch.DiffMatchPatch;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -44,12 +43,12 @@
 public class AbstractIncrementalParserTest {
 
     public static SyntaxTree parseFile(String sourceFilePath) {
-        Path sourcePath = Paths.get("incremental", sourceFilePath);
+        Path sourcePath = Path.of("incremental", sourceFilePath);
         return ParserTestUtils.parseFile(sourcePath);
     }
 
     public static SyntaxTree parse(SyntaxTree oldTree, String sourceFilePath) {
-        Path sourcePath = Paths.get("incremental", sourceFilePath);
+        Path sourcePath = Path.of("incremental", sourceFilePath);
         return SyntaxTree.from(oldTree, getTextChange(oldTree, sourcePath));
     }
 
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/actions/AbstractActionTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/actions/AbstractActionTest.java
index 12ed38851ad7..124bfc5d367d 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/actions/AbstractActionTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/actions/AbstractActionTest.java
@@ -20,7 +20,7 @@
 import io.ballerina.compiler.internal.parser.ParserRuleContext;
 import io.ballerinalang.compiler.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test parsing actions.
@@ -30,7 +30,7 @@
 public class AbstractActionTest {
 
     void testFile(String path, String filePath) {
-        ParserTestUtils.test(Paths.get("actions/", path), ParserRuleContext.TOP_LEVEL_NODE,
-                Paths.get("actions/", filePath));
+        ParserTestUtils.test(Path.of("actions/", path), ParserRuleContext.TOP_LEVEL_NODE,
+                Path.of("actions/", filePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/declarations/AbstractDeclarationTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/declarations/AbstractDeclarationTest.java
index 2f1f64e5cba8..32b0ae6ff6b8 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/declarations/AbstractDeclarationTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/declarations/AbstractDeclarationTest.java
@@ -20,7 +20,7 @@
 import io.ballerina.compiler.internal.parser.ParserRuleContext;
 import io.ballerinalang.compiler.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test parsing module level declaration.
@@ -28,12 +28,12 @@
 public abstract class AbstractDeclarationTest {
 
     void test(String sourceFilePath, String filePath) {
-        ParserTestUtils.test(Paths.get("declarations/", sourceFilePath), ParserRuleContext.TOP_LEVEL_NODE,
-                Paths.get("declarations/", filePath));
+        ParserTestUtils.test(Path.of("declarations/", sourceFilePath), ParserRuleContext.TOP_LEVEL_NODE,
+                Path.of("declarations/", filePath));
     }
 
     void testFile(String path, String filePath) {
-        ParserTestUtils.test(Paths.get("declarations/", path), ParserRuleContext.COMP_UNIT,
-                Paths.get("declarations/", filePath));
+        ParserTestUtils.test(Path.of("declarations/", path), ParserRuleContext.COMP_UNIT,
+                Path.of("declarations/", filePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/expressions/AbstractExpressionsTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/expressions/AbstractExpressionsTest.java
index 5c26a093e7a6..7313bc07c9f9 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/expressions/AbstractExpressionsTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/expressions/AbstractExpressionsTest.java
@@ -20,7 +20,7 @@
 import io.ballerina.compiler.internal.parser.ParserRuleContext;
 import io.ballerinalang.compiler.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test parsing expressions.
@@ -28,11 +28,11 @@
 public class AbstractExpressionsTest {
 
     void test(String source, String filePath) {
-        ParserTestUtils.test(source, ParserRuleContext.EXPRESSION, Paths.get("expressions", filePath));
+        ParserTestUtils.test(source, ParserRuleContext.EXPRESSION, Path.of("expressions", filePath));
     }
 
     void testFile(String path, String filePath) {
-        ParserTestUtils.test(Paths.get("expressions/", path), ParserRuleContext.TOP_LEVEL_NODE,
-                Paths.get("expressions/", filePath));
+        ParserTestUtils.test(Path.of("expressions/", path), ParserRuleContext.TOP_LEVEL_NODE,
+                Path.of("expressions/", filePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java
index e1e36ccf2d80..f3ca4c244312 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java
@@ -20,7 +20,8 @@
 import io.ballerina.compiler.internal.parser.ParserRuleContext;
 import io.ballerinalang.compiler.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Test parsing miscellaneous constructs in ballerina.
@@ -30,6 +31,6 @@
 public class AbstractMiscTest {
 
     void testFile(String path, String filePath) {
-        ParserTestUtils.test(Paths.get("misc/", path), ParserRuleContext.COMP_UNIT, Paths.get("misc/", filePath));
+        ParserTestUtils.test(Path.of("misc", path), ParserRuleContext.COMP_UNIT, Path.of("misc", filePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java
index c4376bba77e5..5d4a1eaf1c7c 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java
@@ -20,7 +20,8 @@
 import io.ballerina.compiler.internal.parser.ParserRuleContext;
 import io.ballerinalang.compiler.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Test parsing statements.
@@ -30,11 +31,11 @@
 public class AbstractStatementTest {
 
     void test(String source, String filePath) {
-        ParserTestUtils.test(source, ParserRuleContext.STATEMENT, Paths.get("statements/", filePath));
+        ParserTestUtils.test(source, ParserRuleContext.STATEMENT, Path.of("statements", filePath));
     }
 
     void testFile(String path, String filePath) {
-        ParserTestUtils.test(Paths.get("statements/", path), ParserRuleContext.TOP_LEVEL_NODE,
-                Paths.get("statements/", filePath));
+        ParserTestUtils.test(Path.of("statements", path), ParserRuleContext.TOP_LEVEL_NODE,
+                Path.of("statements", filePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java
index 9805fcc9c2b2..6a88473c0817 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java
@@ -20,7 +20,8 @@
 import io.ballerina.compiler.internal.parser.ParserRuleContext;
 import io.ballerinalang.compiler.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Test capturing trivia.
@@ -28,7 +29,7 @@
 public abstract class AbstractTriviaTest {
 
     void test(String sourceFilePath, String filePath) {
-        ParserTestUtils.test(Paths.get("trivia", sourceFilePath), ParserRuleContext.COMP_UNIT,
-                Paths.get("trivia", filePath));
+        ParserTestUtils.test(Path.of("trivia", sourceFilePath), ParserRuleContext.COMP_UNIT,
+                Path.of("trivia", filePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java
index d17ca3f7a506..d10a8c21bc6a 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java
@@ -20,7 +20,8 @@
 import io.ballerina.compiler.internal.parser.ParserRuleContext;
 import io.ballerinalang.compiler.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Test parsing expressions.
@@ -28,16 +29,16 @@
 public class AbstractTypesTest {
 
     void test(String source, String filePath) {
-        ParserTestUtils.test(source, ParserRuleContext.TOP_LEVEL_NODE, Paths.get("types/", filePath));
+        ParserTestUtils.test(source, ParserRuleContext.TOP_LEVEL_NODE, Path.of("types", filePath));
     }
 
     void testTopLevelNode(String sourceFilePath, String filePath) {
-        ParserTestUtils.test(Paths.get("types/", sourceFilePath), ParserRuleContext.TOP_LEVEL_NODE,
-                Paths.get("types/", filePath));
+        ParserTestUtils.test(Path.of("types", sourceFilePath), ParserRuleContext.TOP_LEVEL_NODE,
+                Path.of("types", filePath));
     }
 
     void testFile(String sourceFilePath, String filePath) {
-        ParserTestUtils.test(Paths.get("types/", sourceFilePath), ParserRuleContext.COMP_UNIT,
-                Paths.get("types/", filePath));
+        ParserTestUtils.test(Path.of("types", sourceFilePath), ParserRuleContext.COMP_UNIT,
+                Path.of("types", filePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/AbstractSyntaxTreeAPITest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/AbstractSyntaxTreeAPITest.java
index e04713b94286..2d0020c8df23 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/AbstractSyntaxTreeAPITest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/AbstractSyntaxTreeAPITest.java
@@ -26,7 +26,6 @@
 import org.testng.Assert;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * An abstract class that contains utilities for {@code SyntaxNodeVisitor} tests.
@@ -52,11 +51,11 @@ protected String getFileContentAsString(String filePath) {
     }
 
     protected Path getPath(String fileName) {
-        return Paths.get("tree", fileName);
+        return Path.of("tree", fileName);
     }
 
     protected Path getPath(Path filePath) {
-        return Paths.get("tree").resolve(filePath);
+        return Path.of("tree").resolve(filePath);
     }
 
     protected void assertLineRange(LineRange actualLineRange, LineRange expectedLineRange) {
@@ -71,6 +70,6 @@ protected ModulePartNode getModulePartNode(String sourceFileName) {
     }
 
     protected void testTree(Node node, Path jsonFilePath) {
-        ParserTestUtils.testTree(node, Paths.get("tree").resolve(jsonFilePath));
+        ParserTestUtils.testTree(node, Path.of("tree").resolve(jsonFilePath));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java
index 5ae1a371b012..c9d3ee4aacd0 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java
@@ -23,7 +23,8 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * This class tests the deprecated syntax APIs.
@@ -52,6 +53,6 @@ public void testQueryExprDeprecatedSelectClauseAPI() {
 
     @Override
     protected SyntaxTree parseFile(String sourceFileName) {
-        return super.parseFile(Paths.get("deprecated-syntax-api-test").resolve(sourceFileName));
+        return super.parseFile(Path.of("deprecated-syntax-api-test", sourceFileName));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DiagnosticsAPITest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DiagnosticsAPITest.java
index 9e758aff0169..7f54d2c1e79d 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DiagnosticsAPITest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DiagnosticsAPITest.java
@@ -32,7 +32,7 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -118,6 +118,6 @@ public function main() {
 
     @Override
     protected SyntaxTree parseFile(String sourceFileName) {
-        return super.parseFile(Paths.get("diagnostics").resolve(sourceFileName));
+        return super.parseFile(Path.of("diagnostics", sourceFileName));
     }
 }
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/NodeListAPITest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/NodeListAPITest.java
index 0ab97184ae3f..70b4784e8e0b 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/NodeListAPITest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/NodeListAPITest.java
@@ -35,7 +35,7 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.function.Function;
 
 /**
@@ -107,11 +107,11 @@ public void testAddMethod() {
 
     @Override
     protected SyntaxTree parseFile(String sourceFileName) {
-        return super.parseFile(Paths.get("node_list_api").resolve(sourceFileName));
+        return super.parseFile(Path.of("node_list_api", sourceFileName));
     }
 
     protected void testTree(Node node, String jsonFileName) {
-        super.testTree(node, Paths.get("node_list_api").resolve(jsonFileName));
+        super.testTree(node, Path.of("node_list_api", jsonFileName));
     }
 
     private StatementNode dupLocalVarDeclStmt(VariableDeclarationNode srcDeclNode, String varName) {
diff --git a/compiler/ballerina-treegen/src/main/java/io/ballerinalang/compiler/internal/treegen/targets/Target.java b/compiler/ballerina-treegen/src/main/java/io/ballerinalang/compiler/internal/treegen/targets/Target.java
index 067f0c6e40ce..dbbb0cfb3edd 100644
--- a/compiler/ballerina-treegen/src/main/java/io/ballerinalang/compiler/internal/treegen/targets/Target.java
+++ b/compiler/ballerina-treegen/src/main/java/io/ballerinalang/compiler/internal/treegen/targets/Target.java
@@ -31,7 +31,6 @@
 import java.io.StringWriter;
 import java.io.Writer;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -91,7 +90,7 @@ private String generateTextContent(Object treeNodeClass) {
     }
 
     private Path getFilePath(String outputDir, String className) {
-        return Paths.get(outputDir, getClassFileName(className)).toAbsolutePath();
+        return Path.of(outputDir, getClassFileName(className)).toAbsolutePath();
     }
 
     protected String getClassFQN(String packageName, String className) {
diff --git a/compiler/linter-plugin/src/test/java/io/ballerina/compiler/linter/codeactions/test/CodeActionUtils.java b/compiler/linter-plugin/src/test/java/io/ballerina/compiler/linter/codeactions/test/CodeActionUtils.java
index ab66d1c39fa8..47633de0cc66 100644
--- a/compiler/linter-plugin/src/test/java/io/ballerina/compiler/linter/codeactions/test/CodeActionUtils.java
+++ b/compiler/linter-plugin/src/test/java/io/ballerina/compiler/linter/codeactions/test/CodeActionUtils.java
@@ -36,7 +36,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 
 /**
@@ -46,7 +45,7 @@
  */
 public final class CodeActionUtils {
 
-    public static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    public static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
     public static final String NEW = ".new";
 
     private CodeActionUtils() {
@@ -130,10 +129,10 @@ public static List executeCodeAction(Project project, Path filePat
      */
     public static Path getProjectPath(String sourceFilePath) {
 
-        Path sourcePath = Paths.get(sourceFilePath);
+        Path sourcePath = Path.of(sourceFilePath);
         String sourceFileName = sourcePath.getFileName().toString();
         Path sourceRoot = RES_DIR.resolve(sourcePath.getParent());
-        return Paths.get(sourceRoot.toString(), sourceFileName);
+        return Path.of(sourceRoot.toString(), sourceFileName);
     }
 
     /**
diff --git a/docs/bir-spec/src/test/java/org/ballerinalang/birspec/BIRTestUtils.java b/docs/bir-spec/src/test/java/org/ballerinalang/birspec/BIRTestUtils.java
index 40b517824cb1..636262ee19af 100644
--- a/docs/bir-spec/src/test/java/org/ballerinalang/birspec/BIRTestUtils.java
+++ b/docs/bir-spec/src/test/java/org/ballerinalang/birspec/BIRTestUtils.java
@@ -42,7 +42,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -58,10 +57,10 @@
 final class BIRTestUtils {
 
     private static final String TEST_RESOURCES_ROOT = "src/test/resources/test-src";
-    private static final Path TEST_RESOURCES_ROOT_PATH = Paths.get(TEST_RESOURCES_ROOT);
+    private static final Path TEST_RESOURCES_ROOT_PATH = Path.of(TEST_RESOURCES_ROOT);
 
     private static final String LANG_LIB_TEST_SRC_ROOT = "../../langlib/langlib-test/src/test/resources/test-src";
-    private static final Path LANG_LIB_TEST_ROOT_PATH = Paths.get(LANG_LIB_TEST_SRC_ROOT);
+    private static final Path LANG_LIB_TEST_ROOT_PATH = Path.of(LANG_LIB_TEST_SRC_ROOT);
 
     private BIRTestUtils() {
     }
diff --git a/language-server/modules/langserver-commons/src/main/java/org/ballerinalang/langserver/commons/toml/common/TomlCommonUtil.java b/language-server/modules/langserver-commons/src/main/java/org/ballerinalang/langserver/commons/toml/common/TomlCommonUtil.java
index f997d5fefcc1..522ebb651441 100644
--- a/language-server/modules/langserver-commons/src/main/java/org/ballerinalang/langserver/commons/toml/common/TomlCommonUtil.java
+++ b/language-server/modules/langserver-commons/src/main/java/org/ballerinalang/langserver/commons/toml/common/TomlCommonUtil.java
@@ -19,7 +19,6 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.Optional;
 
@@ -68,7 +67,7 @@ public static String genSortText(int rank) {
      */
     public static Optional getPathFromURI(String uri) {
         try {
-            return Optional.of(Paths.get(new URL(uri).toURI()));
+            return Optional.of(Path.of(new URL(uri).toURI()));
         } catch (URISyntaxException | MalformedURLException e) {
             // ignore
         }
diff --git a/language-server/modules/langserver-commons/src/test/java/org/ballerina/langserver/commons/toml/util/FileUtils.java b/language-server/modules/langserver-commons/src/test/java/org/ballerina/langserver/commons/toml/util/FileUtils.java
index 721db6fdc08a..89ffdbdb11ad 100644
--- a/language-server/modules/langserver-commons/src/test/java/org/ballerina/langserver/commons/toml/util/FileUtils.java
+++ b/language-server/modules/langserver-commons/src/test/java/org/ballerina/langserver/commons/toml/util/FileUtils.java
@@ -25,7 +25,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * File utils for reading the file content.
@@ -36,8 +35,8 @@ public final class FileUtils {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
 
-    public static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
-    public static final Path BUILD_DIR = Paths.get("build/").toAbsolutePath();
+    public static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
+    public static final Path BUILD_DIR = Path.of("build/").toAbsolutePath();
 
     private FileUtils() {
     }
diff --git a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/common/utils/PathUtil.java b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/common/utils/PathUtil.java
index ce761bbcd6f2..5a923e4d26eb 100644
--- a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/common/utils/PathUtil.java
+++ b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/common/utils/PathUtil.java
@@ -40,7 +40,6 @@
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
@@ -71,7 +70,7 @@ public static Optional getPathFromURI(String fileUri) {
             }
             URI converted = new URI(scheme, uri.getUserInfo(), uri.getHost(), uri.getPort(),
                     uri.getPath(), uri.getQuery(), uri.getFragment());
-            return Optional.of(Paths.get(converted));
+            return Optional.of(Path.of(converted));
         } catch (URISyntaxException e) {
             return Optional.empty();
         }
@@ -86,7 +85,7 @@ public static Optional getPathFromURI(String fileUri) {
      */
     public static boolean isWriteProtectedPath(Path filePath) {
         Path homeReposPath = RepoUtils.createAndGetHomeReposPath();
-        Path ballerinaHome = CommonUtil.BALLERINA_HOME != null ? Paths.get(CommonUtil.BALLERINA_HOME) : null;
+        Path ballerinaHome = CommonUtil.BALLERINA_HOME != null ? Path.of(CommonUtil.BALLERINA_HOME) : null;
 
         return filePath.startsWith(homeReposPath) || ballerinaHome != null && filePath.startsWith(ballerinaHome);
     }
diff --git a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/connector/BallerinaConnectorService.java b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/connector/BallerinaConnectorService.java
index 2414dc48ffb8..5db480a6f29d 100644
--- a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/connector/BallerinaConnectorService.java
+++ b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/connector/BallerinaConnectorService.java
@@ -61,7 +61,6 @@
 import org.wso2.ballerinalang.util.RepoUtils;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -122,7 +121,7 @@ public CompletableFuture connectors(BallerinaCon
 
                 // Fetch local project connectors.
                 if (request.getTargetFile() != null) {
-                    Path filePath = Paths.get(request.getTargetFile());
+                    Path filePath = Path.of(request.getTargetFile());
                     List localConnectors = fetchLocalConnectors(filePath, false, request.getQuery());
                     connectorList.setLocalConnectors(localConnectors);
                 }
@@ -227,7 +226,7 @@ private Optional generateFromLocalFiles(BallerinaConnectorRequest re
         try {
             if (request.getTargetFile() != null) {
                 // Generate local connector metadata.
-                filePath = Paths.get(request.getTargetFile());
+                filePath = Path.of(request.getTargetFile());
             } else {
                 // Generate connector metadata by connector FQN.
                 filePath = resolveBalaPath(request.getOrgName(), request.getModuleName(), request.getVersion());
diff --git a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/example/BallerinaExampleService.java b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/example/BallerinaExampleService.java
index fe9f5efad1b3..ca283883bc0e 100644
--- a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/example/BallerinaExampleService.java
+++ b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/extensions/ballerina/example/BallerinaExampleService.java
@@ -34,7 +34,6 @@
 import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
@@ -63,7 +62,7 @@ public CompletableFuture list(BallerinaExampleList
         return CompletableFuture.supplyAsync(() -> {
             BallerinaExampleListResponse response = new BallerinaExampleListResponse();
             Gson gson = new Gson();
-            Path bbeJSONPath = Paths.get(CommonUtil.BALLERINA_HOME).resolve(EXAMPLES_DIR).resolve(BBE_DEF_JSON);
+            Path bbeJSONPath = Path.of(CommonUtil.BALLERINA_HOME).resolve(EXAMPLES_DIR).resolve(BBE_DEF_JSON);
             try {
                 InputStreamReader fileReader = new InputStreamReader(
                         new FileInputStream(bbeJSONPath.toFile()), StandardCharsets.UTF_8);
diff --git a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/toml/ballerinatoml/completion/BallerinaTomlCompletionExtension.java b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/toml/ballerinatoml/completion/BallerinaTomlCompletionExtension.java
index 4e8d3c9d1b50..5c8f0e64acd0 100644
--- a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/toml/ballerinatoml/completion/BallerinaTomlCompletionExtension.java
+++ b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/toml/ballerinatoml/completion/BallerinaTomlCompletionExtension.java
@@ -27,7 +27,6 @@
 
 import java.net.URI;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 
 /**
@@ -41,7 +40,7 @@ public class BallerinaTomlCompletionExtension implements TomlCompletionExtension
     @Override
     public boolean validate(CompletionParams inputParams) {
         String uri = inputParams.getTextDocument().getUri();
-        Path fileNamePath = Paths.get(URI.create(uri)).getFileName();
+        Path fileNamePath = Path.of(URI.create(uri)).getFileName();
         if (fileNamePath == null) {
             return false;
         }
diff --git a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/util/TestUtil.java b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/util/TestUtil.java
index 14ae6cb5cac4..129778c9c54e 100644
--- a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/util/TestUtil.java
+++ b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/util/TestUtil.java
@@ -101,7 +101,6 @@
 import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -668,7 +667,7 @@ public static String getWorkspaceSymbolResponse(Endpoint serviceEndpoint, String
     @Deprecated
     public static TextDocumentIdentifier getTextDocumentIdentifier(String filePath) {
         TextDocumentIdentifier identifier = new TextDocumentIdentifier();
-        identifier.setUri(Paths.get(filePath).toUri().toString());
+        identifier.setUri(Path.of(filePath).toUri().toString());
 
         return identifier;
     }
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AbstractCodeActionTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AbstractCodeActionTest.java
index 6085b7680bdd..8bc495c89869 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AbstractCodeActionTest.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AbstractCodeActionTest.java
@@ -55,7 +55,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -363,7 +362,7 @@ protected void alterExpectedUri(CodeActionData data, Path root) throws IOExcepti
             return;
         }
         String[] uriComponents = data.getFileUri().replace("\"", "").split("/");
-        Path expectedPath = Paths.get(root.toUri());
+        Path expectedPath = Path.of(root.toUri());
         for (String uriComponent : uriComponents) {
             expectedPath = expectedPath.resolve(uriComponent);
         }
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/definition/DefinitionTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/definition/DefinitionTest.java
index 86fc3a8d2627..c32c3b377f46 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/definition/DefinitionTest.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/definition/DefinitionTest.java
@@ -43,7 +43,6 @@
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test goto definition language server feature.
@@ -80,7 +79,7 @@ public void testStdLibDefinition(String configPath, String configDir) throws IOE
 
     @Test(dataProvider = "testInterStdLibDataProvider")
     public void testInterStdLibDefinition(String configPath, String configDir) throws IOException, URISyntaxException {
-        Path ballerinaHome = Paths.get(CommonUtil.BALLERINA_HOME);
+        Path ballerinaHome = Path.of(CommonUtil.BALLERINA_HOME);
         performStdLibDefinitionTest(ballerinaHome, configPath, configDir, true);
         performStdLibDefinitionTest(ballerinaHome, configPath, configDir, false);
     }
@@ -198,7 +197,7 @@ protected void alterExpectedUri(JsonArray expected, Path root) throws IOExceptio
         for (JsonElement jsonElement : expected) {
             JsonObject item = jsonElement.getAsJsonObject();
             String[] uriComponents = item.get("uri").toString().replace("\"", "").split("/");
-            Path expectedPath = Paths.get(root.toUri());
+            Path expectedPath = Path.of(root.toUri());
             for (String uriComponent : uriComponents) {
                 expectedPath = expectedPath.resolve(uriComponent);
             }
@@ -211,7 +210,7 @@ protected void alterExpectedStdlibUri(JsonArray expected) throws IOException {
         for (JsonElement jsonElement : expected) {
             JsonObject item = jsonElement.getAsJsonObject();
             String[] uriComponents = item.get("uri").toString().replace("\"", "").split("/");
-            Path expectedPath = Paths.get("build").toAbsolutePath();
+            Path expectedPath = Path.of("build").toAbsolutePath();
             for (String uriComponent : uriComponents) {
                 expectedPath = expectedPath.resolve(uriComponent);
             }
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/exprscheme/TestExpressionFileScheme.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/exprscheme/TestExpressionFileScheme.java
index 2e82bdb06db8..e3cc53c50505 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/exprscheme/TestExpressionFileScheme.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/exprscheme/TestExpressionFileScheme.java
@@ -32,7 +32,6 @@
 import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 
 /**
@@ -41,7 +40,7 @@
  * @since 2.0.0
  */
 public class TestExpressionFileScheme {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/project");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/project");
     protected Endpoint serviceEndpoint;
 
     @BeforeClass
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/extensions/document/SyntaxTreeLocateTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/extensions/document/SyntaxTreeLocateTest.java
index 79b1ffad8df5..48a0eec97441 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/extensions/document/SyntaxTreeLocateTest.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/extensions/document/SyntaxTreeLocateTest.java
@@ -16,7 +16,6 @@
 
 import java.io.FileReader;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test syntaxTreeLocate call.
@@ -25,7 +24,7 @@
 
 public class SyntaxTreeLocateTest {
     private Endpoint serviceEndpoint;
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/extensions/document/syntaxTree/locate/");
 
     private final Path mainFile = FileUtils.RES_DIR.resolve("extensions")
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/formatting/FormattingTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/formatting/FormattingTest.java
index b55dfc53d271..87c53a9cbf54 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/formatting/FormattingTest.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/formatting/FormattingTest.java
@@ -32,7 +32,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 
 /**
@@ -57,7 +56,7 @@ public void formatTestSuit() throws IOException {
         DocumentFormattingParams documentFormattingParams = new DocumentFormattingParams();
 
         TextDocumentIdentifier textDocumentIdentifier1 = new TextDocumentIdentifier();
-        textDocumentIdentifier1.setUri(Paths.get(inputFilePath.toString()).toUri().toString());
+        textDocumentIdentifier1.setUri(Path.of(inputFilePath.toString()).toUri().toString());
 
         FormattingOptions formattingOptions = new FormattingOptions();
         formattingOptions.setInsertSpaces(true);
@@ -89,7 +88,7 @@ public void formatTestSuiteWithConfigurations() throws IOException {
         DocumentFormattingParams documentFormattingParams = new DocumentFormattingParams();
 
         TextDocumentIdentifier textDocumentIdentifier1 = new TextDocumentIdentifier();
-        textDocumentIdentifier1.setUri(Paths.get(inputFilePath.toString()).toUri().toString());
+        textDocumentIdentifier1.setUri(Path.of(inputFilePath.toString()).toUri().toString());
 
         FormattingOptions formattingOptions = new FormattingOptions();
 
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rangeformat/RangeFormattingTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rangeformat/RangeFormattingTest.java
index ec97503350e7..5ea38860693d 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rangeformat/RangeFormattingTest.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rangeformat/RangeFormattingTest.java
@@ -34,7 +34,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 
 /**
@@ -62,7 +61,7 @@ public void formatTestSuit() throws IOException {
         Range range = new Range(start, end);
 
         TextDocumentIdentifier textDocumentIdentifier1 = new TextDocumentIdentifier();
-        textDocumentIdentifier1.setUri(Paths.get(inputFilePath.toString()).toUri().toString());
+        textDocumentIdentifier1.setUri(Path.of(inputFilePath.toString()).toUri().toString());
 
         FormattingOptions formattingOptions = new FormattingOptions();
         formattingOptions.setInsertSpaces(true);
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferenceTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferenceTest.java
index 5f8074be871c..aa881d2cf9d1 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferenceTest.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferenceTest.java
@@ -36,7 +36,6 @@
 import java.io.IOException;
 import java.net.URI;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test suit for testing find all references.
@@ -91,7 +90,7 @@ private void alterExpectedUri(JsonArray expected) throws IOException {
         for (JsonElement jsonElement : expected) {
             JsonObject item = jsonElement.getAsJsonObject();
             String[] uriComponents = item.get("uri").toString().replace("\"", "").split("/");
-            Path expectedPath = Paths.get(this.sourceRoot.toUri());
+            Path expectedPath = Path.of(this.sourceRoot.toUri());
             for (String uriComponent : uriComponents) {
                 expectedPath = expectedPath.resolve(uriComponent);
             }
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferencesTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferencesTest.java
index 9e48e3a4a0ed..31975e8b5474 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferencesTest.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/references/ReferencesTest.java
@@ -43,7 +43,6 @@
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test goto definition language server feature.
@@ -83,7 +82,7 @@ public void test(String configPath) throws IOException {
     
     @Test(dataProvider = "testReferencesWithinStdLibDataProvider")
     public void testReferencesWithinStdLib(String configPath) throws IOException, URISyntaxException {
-        Path ballerinaHome = Paths.get(CommonUtil.BALLERINA_HOME);
+        Path ballerinaHome = Path.of(CommonUtil.BALLERINA_HOME);
 
         JsonObject configObject = FileUtils.fileContentAsObject(configRoot.resolve(configPath).toString());
         JsonObject source = configObject.getAsJsonObject("source");
@@ -150,7 +149,7 @@ protected void alterExpectedUri(JsonArray expected, Path root) throws IOExceptio
         for (JsonElement jsonElement : expected) {
             JsonObject item = jsonElement.getAsJsonObject();
             String[] uriComponents = item.get("uri").toString().replace("\"", "").split("/");
-            Path expectedPath = Paths.get(root.toUri());
+            Path expectedPath = Path.of(root.toUri());
             for (String uriComponent : uriComponents) {
                 expectedPath = expectedPath.resolve(uriComponent);
             }
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rename/RenameTestUtil.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rename/RenameTestUtil.java
index fd586335398f..df10bfea6b4e 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rename/RenameTestUtil.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/rename/RenameTestUtil.java
@@ -22,7 +22,6 @@
 import java.io.IOException;
 import java.net.URI;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 
 /**
@@ -41,7 +40,7 @@ public static void alterExpectedUri(JsonObject expected, Path sourceRoot) throws
             JsonObject newChanges = new JsonObject();
             for (Map.Entry jEntry : expected.getAsJsonObject("changes").entrySet()) {
                 String[] uriComponents = jEntry.getKey().replace("\"", "").split("/");
-                Path expectedPath = Paths.get(sourceRoot.toUri());
+                Path expectedPath = Path.of(sourceRoot.toUri());
                 for (String uriComponent : uriComponents) {
                     expectedPath = expectedPath.resolve(uriComponent);
                 }
@@ -55,7 +54,7 @@ public static void alterExpectedUri(JsonObject expected, Path sourceRoot) throws
                 JsonObject object = new JsonObject();
                 String[] uriComponents = entry.getAsJsonObject().getAsJsonObject("textDocument").get("uri")
                         .getAsString().replace("\"", "").split("/");
-                Path expectedPath = Paths.get(sourceRoot.toUri());
+                Path expectedPath = Path.of(sourceRoot.toUri());
                 for (String uriComponent : uriComponents) {
                     expectedPath = expectedPath.resolve(uriComponent);
                 }
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/util/FileUtils.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/util/FileUtils.java
index 86bdbfe95c10..44c896624dc4 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/util/FileUtils.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/util/FileUtils.java
@@ -25,7 +25,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * File utils for reading the file content.
@@ -34,8 +33,8 @@ public final class FileUtils {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
     
-    public static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
-    public static final Path BUILD_DIR = Paths.get("build/").toAbsolutePath();
+    public static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
+    public static final Path BUILD_DIR = Path.of("build/").toAbsolutePath();
 
     private FileUtils() {
     }
diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/workspace/TestWorkspaceManager.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/workspace/TestWorkspaceManager.java
index 732211859fd9..e0773058a44a 100644
--- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/workspace/TestWorkspaceManager.java
+++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/workspace/TestWorkspaceManager.java
@@ -64,7 +64,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -84,7 +83,7 @@
  * @since 2.0.0
  */
 public class TestWorkspaceManager {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/project");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/project");
     private final String dummyContent = "function foo() {" + CommonUtil.LINE_SEPARATOR + "}";
     private final String dummyDidChangeContent = "function foo1() {" + CommonUtil.LINE_SEPARATOR + "}";
     private BallerinaWorkspaceManager workspaceManager;
diff --git a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindgenCommand.java b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindgenCommand.java
index 36e8040156f1..11651e21a2bf 100644
--- a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindgenCommand.java
+++ b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindgenCommand.java
@@ -28,7 +28,6 @@
 
 import java.io.PrintStream;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 
 import static org.ballerinalang.bindgen.utils.BindgenConstants.COMPONENT_IDENTIFIER;
@@ -45,7 +44,7 @@ public class BindgenCommand implements BLauncherCmd {
     private final PrintStream outStream;
     private final PrintStream outError;
     private final boolean exitWhenFinish;
-    private Path targetOutputPath = Paths.get(System.getProperty(USER_DIR));
+    private Path targetOutputPath = Path.of(System.getProperty(USER_DIR));
 
     public BindgenCommand() {
         this(System.out, System.err);
@@ -138,10 +137,10 @@ public void execute() {
 
         BindingsGenerator bindingsGenerator = new BindingsGenerator(outStream, outError);
         if (this.outputPath != null) {
-            if (Paths.get(outputPath).isAbsolute()) {
-                targetOutputPath = Paths.get(outputPath).normalize();
+            if (Path.of(outputPath).isAbsolute()) {
+                targetOutputPath = Path.of(outputPath).normalize();
             } else {
-                targetOutputPath = Paths.get(targetOutputPath.toString(), outputPath).normalize();
+                targetOutputPath = Path.of(targetOutputPath.toString(), outputPath).normalize();
             }
             bindingsGenerator.setOutputPath(targetOutputPath.toString());
         } else {
diff --git a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindingsGenerator.java b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindingsGenerator.java
index 85a6a5ba446d..7b84e8b75e24 100644
--- a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindingsGenerator.java
+++ b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/command/BindingsGenerator.java
@@ -33,7 +33,6 @@
 import java.net.URLClassLoader;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -65,7 +64,7 @@ public class BindingsGenerator {
     private final PrintStream errStream;
     private final PrintStream outStream;
     private Set classNames = new HashSet<>();
-    private final Path userDir = Paths.get(System.getProperty(USER_DIR));
+    private final Path userDir = Path.of(System.getProperty(USER_DIR));
 
     BindingsGenerator(PrintStream out, PrintStream err) {
         this.outStream = out;
@@ -199,10 +198,10 @@ private JvmTarget getParentDependencyJvmTarget() {
 
     private void handlePathDependency(String libPath) {
         Path libraryPath;
-        if (Paths.get(libPath).isAbsolute()) {
-            libraryPath = Paths.get(libPath);
+        if (Path.of(libPath).isAbsolute()) {
+            libraryPath = Path.of(libPath);
         } else {
-            libraryPath = Paths.get(env.getProjectRoot().toString(), libPath);
+            libraryPath = Path.of(env.getProjectRoot().toString(), libPath);
         }
         env.addClasspath(libraryPath.toString());
     }
@@ -229,14 +228,14 @@ private void setDirectoryPaths() throws BindgenException {
         String userPath = userDir.toString();
         String outputPath = env.getOutputPath();
         if (env.getModulesFlag()) {
-            userPath = Paths.get(userPath, MODULES_DIR).toString();
+            userPath = Path.of(userPath, MODULES_DIR).toString();
         } else if (outputPath != null) {
-            if (!Paths.get(outputPath).toFile().exists()) {
+            if (!Path.of(outputPath).toFile().exists()) {
                 throw new BindgenException("error: output path provided could not be found: " + outputPath);
             }
             userPath = outputPath;
         }
-        utilsDirPath = dependenciesPath = modulePath = Paths.get(userPath);
+        utilsDirPath = dependenciesPath = modulePath = Path.of(userPath);
     }
 
     private void handleFailedClassGens() {
@@ -257,11 +256,11 @@ private void generateUtilFiles() throws BindgenException {
         for (JError jError : env.getExceptionList()) {
             String fileName = jError.getShortExceptionName() + BAL_EXTENSION;
             if (env.getModulesFlag()) {
-                utilsDirStrPath = Paths.get(modulePath.toString(), jError.getPackageName()).toString();
+                utilsDirStrPath = Path.of(modulePath.toString(), jError.getPackageName()).toString();
                 createDirectory(utilsDirStrPath);
             }
             // The folder structure is flattened to address the Project API changes.
-            outputSyntaxTreeFile(jError, env, Paths.get(utilsDirStrPath, fileName).toString(), false);
+            outputSyntaxTreeFile(jError, env, Path.of(utilsDirStrPath, fileName).toString(), false);
         }
     }
 
@@ -290,11 +289,11 @@ private void generateBindings(Set classList, ClassLoader classLoader, Pa
                         JClass jClass = new JClass(classInstance, env);
                         Path filePath;
                         if (env.getModulesFlag()) {
-                            String outputFile = Paths.get(modulePath.toString(), jClass.getPackageName()).toString();
+                            String outputFile = Path.of(modulePath.toString(), jClass.getPackageName()).toString();
                             createDirectory(outputFile);
-                            filePath = Paths.get(outputFile, jClass.getShortClassName() + BAL_EXTENSION);
+                            filePath = Path.of(outputFile, jClass.getShortClassName() + BAL_EXTENSION);
                         } else {
-                            filePath = Paths.get(modulePath.toString(), jClass.getShortClassName() + BAL_EXTENSION);
+                            filePath = Path.of(modulePath.toString(), jClass.getShortClassName() + BAL_EXTENSION);
                         }
                         // Prevent the overwriting of existing class implementations with partially generated classes.
                         if (Files.exists(filePath) && !env.isDirectJavaClass()) {
diff --git a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java
index f9909fcb5077..ed423c3c4d3c 100644
--- a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java
+++ b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java
@@ -27,7 +27,6 @@
 import java.io.File;
 import java.io.InputStream;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Locale;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
@@ -45,10 +44,10 @@ public class BindgenFileGenerator {
     private SyntaxTree syntaxTree;
 
     private final BindgenEnv env;
-    private final Path classTemplatePath = Paths.get(DEFAULT_TEMPLATE_DIR, "class.bal");
-    private final Path emptyClassTemplatePath = Paths.get(DEFAULT_TEMPLATE_DIR, "empty_class.bal");
-    private final Path errorTemplatePath = Paths.get(DEFAULT_TEMPLATE_DIR, "error.bal");
-    private final Path toStringFunctionTemplatePath = Paths.get(DEFAULT_TEMPLATE_DIR, "tostring_function.bal");
+    private final Path classTemplatePath = Path.of(DEFAULT_TEMPLATE_DIR, "class.bal");
+    private final Path emptyClassTemplatePath = Path.of(DEFAULT_TEMPLATE_DIR, "empty_class.bal");
+    private final Path errorTemplatePath = Path.of(DEFAULT_TEMPLATE_DIR, "error.bal");
+    private final Path toStringFunctionTemplatePath = Path.of(DEFAULT_TEMPLATE_DIR, "tostring_function.bal");
     private static final CharSequence UNIX_FS = "/";
 
     public BindgenFileGenerator(BindgenEnv env) {
diff --git a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenMvnResolver.java b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenMvnResolver.java
index e5fa19de9197..199c9221d3aa 100644
--- a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenMvnResolver.java
+++ b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenMvnResolver.java
@@ -33,7 +33,6 @@
 import java.io.PrintStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 import java.util.regex.Pattern;
 
@@ -63,12 +62,12 @@ public void mavenResolver(String groupId, String artifactId, String version, Pat
         Path mvnRepository;
         if (projectRoot == null) {
             if (env.getOutputPath() != null) {
-                mvnRepository = Paths.get(env.getOutputPath(), TARGET_DIR, MVN_REPO);
+                mvnRepository = Path.of(env.getOutputPath(), TARGET_DIR, MVN_REPO);
             } else {
-                mvnRepository = Paths.get(System.getProperty(USER_DIR), TARGET_DIR, MVN_REPO);
+                mvnRepository = Path.of(System.getProperty(USER_DIR), TARGET_DIR, MVN_REPO);
             }
         } else {
-            mvnRepository = Paths.get(projectRoot.toString(), TARGET_DIR, MVN_REPO);
+            mvnRepository = Path.of(projectRoot.toString(), TARGET_DIR, MVN_REPO);
         }
         Dependency dependency = resolveDependency(groupId, artifactId, version, mvnRepository.toString());
         handleDependency(groupId, artifactId, version, mvnRepository.toString(), projectRoot, null, parentJvmTarget);
@@ -106,10 +105,10 @@ private static Dependency resolveDependency(String groupId, String artifactId, S
 
     private void handleDependency(String groupId, String artifactId, String version, String mvnRepository,
                                   Path projectRoot, String parent, JvmTarget parentJvmTarget) throws BindgenException {
-        Path mvnPath = Paths.get(mvnRepository, getPathFromGroupId(groupId), artifactId, version);
+        Path mvnPath = Path.of(mvnRepository, getPathFromGroupId(groupId), artifactId, version);
         this.env.addClasspath(mvnPath.toString());
         if (projectRoot != null) {
-            File tomlFile = new File(Paths.get(projectRoot.toString(), ProjectConstants.BALLERINA_TOML).toString());
+            File tomlFile = new File(Path.of(projectRoot.toString(), ProjectConstants.BALLERINA_TOML).toString());
             if (tomlFile.exists() && !tomlFile.isDirectory()) {
                 populateBallerinaToml(groupId, artifactId, version, tomlFile, projectRoot, parent, parentJvmTarget);
             }
@@ -181,7 +180,7 @@ private static String getPathFromGroupId(String groupId) {
 
     private static String getModuleName(Path projectRoot, String outputPath) {
         if (outputPath == null) {
-            outputPath = Paths.get(System.getProperty(USER_DIR)).toString();
+            outputPath = Path.of(System.getProperty(USER_DIR)).toString();
         }
         String splitRegex = Pattern.quote(System.getProperty(FILE_SEPARATOR));
         String[] splittedPath = outputPath.split(splitRegex);
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenCommandTest.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenCommandTest.java
index 730ff7b963bf..22109abcd95a 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenCommandTest.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenCommandTest.java
@@ -33,7 +33,6 @@
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -57,7 +56,7 @@ public void setup() throws IOException {
             this.testResources = super.tmpDir.resolve("build-test-resources");
             URI testResourcesURI = Objects.requireNonNull(getClass().getClassLoader()
                     .getResource("mvn-test-resources")).toURI();
-            Files.walkFileTree(Paths.get(testResourcesURI), new BindgenCommandTest.Copy(Paths.get(testResourcesURI),
+            Files.walkFileTree(Path.of(testResourcesURI), new BindgenCommandTest.Copy(Path.of(testResourcesURI),
                     this.testResources));
         } catch (URISyntaxException e) {
             Assert.fail("error loading resources");
@@ -67,7 +66,7 @@ public void setup() throws IOException {
     @Test(description = "Test whether the bindgen tool loads the existing platform libraries " +
             "specified in the Ballerina.toml file")
     public void testExistingPlatformLibraries() throws IOException, MavenResolverException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         System.setProperty("user.dir", projectDir);
         String[] args = {"java.lang.Object", "org.apache.log4j.Logger"};
 
@@ -92,9 +91,9 @@ public void testExistingPlatformLibraries() throws IOException, MavenResolverExc
 
     @Test(description = "Test if the correct error is given for incorrect classpaths")
     public void testIncorrectClasspath() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
-        String incorrectJarPath = Paths.get("./incorrect.jar").toString();
-        String invalidDirPath = Paths.get("/User/invalidDir").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
+        String incorrectJarPath = Path.of("./incorrect.jar").toString();
+        String invalidDirPath = Path.of("/User/invalidDir").toString();
         String[] args = {"-cp=" + incorrectJarPath + ", test.txt, " + invalidDirPath, "-o=" +
                 projectDir, "java.lang.Object"};
 
@@ -111,7 +110,7 @@ public void testIncorrectClasspath() throws IOException {
 
     @Test(description = "Test if the correct error is given for incorrect maven option value")
     public void testIncorrectMavenLibrary() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         String[] args = {"-mvn=org.yaml.snakeyaml.2.0", "-o=" + projectDir, "java.lang.Object"};
 
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
@@ -124,7 +123,7 @@ public void testIncorrectMavenLibrary() throws IOException {
 
     @Test(description = "Test if the correct error is given for an incorrect output path")
     public void testOutputPath() throws IOException {
-        String incorrectPath = Paths.get("./incorrect").toString();
+        String incorrectPath = Path.of("./incorrect").toString();
         String[] args = {"-o=" + incorrectPath, "java.lang.Object"};
 
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
@@ -138,7 +137,7 @@ public void testOutputPath() throws IOException {
 
     @Test(description = "Test a scenario where the output path resides inside a project")
     public void testOutputPathInsideProject() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject", "tests").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject", "tests").toString();
         System.setProperty("user.dir", projectDir);
         String[] args = {"java.lang.String"};
 
@@ -148,21 +147,21 @@ public void testOutputPathInsideProject() throws IOException {
         bindgenCommand.execute();
         String output = readOutput(true);
         Assert.assertTrue(output.contains("Ballerina package detected at: "));
-        File file = new File(Paths.get(testResources.toString(), "balProject", "modules", "java.lang",
+        File file = new File(Path.of(testResources.toString(), "balProject", "modules", "java.lang",
                 "String.bal").toString());
         Assert.assertTrue(file.exists());
     }
 
     @Test(description = "Test if the directory flag works as expected for generating bindings inside a project")
     public void testDirectoryFlagInsideProject() {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         String[] args = {"-o=" + projectDir, "java.lang.Object"};
 
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand).parseArgs(args);
 
         bindgenCommand.execute();
-        File file = new File(Paths.get(projectDir, "Object.bal").toString());
+        File file = new File(Path.of(projectDir, "Object.bal").toString());
         Assert.assertTrue(file.exists());
     }
 
@@ -174,13 +173,13 @@ public void testDirectoryFlagOutsideProject() {
         new CommandLine(bindgenCommand).parseArgs(args);
 
         bindgenCommand.execute();
-        File file = new File(Paths.get(testResources.toString(), "Object.bal").toString());
+        File file = new File(Path.of(testResources.toString(), "Object.bal").toString());
         Assert.assertTrue(file.exists());
     }
 
     @Test(description = "Test if the correct error is given when no class names are provided")
     public void testNoClassNames() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         String[] args = {"-o=" + projectDir};
 
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
@@ -195,7 +194,7 @@ public void testNoClassNames() throws IOException {
             "module level mappings outside a ballerina project")
     public void testModuleMappingsWithoutProject() throws IOException {
         String[] args = {"java.lang.Object"};
-        String projectDir = Paths.get(testResources.toString()).toString();
+        String projectDir = Path.of(testResources.toString()).toString();
         System.setProperty("user.dir", projectDir);
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand).parseArgs(args);
@@ -207,7 +206,7 @@ public void testModuleMappingsWithoutProject() throws IOException {
 
     @Test(description = "Test if the correct error is given for invalid class names")
     public void testInvalidClassNames() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         System.setProperty("user.dir", projectDir);
         String[] args = {"java.lang.Objec", "java.lang.Apple", "java.lang.String"};
 
@@ -224,7 +223,7 @@ public void testInvalidClassNames() throws IOException {
 
     @Test(description = "Test if the correct error is given for failed method generations")
     public void testFailedMethodGenerations() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         System.setProperty("user.dir", projectDir);
         String[] args = {"org.ballerinalang.bindgen.MethodsTestResource", "java.invalid.Class"};
 
@@ -243,13 +242,13 @@ public void testFailedMethodGenerations() throws IOException {
 
     @Test(description = "Test if the correct error is given for a failure in the project loading")
     public void testFailedProjectLoad() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         System.setProperty("user.dir", projectDir);
         String[] args = {"java.lang.Object"};
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand).parseArgs(args);
 
-        File file = new File(Paths.get(projectDir, "Ballerina.toml").toString());
+        File file = new File(Path.of(projectDir, "Ballerina.toml").toString());
         if (file.exists()) {
             boolean success = file.setReadable(false);
             if (success) {
@@ -264,7 +263,7 @@ public void testFailedProjectLoad() throws IOException {
 
     @Test(description = "Test if the correct error is given for a failure in the writing bal files")
     public void testFileWriteFailure() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject", "tests").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject", "tests").toString();
         String[] args = {"-o=" + projectDir, "java.lang.Object"};
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand).parseArgs(args);
@@ -284,14 +283,14 @@ public void testFileWriteFailure() throws IOException {
 
     @Test(description = "Test to make sure only complete class implementations are not replaced by empty bindings")
     public void testOverwriting() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
 
         // Scenario 1: ensure that complete implementations are not replaced by empty bindings
         String[] args1 = {"-o" + projectDir, "java.io.FileInputStream"};
         BindgenCommand bindgenCommand1 = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand1).parseArgs(args1);
         bindgenCommand1.execute();
-        String balFileContent1 = Files.readString(Paths.get(projectDir, "File.bal"));
+        String balFileContent1 = Files.readString(Path.of(projectDir, "File.bal"));
         Assert.assertFalse(balFileContent1.contains("This is an empty Ballerina class autogenerated to represent " +
                 "the `java.io.File` Java class."));
 
@@ -300,14 +299,14 @@ public void testOverwriting() throws IOException {
         BindgenCommand bindgenCommand2 = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand2).parseArgs(args2);
         bindgenCommand2.execute();
-        String balFileContent2 = Files.readString(Paths.get(projectDir, "File.bal"));
+        String balFileContent2 = Files.readString(Path.of(projectDir, "File.bal"));
         Assert.assertTrue(balFileContent2.contains("The function that maps to the `compareTo` method " +
                 "of `java.io.File`."));
     }
 
     @Test(description = "Test whether the bindgen tool generates the complete implementation of super classes")
     public void testGenerationOfSuperClasses() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         System.setProperty("user.dir", projectDir);
         String[] args = {"java.util.HashMap", "java.util.ArrayList"};
 
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalParamTypesTest.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalParamTypesTest.java
index 671ca3414067..d18f65fbb607 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalParamTypesTest.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalParamTypesTest.java
@@ -23,7 +23,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Unit tests to validate the Ballerina syntax tree generated by the tool, when the optional parameter types flag is
@@ -35,11 +35,7 @@ public class BindgenOptionalParamTypesTest extends BindgenUnitBaseTest {
 
     public BindgenOptionalParamTypesTest() {
         this.withOptionalParamTypes = true;
-        this.resourceDirectory = Paths.get("src")
-                .resolve("test")
-                .resolve("resources")
-                .resolve("unit-test-resources")
-                .resolve("withOptionalParamTypes")
+        this.resourceDirectory = Path.of("src/test/resources/unit-test-resources/withOptionalParamTypes")
                 .toAbsolutePath();
     }
 
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalReturnTypesTest.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalReturnTypesTest.java
index a29f80c6f265..82d9fee2beb7 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalReturnTypesTest.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalReturnTypesTest.java
@@ -23,7 +23,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Unit tests to validate the Ballerina syntax tree generated by the tool, when the optional return types flag is
@@ -35,11 +35,7 @@ public class BindgenOptionalReturnTypesTest extends BindgenUnitBaseTest {
 
     public BindgenOptionalReturnTypesTest() {
         this.withOptionalReturnTypes = true;
-        this.resourceDirectory = Paths.get("src")
-                .resolve("test")
-                .resolve("resources")
-                .resolve("unit-test-resources")
-                .resolve("withOptionalReturnTypes")
+        this.resourceDirectory = Path.of("src/test/resources/unit-test-resources/withOptionalReturnTypes")
                 .toAbsolutePath();
     }
 
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalTypesTest.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalTypesTest.java
index fca609639ebf..46797bbf0a64 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalTypesTest.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenOptionalTypesTest.java
@@ -23,7 +23,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Unit tests to validate the Ballerina syntax tree generated by the tool, when the optional types flag is enabled.
@@ -35,11 +35,7 @@ public class BindgenOptionalTypesTest extends BindgenUnitBaseTest {
     public BindgenOptionalTypesTest() {
         this.withOptionalParamTypes = true;
         this.withOptionalReturnTypes = true;
-        this.resourceDirectory = Paths.get("src")
-                .resolve("test")
-                .resolve("resources")
-                .resolve("unit-test-resources")
-                .resolve("withOptionalTypes")
+        this.resourceDirectory = Path.of("src/test/resources/unit-test-resources/withOptionalTypes")
                 .toAbsolutePath();
     }
 
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java
index 2e1c7c18646e..987324147474 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Base class to test the Ballerina syntax tree generated by the tool.
@@ -41,14 +40,14 @@ public class BindgenUnitBaseTest {
 
     protected boolean withOptionalParamTypes = false;
     protected boolean withOptionalReturnTypes = false;
-    protected Path resourceDirectory = Paths.get("src").resolve("test").resolve("resources")
+    protected Path resourceDirectory = Path.of("src").resolve("test").resolve("resources")
             .resolve("unit-test-resources").toAbsolutePath();
 
     /**
      * Test the constructor bindings generated.
      */
     public void constructorMapping() throws FormatterException, ClassNotFoundException, BindgenException, IOException {
-        Path constructorFilePath = Paths.get(resourceDirectory.toString(), "constructors.bal");
+        Path constructorFilePath = Path.of(resourceDirectory.toString(), "constructors.bal");
         String constructors = Files.readString(resourceDirectory.resolve(constructorFilePath));
         SyntaxTree cSyntaxTree = getBindingsGenerator().generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("org.ballerinalang.bindgen.ConstructorsTestResource"), getBindgenEnv()));
@@ -60,7 +59,7 @@ public void constructorMapping() throws FormatterException, ClassNotFoundExcepti
      * Test the method bindings generated, includes scenarios for static and instance fields.
      */
     public void methodMapping() throws FormatterException, ClassNotFoundException, BindgenException, IOException {
-        Path methodFilePath = Paths.get(resourceDirectory.toString(), "methods.bal");
+        Path methodFilePath = Path.of(resourceDirectory.toString(), "methods.bal");
         String methods = Files.readString(resourceDirectory.resolve(methodFilePath));
         SyntaxTree mSyntaxTree = getBindingsGenerator().generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("org.ballerinalang.bindgen.MethodsTestResource"), getBindgenEnv()));
@@ -72,7 +71,7 @@ public void methodMapping() throws FormatterException, ClassNotFoundException, B
      * Test the field bindings generated, includes scenarios for static and instance fields.
      */
     public void fieldMapping() throws FormatterException, ClassNotFoundException, BindgenException, IOException {
-        Path fieldFilePath = Paths.get(resourceDirectory.toString(), "fields.bal");
+        Path fieldFilePath = Path.of(resourceDirectory.toString(), "fields.bal");
         String fields = Files.readString(resourceDirectory.resolve(fieldFilePath));
         SyntaxTree fSyntaxTree = getBindingsGenerator().generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("org.ballerinalang.bindgen.FieldsTestResource"), getBindgenEnv()));
@@ -84,7 +83,7 @@ public void fieldMapping() throws FormatterException, ClassNotFoundException, Bi
      * Test the error bindings generated for a throwable.
      */
     public void errorMapping() throws FormatterException, ClassNotFoundException, BindgenException, IOException {
-        Path errorFilePath = Paths.get(resourceDirectory.toString(), "error.bal");
+        Path errorFilePath = Path.of(resourceDirectory.toString(), "error.bal");
         String error = Files.readString(resourceDirectory.resolve(errorFilePath));
         SyntaxTree eSyntaxTree = getBindingsGenerator().generate(new JError(this.getClass().getClassLoader()
                 .loadClass("java.io.IOException")));
@@ -96,7 +95,7 @@ public void errorMapping() throws FormatterException, ClassNotFoundException, Bi
      * Test the bindings generated for Java inner classes.
      */
     public void innerClassMapping() throws FormatterException, ClassNotFoundException, BindgenException, IOException {
-        Path innerClassFilePath = Paths.get(resourceDirectory.toString(), "innerClass.bal");
+        Path innerClassFilePath = Path.of(resourceDirectory.toString(), "innerClass.bal");
         String innerClass = Files.readString(resourceDirectory.resolve(innerClassFilePath));
         SyntaxTree iSyntaxTree = getBindingsGenerator().generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("java.lang.Character$Subset"), getBindgenEnv()));
@@ -109,7 +108,7 @@ public void innerClassMapping() throws FormatterException, ClassNotFoundExceptio
      */
     public void abstractClassMapping() throws FormatterException, ClassNotFoundException,
             BindgenException, IOException {
-        Path constructorFilePath = Paths.get(resourceDirectory.toString(), "abstractClass.bal");
+        Path constructorFilePath = Path.of(resourceDirectory.toString(), "abstractClass.bal");
         String constructors = Files.readString(resourceDirectory.resolve(constructorFilePath));
         SyntaxTree cSyntaxTree = getBindingsGenerator().generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("org.ballerinalang.bindgen.AbstractTestResource"), getBindgenEnv()));
@@ -128,7 +127,7 @@ public void moduleLevelMapping1() throws FormatterException, ClassNotFoundExcept
         moduleBindgenEnv.setPublicFlag(true);
         BindgenFileGenerator moduleBindingsGenerator = new BindgenFileGenerator(moduleBindgenEnv);
 
-        Path moduleMappingPath = Paths.get(resourceDirectory.toString(), "moduleMapping1.bal");
+        Path moduleMappingPath = Path.of(resourceDirectory.toString(), "moduleMapping1.bal");
         String moduleMappingValue = Files.readString(resourceDirectory.resolve(moduleMappingPath));
         SyntaxTree moduleSyntaxTree = moduleBindingsGenerator.generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("java.io.FileInputStream"), moduleBindgenEnv));
@@ -147,7 +146,7 @@ public void moduleLevelMapping2() throws FormatterException, ClassNotFoundExcept
         moduleBindgenEnv.setPublicFlag(true);
         BindgenFileGenerator moduleBindingsGenerator = new BindgenFileGenerator(moduleBindgenEnv);
 
-        Path moduleMappingPath = Paths.get(resourceDirectory.toString(), "moduleMapping2.bal");
+        Path moduleMappingPath = Path.of(resourceDirectory.toString(), "moduleMapping2.bal");
         String moduleMappingValue = Files.readString(resourceDirectory.resolve(moduleMappingPath));
         SyntaxTree moduleSyntaxTree = moduleBindingsGenerator.generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("org.ballerinalang.bindgen.ModuleMappingTest"), moduleBindgenEnv));
@@ -164,7 +163,7 @@ public void dependentClassMapping() throws FormatterException, ClassNotFoundExce
         bindgenEnv.setDirectJavaClass(false);
         BindgenFileGenerator bindingsGenerator = new BindgenFileGenerator(bindgenEnv);
 
-        Path assertFilePath = Paths.get(resourceDirectory.toString(), "dependentClass.bal");
+        Path assertFilePath = Path.of(resourceDirectory.toString(), "dependentClass.bal");
         String assertValue = Files.readString(resourceDirectory.resolve(assertFilePath));
         SyntaxTree syntaxTree = bindingsGenerator.generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("java.lang.String"), bindgenEnv));
@@ -179,7 +178,7 @@ public void directThrowableMapping() throws FormatterException, ClassNotFoundExc
             BindgenException, IOException {
         BindgenEnv throwableBindgenEnv = getBindgenEnv();
         BindgenFileGenerator throwableBindingsGenerator = new BindgenFileGenerator(throwableBindgenEnv);
-        Path throwableMappingPath = Paths.get(resourceDirectory.toString(), "throwableMapping.bal");
+        Path throwableMappingPath = Path.of(resourceDirectory.toString(), "throwableMapping.bal");
         String throwableMappingValue = Files.readString(resourceDirectory.resolve(throwableMappingPath));
         SyntaxTree throwableSyntaxTree = throwableBindingsGenerator.generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("java.io.IOException"), throwableBindgenEnv));
@@ -197,7 +196,7 @@ public void dependentInnerClassMapping() throws FormatterException, ClassNotFoun
         bindgenEnv.setDirectJavaClass(false);
         BindgenFileGenerator bindingsGenerator = new BindgenFileGenerator(bindgenEnv);
 
-        Path assertFilePath = Paths.get(resourceDirectory.toString(), "innerDependentClass.bal");
+        Path assertFilePath = Path.of(resourceDirectory.toString(), "innerDependentClass.bal");
         String assertValue = Files.readString(resourceDirectory.resolve(assertFilePath));
         SyntaxTree syntaxTree = bindingsGenerator.generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("java.lang.Character$Subset"), bindgenEnv));
@@ -216,7 +215,7 @@ public void interfaceMapping() throws FormatterException, ClassNotFoundException
         interfaceBindgenEnv.setPublicFlag(true);
         BindgenFileGenerator interfaceBindingsGenerator = new BindgenFileGenerator(interfaceBindgenEnv);
 
-        Path interfacePath = Paths.get(resourceDirectory.toString(), "interfaceMapping.bal");
+        Path interfacePath = Path.of(resourceDirectory.toString(), "interfaceMapping.bal");
         String interfaceValue = Files.readString(resourceDirectory.resolve(interfacePath));
         SyntaxTree interfaceSyntaxTree = interfaceBindingsGenerator.generate(new JClass(this.getClass().getClassLoader()
                 .loadClass("org.ballerinalang.bindgen.InterfaceTestResource"), interfaceBindgenEnv));
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/FieldsTestResource.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/FieldsTestResource.java
index 7a706ea35194..b184b86acd80 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/FieldsTestResource.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/FieldsTestResource.java
@@ -20,7 +20,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -64,14 +63,14 @@ public class FieldsTestResource implements InterfaceTestResource {
     public Object[] getInstanceObjectMultiArray2 = new Object[2];
     public List getInstanceInterface = new ArrayList<>();
     public AbstractList getInstanceAbstractClass = new ArrayList<>();
-    public Path getInstanceObject = Paths.get("/test.txt");
+    public Path getInstanceObject = Path.of("/test.txt");
     public Set getInstanceGenericObject = new HashSet<>();
     public System.Logger.Level getInstanceEnumeration = System.Logger.Level.ALL;
     public ArithmeticException getInstanceThrowable = new ArithmeticException();
 
     // Different access modifiers in instance fields
     private short getInstancePrivateField = 2;
-    protected Path getInstanceProtectedField = Paths.get("/test.txt");
+    protected Path getInstanceProtectedField = Path.of("/test.txt");
     int getInstanceDefaultField = 3;
 
     // Static primitive fields
@@ -113,14 +112,14 @@ public class FieldsTestResource implements InterfaceTestResource {
     public Object[] getStaticObjectMultiArray2 = new Object[2];
     public static List getStaticInterface = new ArrayList<>();
     public static AbstractList getStaticAbstractClass = new ArrayList<>();
-    public static Path getStaticObject = Paths.get("/test.txt");
+    public static Path getStaticObject = Path.of("/test.txt");
     public static Set getStaticGenericObject = new HashSet<>();
     public static System.Logger.Level getStaticEnumeration = System.Logger.Level.ALL;
     public static ArithmeticException getStaticThrowable = new ArithmeticException();
 
     // Different access modifiers in static fields
     private static short getStaticPrivateField = 2;
-    protected static Path getStaticProtectedField = Paths.get("/test.txt");
+    protected static Path getStaticProtectedField = Path.of("/test.txt");
     static int getStaticDefaultField = 3;
 
     @Override
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/MavenSupportTest.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/MavenSupportTest.java
index 861e9685da8b..da54a7bf6523 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/MavenSupportTest.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/MavenSupportTest.java
@@ -32,7 +32,6 @@
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -55,7 +54,7 @@ public void setup() throws IOException {
             this.testResources = super.tmpDir.resolve("build-test-resources");
             URI testResourcesURI = Objects.requireNonNull(getClass().getClassLoader()
                     .getResource("mvn-test-resources")).toURI();
-            Files.walkFileTree(Paths.get(testResourcesURI), new MavenSupportTest.Copy(Paths.get(testResourcesURI),
+            Files.walkFileTree(Path.of(testResourcesURI), new MavenSupportTest.Copy(Path.of(testResourcesURI),
                     this.testResources));
         } catch (URISyntaxException e) {
             Assert.fail("error loading resources");
@@ -64,8 +63,8 @@ public void setup() throws IOException {
 
     @Test(description = "Test the maven support in the Bindgen tool inside a project")
     public void testBindgenMvnCmd() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
-        Path mavenRepoPath = Paths.get(projectDir, "target", "platform-libs");
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
+        Path mavenRepoPath = Path.of(projectDir, "target", "platform-libs");
         String jarName = "snakeyaml-2.0.jar";
         String[] args = {"-mvn=org.yaml:snakeyaml:2.0", "-o=" + projectDir, "org.yaml.snakeyaml.Yaml"};
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
@@ -82,41 +81,41 @@ public void testBindgenMvnCmd() throws IOException {
 
     @Test(description = "Test the maven support in the Bindgen tool to see if the Ballerina.toml is updated")
     public void testBindgenMvnToml() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         String[] args = {"-mvn=commons-logging:commons-logging:1.1.1", "-o=" + projectDir,
                 "org.apache.commons.logging.LogFactory"};
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand).parseArgs(args);
 
         bindgenCommand.execute();
-        Assert.assertTrue(isTomlUpdated(Paths.get(projectDir, "Ballerina.toml").toString(),
-                Paths.get(testResources.toString(), "assert-files", "Ballerina.toml").toString()));
+        Assert.assertTrue(isTomlUpdated(Path.of(projectDir, "Ballerina.toml").toString(),
+                Path.of(testResources.toString(), "assert-files", "Ballerina.toml").toString()));
     }
 
     @Test(description = "Test the maven support with multiple java platforms in the Bindgen tool to see if the " +
             "Ballerina.toml is updated")
     public void testBindgenMvnTomlMultipleJavaPlatforms() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "multipleJavaPlatformsBalProject").toString();
+        String projectDir = Path.of(testResources.toString(), "multipleJavaPlatformsBalProject").toString();
         String[] args = {"-mvn=commons-logging:commons-logging:1.1.1", "-o=" + projectDir,
                 "org.apache.commons.logging.LogFactory"};
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand).parseArgs(args);
 
         bindgenCommand.execute();
-        Assert.assertTrue(isTomlUpdated(Paths.get(projectDir, "Ballerina.toml").toString(),
-                Paths.get(testResources.toString(), "assert-files", "MultipleJavaPlatformsBallerina.toml").toString()));
+        Assert.assertTrue(isTomlUpdated(Path.of(projectDir, "Ballerina.toml").toString(),
+                Path.of(testResources.toString(), "assert-files", "MultipleJavaPlatformsBallerina.toml").toString()));
     }
 
     @Test(description = "Test the error given for a maven library that is unavailable")
     public void testUnavailableMvnLibrary() throws IOException {
-        String projectDir = Paths.get(testResources.toString(), "balProject").toString();
+        String projectDir = Path.of(testResources.toString(), "balProject").toString();
         String[] args = {"-mvn=org.yamls:snakeyaml:2.0", "-o=" + projectDir, "org.yaml.snakeyaml.Yaml"};
         BindgenCommand bindgenCommand = new BindgenCommand(printStream, printStream, false);
         new CommandLine(bindgenCommand).parseArgs(args);
 
         bindgenCommand.execute();
         String output = readOutput(true);
-        String tomlContent = Files.readString(Paths.get(projectDir, "Ballerina.toml"));
+        String tomlContent = Files.readString(Path.of(projectDir, "Ballerina.toml"));
         Assert.assertFalse(tomlContent.contains("yamls"));
         Assert.assertTrue(output.contains("error: unable to resolve the maven dependency: Could not " +
                 "find artifact org.yamls:snakeyaml:jar:2.0 in central"));
diff --git a/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/FileUtils.java b/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/FileUtils.java
index 62adb7de8d84..97d7dbb150ab 100644
--- a/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/FileUtils.java
+++ b/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/FileUtils.java
@@ -25,7 +25,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * File utils for reading the file content.
@@ -34,7 +33,7 @@ public final class FileUtils {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
 
-    public static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    public static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
 
     private FileUtils() {
     }
diff --git a/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/TestUtil.java b/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/TestUtil.java
index 89751f437ae0..3191b210a610 100644
--- a/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/TestUtil.java
+++ b/misc/ballerinalang-data-mapper/src/test/java/org/ballerinalang/datamapper/util/TestUtil.java
@@ -56,7 +56,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -177,7 +176,7 @@ public static void shutdownLanguageServer(Endpoint serviceEndpoint) {
 
     public static TextDocumentIdentifier getTextDocumentIdentifier(String filePath) {
         TextDocumentIdentifier identifier = new TextDocumentIdentifier();
-        identifier.setUri(Paths.get(filePath).toUri().toString());
+        identifier.setUri(Path.of(filePath).toUri().toString());
 
         return identifier;
     }
diff --git a/misc/compiler-plugins/modules/configurable-schema-generator/src/main/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTask.java b/misc/compiler-plugins/modules/configurable-schema-generator/src/main/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTask.java
index a6028e48f49a..5d49f203999e 100644
--- a/misc/compiler-plugins/modules/configurable-schema-generator/src/main/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTask.java
+++ b/misc/compiler-plugins/modules/configurable-schema-generator/src/main/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTask.java
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collections;
 
 /**
@@ -59,7 +58,7 @@ public void perform(CompilationAnalysisContext compilationAnalysisContext) {
     private void writeConfigJSONSchema(String schema, Project project) {
         Path path;
         if (project.kind().equals(ProjectKind.SINGLE_FILE_PROJECT)) {
-            path = Paths.get(System.getProperty("user.dir"));
+            path = Path.of(System.getProperty("user.dir"));
         } else {
             path = project.targetDir().resolve(ProjectConstants.BIN_DIR_NAME);
         }
diff --git a/misc/compiler-plugins/modules/configurable-schema-generator/src/test/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTaskTest.java b/misc/compiler-plugins/modules/configurable-schema-generator/src/test/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTaskTest.java
index 70dc760ce65e..b57c5853facb 100644
--- a/misc/compiler-plugins/modules/configurable-schema-generator/src/test/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTaskTest.java
+++ b/misc/compiler-plugins/modules/configurable-schema-generator/src/test/java/org/ballerinalang/config/schema/generator/ConfigSchemaGenTaskTest.java
@@ -36,7 +36,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import static io.ballerina.projects.util.ProjectConstants.CONFIGURATION_TOML;
 
@@ -45,7 +44,7 @@
  */
 public class ConfigSchemaGenTaskTest {
 
-    private static final Path RESOURCES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    private static final Path RESOURCES_DIR = Path.of("src/test/resources/").toAbsolutePath();
 
     @Test(dataProvider = "project-data-provider")
     public void testAgainstToml(String projectType, String projectName, boolean isSingleFileProject) {
@@ -116,7 +115,7 @@ static Project loadBuildProject(Path projectPath, boolean isSingleFileProject) {
     private String readConfigJSONSchema(Path path, boolean isSingleFileProject) {
         Path targetPath;
         if (isSingleFileProject) {
-            targetPath = Paths.get(System.getProperty("user.dir"));
+            targetPath = Path.of(System.getProperty("user.dir"));
         } else {
             targetPath = path.resolve(ProjectConstants.TARGET_DIR_NAME).resolve(ProjectConstants.BIN_DIR_NAME);
         }
diff --git a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/DebugProjectCache.java b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/DebugProjectCache.java
index 4401e3d7417c..62421f940571 100644
--- a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/DebugProjectCache.java
+++ b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/DebugProjectCache.java
@@ -24,7 +24,6 @@
 import io.ballerina.projects.directory.SingleFileProject;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -76,7 +75,7 @@ public void addProject(Project project) {
      * @param filePath file path of the open/active editor instance in the plugin side.
      */
     private static Project loadProject(String filePath) {
-        Map.Entry projectKindAndProjectRootPair = computeProjectKindAndRoot(Paths.get(filePath));
+        Map.Entry projectKindAndProjectRootPair = computeProjectKindAndRoot(Path.of(filePath));
         ProjectKind projectKind = projectKindAndProjectRootPair.getKey();
         Path projectRoot = projectKindAndProjectRootPair.getValue();
         BuildOptions options = BuildOptions.builder().setOffline(true).build();
diff --git a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BPackageRunner.java b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BPackageRunner.java
index bcde59722783..82a93371a987 100644
--- a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BPackageRunner.java
+++ b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BPackageRunner.java
@@ -19,7 +19,7 @@
 
 import org.ballerinalang.debugadapter.config.ClientLaunchConfigHolder;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Map;
 
 /**
@@ -35,7 +35,7 @@ public BPackageRunner(ClientLaunchConfigHolder configHolder, String projectRoot)
     public Process start() throws Exception {
         ProcessBuilder processBuilder = new ProcessBuilder();
         processBuilder.command(getBallerinaCommand(null));
-        processBuilder.directory(Paths.get(projectRoot).toFile());
+        processBuilder.directory(Path.of(projectRoot).toFile());
 
         Map env = processBuilder.environment();
         // Need to ignore the "BAL_JAVA_DEBUG" env variable, as otherwise the program compiler will also run in debug
diff --git a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BSingleFileRunner.java b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BSingleFileRunner.java
index 7697add0fefb..ec463b98e7b5 100644
--- a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BSingleFileRunner.java
+++ b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/runner/BSingleFileRunner.java
@@ -20,7 +20,6 @@
 import org.ballerinalang.debugadapter.config.ClientLaunchConfigHolder;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 
 /**
@@ -38,7 +37,7 @@ public Process start() throws Exception {
         String balFilePath = configHolder.getSourcePath();
         processBuilder.command(getBallerinaCommand(balFilePath));
 
-        Path singleFileRoot = Paths.get(projectRoot).getParent();
+        Path singleFileRoot = Path.of(projectRoot).getParent();
         if (singleFileRoot != null) {
             processBuilder.directory(singleFileRoot.toFile());
         }
diff --git a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/PackageUtils.java b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/PackageUtils.java
index 1da8dbe1defc..7b127501a7f8 100644
--- a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/PackageUtils.java
+++ b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/PackageUtils.java
@@ -37,7 +37,6 @@
 import java.nio.file.Files;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.List;
@@ -298,7 +297,7 @@ public static URI covertToBalaUri(URI fileUri) throws URISyntaxException, Illega
     private static Optional getPathFromURI(String fileUri) {
         try {
             if (isValidPath(fileUri)) {
-                return Optional.of(Paths.get(fileUri).normalize());
+                return Optional.of(Path.of(fileUri).normalize());
             }
 
             URI uri = URI.create(fileUri);
@@ -307,7 +306,7 @@ private static Optional getPathFromURI(String fileUri) {
                 scheme = URI_SCHEME_FILE;
             }
             URI converted = new URI(scheme, uri.getHost(), uri.getPath(), uri.getFragment());
-            return Optional.of(Paths.get(converted).normalize());
+            return Optional.of(Path.of(converted).normalize());
         } catch (URISyntaxException e) {
             return Optional.empty();
         }
@@ -321,7 +320,7 @@ private static boolean isValidPath(String path) {
             return false;
         }
         try {
-            Paths.get(path);
+            Path.of(path);
         } catch (InvalidPathException ex) {
             return false;
         }
diff --git a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/ProjectSourceResolver.java b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/ProjectSourceResolver.java
index c4f0371be76d..7175a72746da 100644
--- a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/ProjectSourceResolver.java
+++ b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/utils/ProjectSourceResolver.java
@@ -25,7 +25,6 @@
 
 import java.io.File;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Optional;
 
 import static io.ballerina.identifier.Utils.decodeIdentifier;
@@ -75,7 +74,7 @@ public Optional resolve(Location location) {
                 if (!document.name().equals(location.sourcePath()) || !document.name().equals(location.sourceName())) {
                     return Optional.empty();
                 }
-                return Optional.of(Paths.get(projectRoot));
+                return Optional.of(Path.of(projectRoot));
             } else if (sourceProject.kind() == ProjectKind.BUILD_PROJECT) {
                 String projectOrg = getOrgName(sourceProject);
                 String defaultModuleName = getDefaultModuleName(sourceProject);
@@ -95,28 +94,28 @@ public Optional resolve(Location location) {
                 if (modulePart.isBlank()) {
                     // default module
                     // 1. check and return if there's a user module source matching to the location information.
-                    File moduleFile = Paths.get(projectRoot, locationName).toFile();
+                    File moduleFile = Path.of(projectRoot, locationName).toFile();
                     if (moduleFile.isFile()) {
                         return Optional.of(moduleFile.toPath().toAbsolutePath());
                     }
 
                     // 2. if not, check and return if there's a generated module source matching to the location
                     // information.
-                    File generatedFile = Paths.get(projectRoot, GEN_MODULE_DIR, locationName).toFile();
+                    File generatedFile = Path.of(projectRoot, GEN_MODULE_DIR, locationName).toFile();
                     if (generatedFile.isFile()) {
                         return Optional.of(generatedFile.toPath().toAbsolutePath());
                     }
                 } else {
                     // other modules
                     // 1. check and return if there's a user module source matching to the location information.
-                    File moduleFile = Paths.get(projectRoot, USER_MODULE_DIR, modulePart, locationName).toFile();
+                    File moduleFile = Path.of(projectRoot, USER_MODULE_DIR, modulePart, locationName).toFile();
                     if (moduleFile.isFile()) {
                         return Optional.of(moduleFile.toPath().toAbsolutePath());
                     }
 
                     // 2. if not, check and return if there's a generated module source matching to the location
                     // information.
-                    File generatedFile = Paths.get(projectRoot, GEN_MODULE_DIR, modulePart, locationName).toFile();
+                    File generatedFile = Path.of(projectRoot, GEN_MODULE_DIR, modulePart, locationName).toFile();
                     if (generatedFile.isFile()) {
                         return Optional.of(generatedFile.toPath().toAbsolutePath());
                     }
diff --git a/misc/debug-adapter/modules/debug-adapter-runtime/src/main/java/org/ballerinalang/debugadapter/runtime/DebuggerRuntime.java b/misc/debug-adapter/modules/debug-adapter-runtime/src/main/java/org/ballerinalang/debugadapter/runtime/DebuggerRuntime.java
index 656e9c49c242..be7fcf312e76 100644
--- a/misc/debug-adapter/modules/debug-adapter-runtime/src/main/java/org/ballerinalang/debugadapter/runtime/DebuggerRuntime.java
+++ b/misc/debug-adapter/modules/debug-adapter-runtime/src/main/java/org/ballerinalang/debugadapter/runtime/DebuggerRuntime.java
@@ -57,7 +57,6 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -395,7 +394,7 @@ public static Object classloadAndInvokeFunction(String executablePath, String ma
             functionArgs.add(null);
             functionArgs.addAll(Arrays.asList(userArgs));
 
-            URL pathUrl = Paths.get(executablePath).toUri().toURL();
+            URL pathUrl = Path.of(executablePath).toUri().toURL();
             URLClassLoader classLoader = AccessController.doPrivileged((PrivilegedAction) () ->
                     new URLClassLoader(new URL[]{pathUrl}, ClassLoader.getSystemClassLoader()));
 
diff --git a/misc/diagram-util/src/test/java/org/ballerinalang/diagramutil/TestUtil.java b/misc/diagram-util/src/test/java/org/ballerinalang/diagramutil/TestUtil.java
index 5b420529c890..cea393d80f8a 100644
--- a/misc/diagram-util/src/test/java/org/ballerinalang/diagramutil/TestUtil.java
+++ b/misc/diagram-util/src/test/java/org/ballerinalang/diagramutil/TestUtil.java
@@ -18,7 +18,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.UUID;
 
@@ -27,8 +26,8 @@
  */
 public final class TestUtil {
 
-    public static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
-    public static final Path BUILD_DIR = Paths.get("build/").toAbsolutePath();
+    public static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
+    public static final Path BUILD_DIR = Path.of("build/").toAbsolutePath();
 
     private TestUtil() {
     }
diff --git a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java
index 7652fe3dfeba..7ac3b24685d3 100644
--- a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java
+++ b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java
@@ -66,7 +66,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -143,7 +142,7 @@ public static void mergeApiDocs(Path apiDocsRoot)  {
                     if (moduleFile.isDirectory() && moduleFile.listFiles().length > 0
                             && moduleFile.listFiles()[0].isDirectory()) {
                         File versionFile = moduleFile.listFiles()[0];
-                        Path docJsonPath = Paths.get(versionFile.getAbsolutePath(), API_DOCS_JSON);
+                        Path docJsonPath = Path.of(versionFile.getAbsolutePath(), API_DOCS_JSON);
                         if (docJsonPath.toFile().exists()) {
                             try (BufferedReader br = Files.newBufferedReader(docJsonPath, StandardCharsets.UTF_8)) {
                                 ApiDocsJson apiDocsJson = gson.fromJson(br, ApiDocsJson.class);
@@ -154,7 +153,7 @@ public static void mergeApiDocs(Path apiDocsRoot)  {
                                 apiDocsJson.docsData.modules.forEach(mod -> {
                                     try {
                                         mod.resources
-                                                .addAll(getResourcePaths(Paths.get(orgFile.getAbsolutePath())));
+                                                .addAll(getResourcePaths(Path.of(orgFile.getAbsolutePath())));
                                     } catch (IOException e) {
                                         log.error(String.format("API documentation generation failed. Cause: %s"
                                                 , e.getMessage()), e);
diff --git a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/BallerinaDocUtils.java b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/BallerinaDocUtils.java
index cb24f51c8504..6cb3b475d290 100644
--- a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/BallerinaDocUtils.java
+++ b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/BallerinaDocUtils.java
@@ -24,7 +24,6 @@
 import java.io.PrintStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.regex.Matcher;
@@ -46,8 +45,8 @@ private BallerinaDocUtils() {
     }
 
     public static void packageToZipFile(String sourceDirPath, String zipFilePath) throws IOException {
-        Path p = Files.createFile(Paths.get(zipFilePath));
-        Path pp = Paths.get(sourceDirPath);
+        Path p = Files.createFile(Path.of(zipFilePath));
+        Path pp = Path.of(sourceDirPath);
         try (ZipOutputStream zs = new ZipOutputStream(Files.newOutputStream(p));
              Stream sourcePaths = Files.walk(pp)) {
             sourcePaths.filter(path -> !Files.isDirectory(path))
diff --git a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/PathToJson.java b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/PathToJson.java
index 2e1a7c3c4793..46a4136f2af7 100644
--- a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/PathToJson.java
+++ b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/utils/PathToJson.java
@@ -28,7 +28,6 @@
 
 import java.lang.reflect.Type;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Used to convert Path objects to JSON.
@@ -39,7 +38,7 @@ public class PathToJson implements JsonDeserializer, JsonSerializer
     @Override
     public Path deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext)
             throws JsonParseException {
-        return Paths.get(jsonElement.getAsString());
+        return Path.of(jsonElement.getAsString());
     }
 
     @Override
diff --git a/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java b/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java
index 2e5677b7e2fd..045a7e158848 100644
--- a/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java
+++ b/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java
@@ -32,7 +32,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Comparator;
 import java.util.stream.Stream;
 
@@ -40,7 +39,7 @@
  * Test generating API docs for a bala.
  */
 public class GenDocsForBalaTest {
-    private final Path resourceDir = Paths.get("src", "test", "resources");
+    private final Path resourceDir = Path.of("src", "test", "resources");
     private Path docsPath;
 
     @BeforeMethod
diff --git a/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatCmd.java b/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatCmd.java
index aadd2e31710e..5d7c45b05390 100644
--- a/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatCmd.java
+++ b/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatCmd.java
@@ -19,7 +19,6 @@
 import picocli.CommandLine;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 
 import static io.ballerina.cli.cmd.Constants.FORMAT_COMMAND;
@@ -50,7 +49,7 @@ public class FormatCmd implements BLauncherCmd {
     @Override
     public void execute() {
         // Get source root path.
-        Path sourceRootPath = Paths.get(System.getProperty(USER_DIR));
+        Path sourceRootPath = Path.of(System.getProperty(USER_DIR));
         FormatUtil.execute(argList, helpFlag, moduleName, fileName, dryRun, sourceRootPath);
     }
 
diff --git a/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatUtil.java b/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatUtil.java
index 923a5bbf463d..79219f668fe1 100644
--- a/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatUtil.java
+++ b/misc/formatter/modules/formatter-cli/src/main/java/org/ballerinalang/formatter/cli/FormatUtil.java
@@ -40,7 +40,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -93,7 +92,7 @@ static void execute(List argList, boolean helpFlag, String moduleName, S
                     }
 
                     ballerinaFilePath = argList.get(0);
-                    Path filePath = Paths.get(ballerinaFilePath);
+                    Path filePath = Path.of(ballerinaFilePath);
 
                     SingleFileProject project;
                     try {
@@ -118,7 +117,7 @@ static void execute(List argList, boolean helpFlag, String moduleName, S
                     } else {
                         outStream.println(Messages.getNoChanges());
                     }
-                } else if (Paths.get(argList.get(0)).toFile().isFile()) {
+                } else if (Path.of(argList.get(0)).toFile().isFile()) {
                     // If file is a regular file but not a ballerina source file
                     // throw the following exception.
                     throw LauncherUtils.createLauncherException(Messages.getNotABallerinaFile());
@@ -305,9 +304,9 @@ private static void generateChangeReport(List formattedFiles, boolean dr
     private static void formatAndWrite(Path documentPath, Path sourceRootPath,
                                        List formattedFiles, FormattingOptions options, boolean dryRun)
             throws IOException, FormatterException {
-        String fileName = Paths.get(sourceRootPath.toString()).resolve("modules").resolve(documentPath).toString();
+        String fileName = Path.of(sourceRootPath.toString()).resolve("modules").resolve(documentPath).toString();
 
-        String originalSource = Files.readString(Paths.get(fileName));
+        String originalSource = Files.readString(Path.of(fileName));
         // Format and get the formatted source.
         String formattedSource = Formatter.format(originalSource, options);
 
diff --git a/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java b/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java
index 0ef6e827d68d..c8032d62370e 100644
--- a/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java
+++ b/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.List;
@@ -35,7 +34,7 @@
  * Format CLI tool test suit for testing tool's exceptions.
  */
 public class FormatCmdTest {
-    private static final Path RES_DIR = Paths.get("src").resolve("test").resolve("resources").toAbsolutePath();
+    private static final Path RES_DIR = Path.of("src").resolve("test").resolve("resources").toAbsolutePath();
     private static final String NOT_A_BAL_PROJECT = "notAProject";
     private static final String BAL_PROJECT = "project";
 
@@ -90,7 +89,7 @@ public void formatCLIOnBallerinaProjectWithConfigurations(String testCase, List<
         try {
             for (Path dir : dirs) {
                 Path tempDir = dir.resolveSibling(dir.getFileName() + "Temp");
-                Path assertDir = Paths.get(dir.toString().replace("/source/", "/assert/"));
+                Path assertDir = Path.of(dir.toString().replace("/source/", "/assert/"));
                 FormatUtil.execute(argList, false, null, null, false, dir);
                 Assert.assertEquals(Files.readString(dir.resolve("main.bal")),
                         Files.readString(assertDir.resolve("main.bal")));
diff --git a/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormatterUtils.java b/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormatterUtils.java
index e6deaabd2193..78c8564f7976 100644
--- a/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormatterUtils.java
+++ b/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormatterUtils.java
@@ -56,7 +56,6 @@
 import java.nio.file.Files;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -201,7 +200,7 @@ public static Map getFormattingConfigurations(Path root, String
 
     private static Optional convertConfigurationPath(String path) {
         try {
-            return Optional.of(Paths.get(path));
+            return Optional.of(Path.of(path));
         } catch (InvalidPathException ex) {
             return Optional.empty();
         }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java
index 0a7a8bc25eda..1cde35998469 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java
@@ -33,7 +33,6 @@
 import java.lang.reflect.Method;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -48,8 +47,8 @@ public abstract class FormatterTest {
 
     // TODO: Add test cases for syntax error scenarios as well
 
-    private final Path resourceDirectory = Paths.get("src").resolve("test").resolve("resources").toAbsolutePath();
-    private Path buildDirectory = Paths.get("build").toAbsolutePath().normalize();
+    private final Path resourceDirectory = Path.of("src").resolve("test").resolve("resources").toAbsolutePath();
+    private Path buildDirectory = Path.of("build").toAbsolutePath().normalize();
     private static final String ASSERT_DIR = "assert";
     private static final String SOURCE_DIR = "source";
 
@@ -61,8 +60,8 @@ public abstract class FormatterTest {
      */
     @Test(dataProvider = "test-file-provider")
     public void test(String source, String sourcePath) throws IOException {
-        Path assertFilePath = Paths.get(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
-        Path sourceFilePath = Paths.get(resourceDirectory.toString(), sourcePath, SOURCE_DIR, source);
+        Path assertFilePath = Path.of(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
+        Path sourceFilePath = Path.of(resourceDirectory.toString(), sourcePath, SOURCE_DIR, source);
         String content = getSourceText(sourceFilePath);
         TextDocument textDocument = TextDocuments.from(content);
         SyntaxTree syntaxTree = SyntaxTree.from(textDocument);
@@ -75,10 +74,10 @@ public void test(String source, String sourcePath) throws IOException {
     }
 
     public void testWithConfigurationFile(String source, String sourcePath) throws IOException, FormatterException {
-        Path sourceDir = Paths.get(resourceDirectory.toString(), sourcePath, SOURCE_DIR);
-        Path sourceFilePath = Paths.get(sourceDir.toString(), source);
-        Path assertFilePath = Paths.get(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
-        Path tomlPath = Paths.get(sourceDir.toString(), ProjectConstants.BALLERINA_TOML);
+        Path sourceDir = Path.of(resourceDirectory.toString(), sourcePath, SOURCE_DIR);
+        Path sourceFilePath = Path.of(sourceDir.toString(), source);
+        Path assertFilePath = Path.of(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
+        Path tomlPath = Path.of(sourceDir.toString(), ProjectConstants.BALLERINA_TOML);
         String content = getSourceText(sourceFilePath);
         TextDocument textDocument = TextDocuments.from(content);
         String tomlContent = Files.readString(tomlPath);
@@ -95,8 +94,8 @@ public void testWithConfigurationFile(String source, String sourcePath) throws I
     }
 
     public void testWithOptions(String source, String sourcePath) throws IOException {
-        Path assertFilePath = Paths.get(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
-        Path sourceFilePath = Paths.get(resourceDirectory.toString(), sourcePath, SOURCE_DIR, source);
+        Path assertFilePath = Path.of(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
+        Path sourceFilePath = Path.of(resourceDirectory.toString(), sourcePath, SOURCE_DIR, source);
         String content = getSourceText(sourceFilePath);
         TextDocument textDocument = TextDocuments.from(content);
         SyntaxTree syntaxTree = SyntaxTree.from(textDocument);
@@ -112,8 +111,8 @@ public void testWithOptions(String source, String sourcePath) throws IOException
 
     public void testWithCustomOptions(String source, String sourcePath, FormattingOptions formattingOptions)
             throws IOException {
-        Path assertFilePath = Paths.get(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
-        Path sourceFilePath = Paths.get(resourceDirectory.toString(), sourcePath, SOURCE_DIR, source);
+        Path assertFilePath = Path.of(resourceDirectory.toString(), sourcePath, ASSERT_DIR, source);
+        Path sourceFilePath = Path.of(resourceDirectory.toString(), sourcePath, SOURCE_DIR, source);
         String content = getSourceText(sourceFilePath);
         TextDocument textDocument = TextDocuments.from(content);
         SyntaxTree syntaxTree = SyntaxTree.from(textDocument);
@@ -131,7 +130,7 @@ public void testWithCustomOptions(String source, String sourcePath, FormattingOp
      * @param sourcePath Source path of the parser test
      */
     public void testParserResources(String sourcePath) throws IOException {
-        Path filePath = Paths.get(sourcePath);
+        Path filePath = Path.of(sourcePath);
         String content = getSourceText(filePath);
         TextDocument textDocument = TextDocuments.from(content);
         SyntaxTree syntaxTree = SyntaxTree.from(textDocument);
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java
index 919525853924..c18ef2a60b44 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java
@@ -21,7 +21,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
@@ -43,7 +42,7 @@ public void test(String fileName, String path) throws IOException {
 //    // Uncomment to run a subset of test cases.
 //    @Override
 //    public Object[][] testSubset() {
-//        Path buildDirectory = Paths.get("build").toAbsolutePath().normalize();
+//        Path buildDirectory = Path.of("build").toAbsolutePath().normalize();
 //
 //        return new Object[][] {
 //                {"annot_decl_source_01.bal", getFilePath("annot_decl_source_01.bal",
@@ -204,11 +203,11 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("parser-tests").toString();
+        return Path.of("parser-tests").toString();
     }
 
     private Optional getFilePath(String fileName, String directoryPath) {
-        try (Stream paths = Files.walk(Paths.get(directoryPath))) {
+        try (Stream paths = Files.walk(Path.of(directoryPath))) {
             return Optional.ofNullable(paths.filter(f -> f.getFileName().toString().equals(fileName))
                     .toList().get(0).toString());
         } catch (IOException e) {
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java
index a1c64f3dbbf0..5b9b38579b68 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java
@@ -37,7 +37,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -47,7 +46,7 @@
  * @since 2.0.0
  */
 public abstract class RangeFormatterTest {
-    private final Path resourceDirectory = Paths.get("src").resolve("test").resolve("resources").toAbsolutePath();
+    private final Path resourceDirectory = Path.of("src").resolve("test").resolve("resources").toAbsolutePath();
     private static final String ASSERT_DIR = "assert";
     private static final String SOURCE_DIR = "source";
 
@@ -107,7 +106,7 @@ protected Object[][] getConfigsList() {
         List skippedTests = this.skipList();
         try {
             String testResourceDir = getTestResourceDir();
-            File jsonConfigFile = Paths.get(resourceDirectory.toString(), getTestResourceDir(),
+            File jsonConfigFile = Path.of(resourceDirectory.toString(), getTestResourceDir(),
                     getConfigJsonFileName()).toFile();
             JsonArray jsonArray = gson.fromJson(new FileReader(jsonConfigFile), JsonArray.class);
             int jsonArraySize = jsonArray.size();
@@ -118,8 +117,8 @@ protected Object[][] getConfigsList() {
                 if (skippedTests.contains(fileName)) {
                     continue;
                 }
-                Path assertFilePath = Paths.get(resourceDirectory.toString(), testResourceDir, ASSERT_DIR, fileName);
-                Path sourceFilePath = Paths.get(resourceDirectory.toString(), testResourceDir, SOURCE_DIR, fileName);
+                Path assertFilePath = Path.of(resourceDirectory.toString(), testResourceDir, ASSERT_DIR, fileName);
+                Path sourceFilePath = Path.of(resourceDirectory.toString(), testResourceDir, SOURCE_DIR, fileName);
                 ArrayList lineRanges = new ArrayList<>();
                 for (JsonElement positionElement : jsonObject.getAsJsonArray("positions")) {
                     JsonObject position = positionElement.getAsJsonObject();
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java
index ea8c6da44727..cee0375c0f0e 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of checking actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "checking").toString();
+        return Path.of("actions/checking").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java
index 02e40b72fd1a..44c0c509f8ae 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of flush actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "flush").toString();
+        return Path.of("actions/flush").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java
index 76ee08985ed4..185a9261fc98 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of query actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "query").toString();
+        return Path.of("actions/query").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java
index 2991d36cae2a..066310c5540a 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of send and receive actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "send-receive").toString();
+        return Path.of("actions/send-receive").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java
index 9c0b21fee342..11fc24d03cb0 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of start actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "start").toString();
+        return Path.of("actions/start").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java
index eb830005a91c..203e75362a0f 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of trap actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "trap").toString();
+        return Path.of("actions/trap").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java
index 24cce567ef22..bede9b9ef48e 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of type cast actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "type-cast").toString();
+        return Path.of("actions/type-cast").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java
index 682383298909..a01f3fd7d90e 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of wait actions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("actions", "wait").toString();
+        return Path.of("actions/wait").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/LocalConfigurationTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/LocalConfigurationTest.java
index f852990810ce..4399a9259fbd 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/LocalConfigurationTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/LocalConfigurationTest.java
@@ -22,7 +22,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test formatting with a local configuration file.
@@ -54,7 +53,7 @@ public Object[][] testSubset() {
     }
     @Override
     public String getTestResourceDir() {
-        Path path = Paths.get("configurations", "local");
+        Path path = Path.of("configurations", "local");
         return path.toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java
index 9ec220de229b..dd085f9c819f 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java
@@ -21,7 +21,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of additive expressions.
@@ -55,6 +55,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("configurations", "remote").toString();
+        return Path.of("configurations/remote").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java
index fd9e89c47fa2..12bac59198fe 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java
@@ -23,7 +23,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of class definition declarations.
@@ -57,6 +57,6 @@ public Object[][] dataProvider() {
      */
     @Override
     public String getTestResourceDir() {
-        return Paths.get("declarations", "class-definition").toString();
+        return Path.of("declarations/class-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java
index d706189872e2..f8f96ba7f435 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of function definition declarations.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("declarations", "function-definition").toString();
+        return Path.of("declarations/function-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java
index e3472ae755e0..5edc01717192 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java
@@ -23,7 +23,7 @@
 
 import java.io.IOException;
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of import declarations.
@@ -89,6 +89,6 @@ public Object[][] dataProviderWithCustomTests(Method testName) {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("declarations", "import").toString();
+        return Path.of("declarations/import").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java
index 9708deb14ec0..c1577299eff5 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of module enumeration declarations.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("declarations", "module-enumeration").toString();
+        return Path.of("declarations/module-enumeration").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java
index ddf9bf1272c3..bd0759d0fabe 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of module type definition declarations.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("declarations", "module-type-definition").toString();
+        return Path.of("declarations/module-type-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java
index 47a9dee2f56c..80fff0a7529a 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of module variable declarations.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("declarations", "module-variable").toString();
+        return Path.of("declarations/module-variable").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java
index 52c797094b47..4a2a73b7a517 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of service and listener declarations.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("declarations", "service-listener").toString();
+        return Path.of("declarations/service-listener").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/AdditiveExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/AdditiveExpressionsTest.java
index 3deb2e35d8a6..3d140ea2584b 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/AdditiveExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/AdditiveExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of additive expressions.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "additive").toString();
+        return Path.of("expressions", "additive").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java
index cf4717578dea..ed43ab3663ed 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of binary bitwise expressions.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "binary-bitwise").toString();
+        return Path.of("expressions/binary-bitwise").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java
index 035911e74424..a01e6f3aaaa9 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of conditional expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "conditional").toString();
+        return Path.of("expressions/conditional").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java
index 5ce1c98df79c..651eb44f3cf6 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of constant expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "constant").toString();
+        return Path.of("expressions/constant").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java
index 7076d5c90e11..b9d355d3ad56 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of equality expressions.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "equality").toString();
+        return Path.of("expressions/equality").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java
index e264f15c37ec..112b46273852 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of let expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "let").toString();
+        return Path.of("expressions/let").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java
index 814aa5e18512..2252068dca47 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of literal expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "literal").toString();
+        return Path.of("expressions/literal").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java
index 29e9fa824d25..d1f79600de75 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of logical expressions.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "logical").toString();
+        return Path.of("expressions/logical").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java
index 6c75765a769e..eb7e0911d6c4 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of multiplicative expressions.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "multiplicative").toString();
+        return Path.of("expressions/multiplicative").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java
index f1ed12e42427..21dd9b37be6c 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of new expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "new").toString();
+        return Path.of("expressions/new").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java
index 4ccbbdc6f992..0cc0358e1335 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of object constructor expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "object-constructor").toString();
+        return Path.of("expressions/object-constructor").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java
index fc3f7e8b9e59..a72f7ede2eee 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of optional field access expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "optional-field-access").toString();
+        return Path.of("expressions/optional-field-access").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java
index 914918b0e471..8a9c179ae6d3 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of query expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "query").toString();
+        return Path.of("expressions/query").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java
index 36555287bb70..e58a154eb36c 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of range expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "range").toString();
+        return Path.of("expressions/range").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java
index 134ccd9933ea..c431648036e6 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of raw template expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "raw-template").toString();
+        return Path.of("expressions/raw-template").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java
index bb2663728cfb..393363daaff9 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of relational expressions.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "relational").toString();
+        return Path.of("expressions/relational").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java
index 2c1eca3d4b7a..7454df5adaf8 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of shift expressions.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "shift").toString();
+        return Path.of("expressions/shift").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java
index 054c6736777f..873de4104621 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of string template expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "string-template").toString();
+        return Path.of("expressions/string-template").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java
index f19fdd90d47c..de610154fa73 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of type test expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "type-test").toString();
+        return Path.of("expressions/type-test").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java
index bbb088950528..07f4376df3d1 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of unary expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "unary").toString();
+        return Path.of("expressions/unary").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java
index 31cb0172a049..e8201ab4ed1f 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of XML template expressions.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("expressions", "xml-template").toString();
+        return Path.of("expressions/xml-template").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java
index 5dfe17b85045..a41464b87593 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the line wrapping.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("misc", "blocks").toString();
+        return Path.of("misc/blocks").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java
index d4cbcc8e7d30..963143865735 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the line wrapping.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("misc", "linebreaks").toString();
+        return Path.of("misc/linebreaks").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java
index ab2c39c2284d..67ce8c0141e3 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the line wrapping.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("misc", "linewrapping").toString();
+        return Path.of("misc/linewrapping").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java
index d5d5b53d918b..dd0e18be7b66 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the metadata attached to a construct.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("misc", "metadata").toString();
+        return Path.of("misc/metadata").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/RangesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/RangesTest.java
index 15855d37c893..ac4b3b15eb2c 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/RangesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/RangesTest.java
@@ -26,7 +26,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -58,7 +57,7 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("misc", "ranges").toString();
+        return Path.of("misc", "ranges").toString();
     }
 
     @Override
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java
index ae6515c6d129..2ffd01bb75b0 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of assignment statements.
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "assignment").toString();
+        return Path.of("statements/assignment").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java
index ffcf97be7802..16b8804e3039 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of block statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "block").toString();
+        return Path.of("statements/block").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java
index 86a38734fa11..6e458af8358a 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of break statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "break").toString();
+        return Path.of("statements/break").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java
index ad783e649e2a..ec964e96dd02 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of call statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "call").toString();
+        return Path.of("statements/call").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java
index 45789e616768..0f83225b9be1 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of compound assignment statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "compound-assignment").toString();
+        return Path.of("statements/compound-assignment").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java
index 36d6450d196d..262ef453fdcb 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of continue statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "continue").toString();
+        return Path.of("statements/continue").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java
index 795d4d4b076a..e06d50e77362 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of assignment statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "do").toString();
+        return Path.of("statements/do").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java
index 44cf0bb60b10..95d9f7452ab9 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of for each statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "foreach").toString();
+        return Path.of("statements/foreach").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java
index bce1dc256191..0420c1f26317 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of fork statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "fork").toString();
+        return Path.of("statements/fork").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java
index 114e96270afd..7b35929e92d5 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -45,7 +45,7 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "if-else").toString();
+        return Path.of("statements/if-else").toString();
     }
 
     @Override
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java
index adb42e0910ad..34337ac593af 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of local type definition statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "local-type-definition").toString();
+        return Path.of("statements/local-type-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java
index 781596b8b0fb..766ab9d1c51b 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of lock statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "lock").toString();
+        return Path.of("statements/lock").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java
index c28998cd9320..73bcb2d83915 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of match statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "match").toString();
+        return Path.of("statements/match").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java
index 46a64ed9c1d9..754e8c254b4c 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of panic statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "panic").toString();
+        return Path.of("statements/panic").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java
index df5beb41edd4..c325841c508c 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of return statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "return").toString();
+        return Path.of("statements/return").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java
index 74d3fa7c4849..be057e3bb2e8 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of while statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "while").toString();
+        return Path.of("statements/while").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java
index 4c1f420a41e3..37927cc68de0 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of XML namespace declaration statements.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("statements", "xmlns-declaration").toString();
+        return Path.of("statements/xmlns-declaration").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java
index ac877804a145..395815ca3a63 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of behavioural type descriptors.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("types", "behavioural").toString();
+        return Path.of("types/behavioural").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java
index a5876f438890..51d61a6d7d23 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of other type descriptors.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("types", "other").toString();
+        return Path.of("types/other").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java
index e36b6ba021b3..07a8dc8393ce 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of sequence type descriptors.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("types", "sequence").toString();
+        return Path.of("types/sequence").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java
index 5446eab2b0d6..78fec866543b 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of simple type descriptors.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("types", "simple").toString();
+        return Path.of("types/simple").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java
index 913bfd37bf34..fec2fd418b66 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java
@@ -20,7 +20,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Test the formatting of structured type descriptors.
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Paths.get("types", "structured").toString();
+        return Path.of("types/structured").toString();
     }
 }
diff --git a/misc/json-to-record-converter/src/test/java/io/ballerina/jsonmapper/JsonToRecordMapperTests.java b/misc/json-to-record-converter/src/test/java/io/ballerina/jsonmapper/JsonToRecordMapperTests.java
index 192bdf6e0f5e..927898c00024 100644
--- a/misc/json-to-record-converter/src/test/java/io/ballerina/jsonmapper/JsonToRecordMapperTests.java
+++ b/misc/json-to-record-converter/src/test/java/io/ballerina/jsonmapper/JsonToRecordMapperTests.java
@@ -27,7 +27,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -37,7 +36,7 @@
  */
 public class JsonToRecordMapperTests {
 
-    private static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    private static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
     private static final String BAL_DIR = "ballerina";
     private static final String JSON_DIR = "json";
     private static final String PROJECT_DIR = "project";
diff --git a/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BallerinaToDependancyToml.java b/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BallerinaToDependancyToml.java
index e5782f9f6791..2f026ecaa016 100644
--- a/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BallerinaToDependancyToml.java
+++ b/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BallerinaToDependancyToml.java
@@ -8,7 +8,6 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.PathMatcher;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -24,10 +23,10 @@ public static void main(String... args) throws IOException {
             System.out.println("Please specify a path");
         }
         String path = args[0];
-        Path dir = Paths.get(System.getProperty("user.dir")).resolve(path);
+        Path dir = Path.of(System.getProperty("user.dir")).resolve(path);
         PathMatcher pathMatcher = FileSystems.getDefault()
                 .getPathMatcher("glob:**/Ballerina.toml");
-        try (Stream paths = Files.walk(Paths.get(".."))) {
+        try (Stream paths = Files.walk(Path.of(".."))) {
             paths.filter(pathMatcher::matches).forEach(BallerinaToDependancyToml::migrate);
         }
     }
diff --git a/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BuildLangLib.java b/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BuildLangLib.java
index 772ebe9156ce..86208d059352 100644
--- a/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BuildLangLib.java
+++ b/misc/lib-creator/src/main/java/org/ballerinalang/stdlib/utils/BuildLangLib.java
@@ -41,7 +41,6 @@
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.Optional;
@@ -70,8 +69,8 @@ private BuildLangLib() {
     public static void main(String[] args) throws IOException {
         PrintStream out = System.out;
         try {
-            projectDir = Paths.get(args[0]);
-            distCache = Paths.get(args[1]);
+            projectDir = Path.of(args[0]);
+            distCache = Path.of(args[1]);
             String pkgName = args[2];
             // Following is to compile stdlib Modules
             if (args.length >= 4 && args[3].equals("true")) {
diff --git a/misc/ls-extensions/modules/bal-shell-service/src/main/java/io/ballerina/shell/service/ShellWrapper.java b/misc/ls-extensions/modules/bal-shell-service/src/main/java/io/ballerina/shell/service/ShellWrapper.java
index ff2bc3b38a4d..f686509df49d 100644
--- a/misc/ls-extensions/modules/bal-shell-service/src/main/java/io/ballerina/shell/service/ShellWrapper.java
+++ b/misc/ls-extensions/modules/bal-shell-service/src/main/java/io/ballerina/shell/service/ShellWrapper.java
@@ -36,7 +36,7 @@
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -137,7 +137,7 @@ public BalShellGetResultResponse getResult(String source) {
     public ShellFileSourceResponse getShellFileSource() {
         String fileContent;
         try {
-            fileContent = Files.readString(Paths.get(evaluator.getBufferFileUri()), Charset.defaultCharset()).trim();
+            fileContent = Files.readString(Path.of(evaluator.getBufferFileUri()), Charset.defaultCharset()).trim();
             File tempFile = writeToFile(fileContent);
             return new ShellFileSourceResponse(tempFile, fileContent);
         } catch (IOException ignored) {
diff --git a/misc/ls-extensions/modules/bal-shell-service/src/test/java/io/ballerina/shell/service/test/AbstractShellServiceTest.java b/misc/ls-extensions/modules/bal-shell-service/src/test/java/io/ballerina/shell/service/test/AbstractShellServiceTest.java
index 1d4f49bac81d..ec65608cbbdf 100644
--- a/misc/ls-extensions/modules/bal-shell-service/src/test/java/io/ballerina/shell/service/test/AbstractShellServiceTest.java
+++ b/misc/ls-extensions/modules/bal-shell-service/src/test/java/io/ballerina/shell/service/test/AbstractShellServiceTest.java
@@ -24,7 +24,6 @@
 import org.testng.annotations.BeforeMethod;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Base class for shell service tests.
@@ -38,7 +37,7 @@ public abstract class AbstractShellServiceTest {
     protected static final String GET_VARIABLES = "balShell/getVariableValues";
     protected static final String DELETE_DCLNS = "balShell/deleteDeclarations";
     protected static final String GET_SHELL_FILE_SOURCE = "balShell/getShellFileSource";
-    protected static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    protected static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
     protected Endpoint serviceEndpoint;
 
     @BeforeClass
diff --git a/misc/ls-extensions/modules/json-to-record-converter/src/test/java/io/ballerina/converters/JsonToRecordConverterTests.java b/misc/ls-extensions/modules/json-to-record-converter/src/test/java/io/ballerina/converters/JsonToRecordConverterTests.java
index 2cb01f839f97..090f1b30a9fb 100644
--- a/misc/ls-extensions/modules/json-to-record-converter/src/test/java/io/ballerina/converters/JsonToRecordConverterTests.java
+++ b/misc/ls-extensions/modules/json-to-record-converter/src/test/java/io/ballerina/converters/JsonToRecordConverterTests.java
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -40,7 +39,7 @@
  * Tests for JsonToRecordConverter.
  */
 public class JsonToRecordConverterTests {
-    private static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    private static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
     private static final String JsonToRecordService = "jsonToRecord/convert";
 
     private final Path basicSchemaJson = RES_DIR.resolve("json")
diff --git a/misc/ls-extensions/modules/partial-parser/src/test/java/io.ballerina.parsers/PartialParserTests.java b/misc/ls-extensions/modules/partial-parser/src/test/java/io.ballerina.parsers/PartialParserTests.java
index 96d7f02957ed..71cc00924c43 100644
--- a/misc/ls-extensions/modules/partial-parser/src/test/java/io.ballerina.parsers/PartialParserTests.java
+++ b/misc/ls-extensions/modules/partial-parser/src/test/java/io.ballerina.parsers/PartialParserTests.java
@@ -31,7 +31,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 
@@ -45,7 +44,7 @@ public class PartialParserTests {
     private static final String MODULE_PART = "partialParser/getSTForModulePart";
     private static final String RESOURCE = "partialParser/getSTForResource";
 
-    private static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    private static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
     private static final Path ST_WINDOWS = RES_DIR.resolve("syntax-tree").resolve("windows");
     private static final Path ST_LINUX = RES_DIR.resolve("syntax-tree").resolve("linux");
 
diff --git a/misc/ls-extensions/modules/performance-analyzer-services/src/test/java/io/ballerina/PerformanceAnalyzerTest.java b/misc/ls-extensions/modules/performance-analyzer-services/src/test/java/io/ballerina/PerformanceAnalyzerTest.java
index b7ffa805b0e1..c26fe57bb5d5 100644
--- a/misc/ls-extensions/modules/performance-analyzer-services/src/test/java/io/ballerina/PerformanceAnalyzerTest.java
+++ b/misc/ls-extensions/modules/performance-analyzer-services/src/test/java/io/ballerina/PerformanceAnalyzerTest.java
@@ -32,7 +32,6 @@
 import java.io.FileReader;
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
@@ -52,7 +51,7 @@ public class PerformanceAnalyzerTest {
     private static final String BALLERINA = "ballerina";
     private static final String RESULT = "result";
     private static final String PERFORMANCE_ANALYZE = "performanceAnalyzer/getResourcesWithEndpoints";
-    private static final Path RES_DIR = Paths.get("src", "test", "resources").toAbsolutePath();
+    private static final Path RES_DIR = Path.of("src", "test", "resources").toAbsolutePath();
 
     @Test(description = "Test performance analyzer")
     public void testFunction() throws IOException, ExecutionException, InterruptedException {
diff --git a/misc/maven-resolver/src/test/java/org/ballerinalang/maven/MavenResolverTest.java b/misc/maven-resolver/src/test/java/org/ballerinalang/maven/MavenResolverTest.java
index 7ff8b094e201..9c784c49934f 100644
--- a/misc/maven-resolver/src/test/java/org/ballerinalang/maven/MavenResolverTest.java
+++ b/misc/maven-resolver/src/test/java/org/ballerinalang/maven/MavenResolverTest.java
@@ -22,13 +22,13 @@
 import org.testng.annotations.Test;
 
 import java.io.File;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Tests for {@link MavenResolver}.
  */
 public class MavenResolverTest {
-    String targetRepo = Paths.get("build").toAbsolutePath().toString() + File.separator + "platform-libs";
+    String targetRepo = Path.of("build/platform-libs").toAbsolutePath().toString();
     String mavenArtifactVersion = "3.6.3";
     String ballerinaMysqlVersion = "1.2.47";
     String commandDistVersion = "0.8.5";
diff --git a/misc/semver-checker/modules/semver-checker-cli/src/main/java/org/ballerinalang/semver/checker/cmd/SemverCmd.java b/misc/semver-checker/modules/semver-checker-cli/src/main/java/org/ballerinalang/semver/checker/cmd/SemverCmd.java
index 3a4ebf726772..500a023d560b 100644
--- a/misc/semver-checker/modules/semver-checker-cli/src/main/java/org/ballerinalang/semver/checker/cmd/SemverCmd.java
+++ b/misc/semver-checker/modules/semver-checker-cli/src/main/java/org/ballerinalang/semver/checker/cmd/SemverCmd.java
@@ -28,7 +28,6 @@
 import java.io.PrintStream;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import static io.ballerina.cli.cmd.Constants.SEMVER_COMMAND;
 
@@ -66,7 +65,7 @@ public class SemverCmd implements BLauncherCmd {
     private boolean showDiff;
 
     public SemverCmd() {
-        this.projectPath = Paths.get(System.getProperty(ProjectConstants.USER_DIR));
+        this.projectPath = Path.of(System.getProperty(ProjectConstants.USER_DIR));
         this.outStream = System.out;
         this.errStream = System.err;
     }
diff --git a/misc/syntax-api-calls-gen/src/test/java/io/ballerina/syntaxapicallsgen/test/FileReaderUtils.java b/misc/syntax-api-calls-gen/src/test/java/io/ballerina/syntaxapicallsgen/test/FileReaderUtils.java
index 8f37151f5b83..732d1c09b6cc 100644
--- a/misc/syntax-api-calls-gen/src/test/java/io/ballerina/syntaxapicallsgen/test/FileReaderUtils.java
+++ b/misc/syntax-api-calls-gen/src/test/java/io/ballerina/syntaxapicallsgen/test/FileReaderUtils.java
@@ -23,7 +23,7 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.charset.Charset;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Objects;
 import java.util.Scanner;
 
@@ -56,6 +56,6 @@ public static String readFileAsResource(String path) {
     public static File getResourceFile(String fileName) throws URISyntaxException {
         URL fileUrl = FileReaderUtils.class.getClassLoader().getResource(fileName);
         Objects.requireNonNull(fileUrl, "Template file resource could not be found.");
-        return Paths.get(fileUrl.toURI()).toFile();
+        return Path.of(fileUrl.toURI()).toFile();
     }
 }
diff --git a/misc/testerina/modules/testerina-compiler-plugin/src/main/java/org/ballerinalang/testerina/compiler/TesterinaCompilerPluginUtils.java b/misc/testerina/modules/testerina-compiler-plugin/src/main/java/org/ballerinalang/testerina/compiler/TesterinaCompilerPluginUtils.java
index 7e19cc476a47..7f088551f478 100644
--- a/misc/testerina/modules/testerina-compiler-plugin/src/main/java/org/ballerinalang/testerina/compiler/TesterinaCompilerPluginUtils.java
+++ b/misc/testerina/modules/testerina-compiler-plugin/src/main/java/org/ballerinalang/testerina/compiler/TesterinaCompilerPluginUtils.java
@@ -52,7 +52,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -348,7 +347,7 @@ public static void writeCacheMapAsJson(Map map, Path path, String fileName
             }
         }
 
-        Path jsonFilePath = Paths.get(path.toString(), fileName);
+        Path jsonFilePath = Path.of(path.toString(), fileName);
         File jsonFile = new File(jsonFilePath.toString());
         try (FileOutputStream fileOutputStream = new FileOutputStream(jsonFile)) {
             try (Writer writer = new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8)) {
diff --git a/misc/testerina/modules/testerina-core/src/main/java/org/ballerinalang/testerina/natives/io/FileUtils.java b/misc/testerina/modules/testerina-core/src/main/java/org/ballerinalang/testerina/natives/io/FileUtils.java
index 68dd961897ff..19b2492644ef 100644
--- a/misc/testerina/modules/testerina-core/src/main/java/org/ballerinalang/testerina/natives/io/FileUtils.java
+++ b/misc/testerina/modules/testerina-core/src/main/java/org/ballerinalang/testerina/natives/io/FileUtils.java
@@ -28,7 +28,7 @@
 import java.io.Writer;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -61,7 +61,7 @@ public static void writeContent(BString targetPath, BString content) throws Exce
         matcher.appendTail(stringBuilder);
 
 
-        File jsonFile = new File(Paths.get(targetPath.getValue()).toString());
+        File jsonFile = new File(Path.of(targetPath.getValue()).toString());
         jsonFile.getParentFile().mkdirs();
         FileOutputStream fileOutputStream = new FileOutputStream(jsonFile);
         try (Writer writer = new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8)) {
@@ -73,7 +73,7 @@ public static void writeContent(BString targetPath, BString content) throws Exce
     public static BString readContent(BString targetPath) {
         if (fileExists(targetPath)) {
             try {
-                String readString = Files.readString(Paths.get(targetPath.getValue()));
+                String readString = Files.readString(Path.of(targetPath.getValue()));
                 return StringUtils.fromString(readString);
             } catch (IOException e) {
                 throw ErrorHelper.getRuntimeException(ErrorCodes.OPERATION_NOT_SUPPORTED_ERROR);
@@ -83,6 +83,6 @@ public static BString readContent(BString targetPath) {
     }
 
     public static boolean fileExists(BString filePath) {
-        return Files.exists(Paths.get(filePath.getValue()));
+        return Files.exists(Path.of(filePath.getValue()));
     }
 }
diff --git a/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/BTestMain.java b/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/BTestMain.java
index f19fec562cc8..2d76894ad471 100644
--- a/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/BTestMain.java
+++ b/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/BTestMain.java
@@ -50,7 +50,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -86,8 +85,8 @@ public static void main(String[] args) throws IOException {
         }
         //running using the suite json
         boolean isFatJarExecution = Boolean.parseBoolean(args[0]);
-        Path testSuiteJsonPath = Paths.get(args[1]);
-        Path targetPath = Paths.get(args[2]);
+        Path testSuiteJsonPath = Path.of(args[1]);
+        Path targetPath = Path.of(args[2]);
         Path testCache = targetPath.resolve(ProjectConstants.CACHES_DIR_NAME)
                         .resolve(ProjectConstants.TESTS_CACHE_DIR_NAME);
         String jacocoAgentJarPath = args[3];
@@ -149,7 +148,7 @@ public static void main(String[] args) throws IOException {
                         testArgs = Arrays.copyOf(testArgs, testArgs.length + 1);
                         testArgs[testArgs.length - 1] = args[i];
                     }
-                    result = startTestSuit(Paths.get(testSuite.getSourceRootPath()), testSuite, classLoader,
+                    result = startTestSuit(Path.of(testSuite.getSourceRootPath()), testSuite, classLoader,
                             testArgs);
                     exitStatus = (result == 1) ? result : exitStatus;
                 }
@@ -188,7 +187,7 @@ public static List getURLList(List jarFilePaths) {
         List urlList = new ArrayList<>();
         for (String jarFilePath : jarFilePaths) {
             try {
-                urlList.add(Paths.get(jarFilePath).toUri().toURL());
+                urlList.add(Path.of(jarFilePath).toUri().toURL());
             } catch (MalformedURLException e) {
                 // This path cannot get executed
                 throw new RuntimeException("Failed to create classloader with all jar files", e);
diff --git a/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/util/CodeCoverageUtils.java b/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/util/CodeCoverageUtils.java
index 16603eb38028..0a1429096644 100644
--- a/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/util/CodeCoverageUtils.java
+++ b/misc/testerina/modules/testerina-runtime/src/main/java/org/ballerinalang/test/runtime/util/CodeCoverageUtils.java
@@ -46,7 +46,6 @@
 import java.nio.file.Files;
 import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -76,7 +75,7 @@
  */
 public final class CodeCoverageUtils {
 
-    private  static final String REPORT_ZIP_DIRECTORY = Paths.get(System.getProperty(BALLERINA_HOME))
+    private  static final String REPORT_ZIP_DIRECTORY = Path.of(System.getProperty(BALLERINA_HOME))
             .resolve(BALLERINA_HOME_LIB).resolve(TesterinaConstants.TOOLS_DIR_NAME)
             .resolve(TesterinaConstants.COVERAGE_DIR).resolve(REPORT_ZIP_NAME).toString()
             .replace(REPORT_ZIP_NAME, "");
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/ParserTestUtils.java b/misc/toml-parser/src/test/java/toml/parser/test/ParserTestUtils.java
index 875c4924a956..8557cad140d0 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/ParserTestUtils.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/ParserTestUtils.java
@@ -46,7 +46,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 import static io.ballerina.toml.internal.syntax.SyntaxUtils.isSTNodePresent;
@@ -58,7 +57,7 @@
  */
 public final class ParserTestUtils {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     /**
      * WARNING: Enabling this flag will update all the assertion files in unit tests.
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/SyntaxTreeJSONGenerator.java b/misc/toml-parser/src/test/java/toml/parser/test/SyntaxTreeJSONGenerator.java
index e2899d7e6b0b..7e17e5795845 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/SyntaxTreeJSONGenerator.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/SyntaxTreeJSONGenerator.java
@@ -39,7 +39,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 /**
@@ -55,13 +54,13 @@ public final class SyntaxTreeJSONGenerator {
      */
 
     private static final PrintStream STANDARD_OUT = System.out;
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     private SyntaxTreeJSONGenerator() {
     }
 
     public static void main(String[] args) throws IOException {
-        Path syntax = RESOURCE_DIRECTORY.resolve(Paths.get("syntax"));
+        Path syntax = RESOURCE_DIRECTORY.resolve(Path.of("syntax"));
 
         File[] resourceContents = syntax.toFile().listFiles();
         if (resourceContents != null) {
@@ -73,7 +72,7 @@ public static void main(String[] args) throws IOException {
 
         // Using a file source as input
 //        String path = "syntax/key-value/values.toml";
-//        String jsonString = generateJSON(Paths.get(path));
+//        String jsonString = generateJSON(Path.of(path));
 //        STANDARD_OUT.println(jsonString);
     }
 
@@ -98,7 +97,7 @@ private static void writeTreeToJson(File file, String content) throws IOExceptio
         content = content + System.lineSeparator();
         String tomlPath = file.getAbsolutePath();
         String jsonPath = tomlPath.replace(".toml", ".json");
-        Path jsonFile = Paths.get(jsonPath);
+        Path jsonFile = Path.of(jsonPath);
         Files.writeString(jsonFile, content, StandardCharsets.UTF_8);
 
     }
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/TestTomlValidator.java b/misc/toml-parser/src/test/java/toml/parser/test/TestTomlValidator.java
index 1a814f4e31c9..ed237e4b0082 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/TestTomlValidator.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/TestTomlValidator.java
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * A test class that prints results based on a schema and sample toml file.
@@ -41,10 +40,10 @@ private TestTomlValidator() {
     }
 
     public static void main(String [] args) throws IOException {
-        Path resourceDirectory = Paths.get("src", "test", "resources", "validator", "sample-schema.json");
+        Path resourceDirectory = Path.of("src", "test", "resources", "validator", "sample-schema.json");
         TomlValidator validator = new TomlValidator(Schema.from(resourceDirectory));
 
-        Path sampleInput = Paths.get("src", "test", "resources", "validator", "sample.toml");
+        Path sampleInput = Path.of("src", "test", "resources", "validator", "sample.toml");
 
         Toml toml = Toml.read(sampleInput);
         validator.validate(toml);
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/modifier/ModifierTest.java b/misc/toml-parser/src/test/java/toml/parser/test/modifier/ModifierTest.java
index dc33b00453fc..e01746a61da7 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/modifier/ModifierTest.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/modifier/ModifierTest.java
@@ -37,7 +37,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 
 /**
@@ -45,7 +44,7 @@
  */
 public class ModifierTest {
 
-    private final Path basePath = Paths.get("src", "test", "resources", "modifier");
+    private final Path basePath = Path.of("src", "test", "resources", "modifier");
 
     @Test
     public void testUpdate() throws IOException {
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/syntax/AbstractTomlParserTest.java b/misc/toml-parser/src/test/java/toml/parser/test/syntax/AbstractTomlParserTest.java
index d90d41efdf25..b1c22a13e725 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/syntax/AbstractTomlParserTest.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/syntax/AbstractTomlParserTest.java
@@ -20,7 +20,8 @@
 
 import toml.parser.test.ParserTestUtils;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Test util for testing toml.
@@ -33,7 +34,7 @@ public AbstractTomlParserTest(String resourceDirectoryName) {
     }
 
     void testFile(String path, String filePath) {
-        ParserTestUtils.test(Paths.get("syntax", resourceDirectoryName, path), Paths.get("syntax",
+        ParserTestUtils.test(Path.of("syntax", resourceDirectoryName, path), Path.of("syntax",
                 resourceDirectoryName, filePath));
     }
 }
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/validator/BoilerplateGeneratorTest.java b/misc/toml-parser/src/test/java/toml/parser/test/validator/BoilerplateGeneratorTest.java
index 0519793fd502..e41b98ca8dd0 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/validator/BoilerplateGeneratorTest.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/validator/BoilerplateGeneratorTest.java
@@ -27,7 +27,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Contains test cases to to boilerplate toml generation functionality.
@@ -37,28 +36,28 @@
 public class BoilerplateGeneratorTest {
     @Test
     public void testC2cSchema() throws IOException {
-        Path schemaPath = Paths.get("src", "test", "resources", "validator", "boilerplate", "c2c-schema.json");
+        Path schemaPath = Path.of("src", "test", "resources", "validator", "boilerplate", "c2c-schema.json");
         Schema rootSchema = Schema.from(schemaPath);
         BoilerplateGenerator generator = new BoilerplateGenerator(rootSchema);
         StringBuilder actual = new StringBuilder();
         for (DocumentMemberDeclarationNode s : generator.getNodes().values()) {
             actual.append(s.toSourceCode());
         }
-        Path expectedToml = Paths.get("src", "test", "resources", "validator", "boilerplate", "c2c-schema.toml");
+        Path expectedToml = Path.of("src", "test", "resources", "validator", "boilerplate", "c2c-schema.toml");
         String expected = Files.readString(expectedToml);
         Assert.assertEquals(actual.toString(), expected);
     }
 
     @Test
     public void testBasicSchema() throws IOException {
-        Path schemaPath = Paths.get("src", "test", "resources", "validator", "boilerplate", "basic-schema.json");
+        Path schemaPath = Path.of("src", "test", "resources", "validator", "boilerplate", "basic-schema.json");
         Schema rootSchema = Schema.from(schemaPath);
         BoilerplateGenerator generator = new BoilerplateGenerator(rootSchema);
         StringBuilder actual = new StringBuilder();
         for (DocumentMemberDeclarationNode s : generator.getNodes().values()) {
             actual.append(s.toSourceCode());
         }
-        Path expectedToml = Paths.get("src", "test", "resources", "validator", "boilerplate", "basic-schema.toml");
+        Path expectedToml = Path.of("src", "test", "resources", "validator", "boilerplate", "basic-schema.toml");
         String expected = Files.readString(expectedToml);
         Assert.assertEquals(actual.toString(), expected);
     }
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/validator/CustomErrorTest.java b/misc/toml-parser/src/test/java/toml/parser/test/validator/CustomErrorTest.java
index f28f9f8cb395..faeed6c96d1d 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/validator/CustomErrorTest.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/validator/CustomErrorTest.java
@@ -26,7 +26,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Contains test cases to to validate the custom error feature.
@@ -35,7 +34,7 @@
  */
 public class CustomErrorTest {
 
-    private final Path basePath = Paths.get("src", "test", "resources", "validator", "custom-error");
+    private final Path basePath = Path.of("src", "test", "resources", "validator", "custom-error");
 
     @Test
     public void testClean() throws IOException {
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/validator/SchemaTest.java b/misc/toml-parser/src/test/java/toml/parser/test/validator/SchemaTest.java
index 63699dead5f5..477e169a64af 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/validator/SchemaTest.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/validator/SchemaTest.java
@@ -25,7 +25,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Contains test cases to validate json schema input.
@@ -35,7 +34,7 @@
 public class SchemaTest {
     @Test
     public void ensureBooleanField() {
-        Path resourceDirectory = Paths.get("src", "test", "resources", "validator", "schema",
+        Path resourceDirectory = Path.of("src", "test", "resources", "validator", "schema",
                 "additional-properties-boolean.json");
         JsonSchemaException jsonSchemaException =
                 Assert.expectThrows(JsonSchemaException.class, () -> new TomlValidator(Schema.from(resourceDirectory)));
@@ -46,7 +45,7 @@ public void ensureBooleanField() {
 
     @Test
     public void ensureNumberField() {
-        Path resourceDirectory = Paths.get("src", "test", "resources", "validator", "schema",
+        Path resourceDirectory = Path.of("src", "test", "resources", "validator", "schema",
                 "min-number.json");
         JsonSchemaException jsonSchemaException =
                 Assert.expectThrows(JsonSchemaException.class, () -> new TomlValidator(Schema.from(resourceDirectory)));
@@ -57,7 +56,7 @@ public void ensureNumberField() {
 
     @Test
     public void ensureStringField() {
-        Path resourceDirectory = Paths.get("src", "test", "resources", "validator", "schema",
+        Path resourceDirectory = Path.of("src", "test", "resources", "validator", "schema",
                 "pattern-string.json");
         JsonSchemaException jsonSchemaException =
                 Assert.expectThrows(JsonSchemaException.class, () -> new TomlValidator(Schema.from(resourceDirectory)));
diff --git a/misc/toml-parser/src/test/java/toml/parser/test/validator/TomlValidateTest.java b/misc/toml-parser/src/test/java/toml/parser/test/validator/TomlValidateTest.java
index 2c1614911db3..8d2a4d5510ca 100644
--- a/misc/toml-parser/src/test/java/toml/parser/test/validator/TomlValidateTest.java
+++ b/misc/toml-parser/src/test/java/toml/parser/test/validator/TomlValidateTest.java
@@ -26,7 +26,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -38,7 +37,7 @@
  */
 public class TomlValidateTest {
 
-    private final Path basePath = Paths.get("src", "test", "resources", "validator", "basic");
+    private final Path basePath = Path.of("src", "test", "resources", "validator", "basic");
 
     @Test
     public void testClean() throws IOException {
diff --git a/misc/xml-to-record-converter/src/test/java/io/ballerina/xmltorecordconverter/XMLToRecordConverterTests.java b/misc/xml-to-record-converter/src/test/java/io/ballerina/xmltorecordconverter/XMLToRecordConverterTests.java
index 70b9a80c073c..7148606b9ac3 100644
--- a/misc/xml-to-record-converter/src/test/java/io/ballerina/xmltorecordconverter/XMLToRecordConverterTests.java
+++ b/misc/xml-to-record-converter/src/test/java/io/ballerina/xmltorecordconverter/XMLToRecordConverterTests.java
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 
@@ -35,7 +34,7 @@
  */
 public class XMLToRecordConverterTests {
 
-    private static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath();
+    private static final Path RES_DIR = Path.of("src/test/resources/").toAbsolutePath();
     private static final String XML_DIR = "xml";
     private static final String BAL_DIR = "ballerina";
 
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/BaseTest.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/BaseTest.java
index d48c5e81eb90..cf19c129ada3 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/BaseTest.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/BaseTest.java
@@ -37,7 +37,6 @@
 import java.io.PrintStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -52,9 +51,9 @@
  * @since 2.0.0
  */
 public class BaseTest {
-    static final Path USER_HOME = Paths.get("build").resolve("user-home");
+    static final Path USER_HOME = Path.of("build").resolve("user-home");
     static final PrintStream OUT = System.out;
-    static final Path CUSTOM_USER_HOME = Paths.get("build", "userHome");
+    static final Path CUSTOM_USER_HOME = Path.of("build", "userHome");
     static final Path CENTRAL_CACHE = CUSTOM_USER_HOME.resolve("repositories/central.ballerina.io");
 
     @BeforeSuite
@@ -160,7 +159,7 @@ private void cacheDependencyToCentralRepository(BuildProject dependencyProject,
 
     protected Path getBalaPath(String org, String pkgName, String version) {
         String ballerinaHome = System.getProperty("ballerina.home");
-        Path balaRepoPath = Paths.get(ballerinaHome).resolve("repo").resolve("bala");
+        Path balaRepoPath = Path.of(ballerinaHome).resolve("repo").resolve("bala");
         return balaRepoPath.resolve(org).resolve(pkgName).resolve(version).resolve("any");
     }
 
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyFilePathsTest.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyFilePathsTest.java
index d70b0fbd75bf..a4044dc1c23e 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyFilePathsTest.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyFilePathsTest.java
@@ -43,7 +43,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 import static io.ballerina.projects.test.TestUtils.replaceDistributionVersionOfDependenciesToml;
@@ -55,7 +54,7 @@
  */
 public class DependencyFilePathsTest extends BaseTest {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources").toAbsolutePath();
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources").toAbsolutePath();
     private static Path tempResourceDir;
 
     @BeforeClass
@@ -111,13 +110,13 @@ public void testGetDependencyFilePathFromBuildProject() throws IOException {
             }
         }
         assert filepath != null;
-        Path expectedPath = Paths.get("build/repo/bala/samjs/package_b/0.1.0/any/modules/package_b.mod_b1")
+        Path expectedPath = Path.of("build/repo/bala/samjs/package_b/0.1.0/any/modules/package_b.mod_b1")
                 .resolve("mod1.bal").toAbsolutePath();
         Assert.assertEquals(filepath.toString(), expectedPath.toString());
 
         // get document id of dependency filepath
         Project balaProject = TestUtils.loadProject(
-                Paths.get("build/repo/bala/samjs/package_b/0.1.0/any/"));
+                Path.of("build/repo/bala/samjs/package_b/0.1.0/any/"));
         DocumentId documentId1 = balaProject.documentId(filepath);
 
         Module mod1 = balaProject.currentPackage().module(
@@ -169,13 +168,13 @@ public void testGetLangLibFilePath() throws IOException {
         }
 
         assert filepath != null;
-        Path expectedPath = Paths.get("build/repo/bala/ballerina/lang.float/0.0.0/any/modules/lang.float")
+        Path expectedPath = Path.of("build/repo/bala/ballerina/lang.float/0.0.0/any/modules/lang.float")
                 .resolve("float.bal").toAbsolutePath();
         Assert.assertEquals(filepath.toString(), expectedPath.toString());
 
         // get document id of dependency filepath
         Project balaProject = TestUtils.loadProject(
-                Paths.get("build/repo/bala/ballerina/lang.float/0.0.0/any"));
+                Path.of("build/repo/bala/ballerina/lang.float/0.0.0/any"));
         DocumentId documentId1 = balaProject.documentId(filepath);
         Assert.assertEquals(documentId1,
                 balaProject.currentPackage().getDefaultModule().documentIds().stream().findFirst().get());
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyGraphTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyGraphTests.java
index 42191cfd366c..84eb0d3d17aa 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyGraphTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/DependencyGraphTests.java
@@ -56,7 +56,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -77,7 +76,7 @@
  * @since 2.0.0
  */
 public class DependencyGraphTests extends BaseTest {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources").toAbsolutePath();
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources").toAbsolutePath();
     private static final ResolutionOptions resolutionOptions = ResolutionOptions.builder().setOffline(true).build();
     ProjectEnvironmentBuilder projectEnvironmentBuilder;
     private static Path tempResourceDir;
@@ -399,7 +398,7 @@ public void testMissingTransitiveDependency() throws IOException {
 
         // The bir of the direct dependency should be removed since the compiler throws
         // an exception when compiling with the BIR
-        ProjectUtils.deleteDirectory(Paths.get("build/repo/cache/samjs/package_b/0.1.0"));
+        ProjectUtils.deleteDirectory(Path.of("build/repo/cache/samjs/package_b/0.1.0"));
 
         project.currentPackage().getCompilation();
         // verify that the compiler package cache contains package_b but not package_c
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/HierarchicalPackageNameTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/HierarchicalPackageNameTests.java
index c0c30a9f859a..059ffbd8a27b 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/HierarchicalPackageNameTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/HierarchicalPackageNameTests.java
@@ -41,7 +41,6 @@
 
 import java.io.PrintStream;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -53,10 +52,10 @@
  * @since 2.0.0
  */
 public class HierarchicalPackageNameTests {
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/hierarchical_pkg_names").toAbsolutePath();
     private static final PrintStream out = System.out;
-    Path customUserHome = Paths.get("build", "userHome");
+    Path customUserHome = Path.of("build", "userHome");
 
     @BeforeTest
     public void setup() {
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/OldPackageMigrationTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/OldPackageMigrationTests.java
index 72d6ee51f6d8..dc79ef271ded 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/OldPackageMigrationTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/OldPackageMigrationTests.java
@@ -33,7 +33,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.Iterator;
 
@@ -53,7 +52,7 @@
 public class OldPackageMigrationTests extends BaseTest {
 
     private static final Path RESOURCE_DIRECTORY =
-            Paths.get("src/test/resources/projects_for_resolution_tests").toAbsolutePath();
+            Path.of("src/test/resources/projects_for_resolution_tests").toAbsolutePath();
     private static Path tempResourceDir;
 
     @BeforeClass
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionIntegrationTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionIntegrationTests.java
index a384825a8184..b9e0461a8db0 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionIntegrationTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionIntegrationTests.java
@@ -38,7 +38,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.stream.Stream;
 
 import static io.ballerina.projects.test.TestUtils.assertTomlFilesEquals;
@@ -57,13 +56,13 @@
  */
 public class PackageResolutionIntegrationTests extends BaseTest {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/projects_for_resolution_integration_tests").toAbsolutePath();
     private static Path tempResourceDir;
     private static Path distVersionResourcesDirectory;
-    private static final Path testBuildDirectory = Paths.get("build").toAbsolutePath();
+    private static final Path testBuildDirectory = Path.of("build").toAbsolutePath();
     private static final Path testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY);
-    Path customUserHome = Paths.get("build", "user-home");
+    Path customUserHome = Path.of("build", "user-home");
     Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build();
     ProjectEnvironmentBuilder projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment);
 
@@ -71,7 +70,7 @@ public class PackageResolutionIntegrationTests extends BaseTest {
     public void setup() throws IOException {
         tempResourceDir = Files.createTempDirectory("project-api-test");
         FileUtils.copyDirectory(RESOURCE_DIRECTORY.toFile(), tempResourceDir.toFile());
-        distVersionResourcesDirectory = Paths.get(String.valueOf(tempResourceDir))
+        distVersionResourcesDirectory = Path.of(String.valueOf(tempResourceDir))
                 .resolve("projects_for_distribution_version_increment_tests");
     }
 
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java
index 833ec90bd609..22fa2051cb89 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java
@@ -79,7 +79,6 @@
 import java.lang.management.OperatingSystemMXBean;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -99,10 +98,10 @@
  */
 @Test(groups = "broken")
 public class PackageResolutionTests extends BaseTest {
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/projects_for_resolution_tests").toAbsolutePath();
     private static Path tempResourceDir;
-    private static final Path testBuildDirectory = Paths.get("build").toAbsolutePath();
+    private static final Path testBuildDirectory = Path.of("build").toAbsolutePath();
 
     @BeforeTest
     public void setup() throws IOException {
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PreReleaseVersionResolutionTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PreReleaseVersionResolutionTests.java
index d32591c98963..047894a91787 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PreReleaseVersionResolutionTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PreReleaseVersionResolutionTests.java
@@ -34,7 +34,6 @@
 
 import java.io.PrintStream;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 /**
@@ -43,7 +42,7 @@
  * @since 2.0.0
  */
 public class PreReleaseVersionResolutionTests {
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/projects_for_resolution_tests").toAbsolutePath();
     static final PrintStream OUT = System.out;
 
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/SubsequentBuildTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/SubsequentBuildTests.java
index 68f1fdc18fde..3e4d679b31d8 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/SubsequentBuildTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/SubsequentBuildTests.java
@@ -33,7 +33,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import static io.ballerina.projects.test.TestUtils.assertTomlFilesEquals;
 import static io.ballerina.projects.test.TestUtils.replaceDistributionVersionOfDependenciesToml;
@@ -51,7 +50,7 @@
 public class SubsequentBuildTests {
 
     private static final Path RESOURCE_DIRECTORY =
-            Paths.get("src/test/resources/projects_for_resolution_tests").toAbsolutePath();
+            Path.of("src/test/resources/projects_for_resolution_tests").toAbsolutePath();
     private static Path tempResourceDir;
     private static final PrintStream OUT = System.out;
     private Path packagePath;
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaProject.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaProject.java
index 8a0b7f3199fb..2c1e1ddbeb5d 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaProject.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaProject.java
@@ -52,7 +52,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -65,7 +64,7 @@
  */
 public class TestBalaProject {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
 
     @Test(description = "tests loading a valid bala project")
     public void testBalaProjectAPI() {
@@ -229,7 +228,7 @@ public void testGetDocumentIdFromPathInExtractedBala() {
 
         // try to get id of a non-existing file
         try {
-            balaProject.documentId(Paths.get("foo.bal"));
+            balaProject.documentId(Path.of("foo.bal"));
             Assert.fail("expected a ProjectException");
         } catch (ProjectException e) {
             // ignore
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaWriter.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaWriter.java
index ce3665f3096e..5f384aa9b852 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaWriter.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBalaWriter.java
@@ -49,7 +49,6 @@
 import java.nio.file.AccessDeniedException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -67,7 +66,7 @@
  * @since 2.0.0
  */
 public class TestBalaWriter {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path BALA_WRITER_RESOURCES = RESOURCE_DIRECTORY.resolve("balawriter");
     private static final String PACKAGE_PATH = "packagePath";
     private Path tmpDir;
@@ -77,7 +76,7 @@ public class TestBalaWriter {
     public void setUp() throws IOException {
         this.tmpDir = Files.createTempDirectory("b7a-bala-writer-test-" + System.nanoTime());
         this.balaExportPath = this.tmpDir.resolve("tmpBalaDir");
-        Files.createDirectory(Paths.get(String.valueOf(this.balaExportPath)));
+        Files.createDirectory(Path.of(String.valueOf(this.balaExportPath)));
     }
 
     @Test
@@ -156,7 +155,7 @@ public void testBalaWriter(ITestContext ctx) throws IOException {
             Assert.assertEquals(packageJson.getImplementationVendor(), "WSO2");
             Assert.assertEquals(packageJson.getLanguageSpecVersion(), RepoUtils.getBallerinaSpecVersion());
 
-            Assert.assertEquals(Paths.get(packageJson.getIcon()), Paths.get("docs/samplePng01.png"));
+            Assert.assertEquals(Path.of(packageJson.getIcon()), Path.of("docs/samplePng01.png"));
             Assert.assertTrue(balaExportPath.resolve(packageJson.getIcon()).toFile().exists());
         }
 
@@ -219,13 +218,13 @@ public void testBalaWriter(ITestContext ctx) throws IOException {
         Assert.assertTrue(nonDefaultModuleIncludeImageFile.toFile().exists());
 
         // package resources
-        Assert.assertTrue(balaExportPath.resolve(Paths.get("resources", "main.json")).toFile().exists());
+        Assert.assertTrue(balaExportPath.resolve(Path.of("resources", "main.json")).toFile().exists());
         // module sources
         // default module
         Path defaultModuleSrcPath = balaExportPath.resolve("modules").resolve("winery");
         Assert.assertTrue(defaultModuleSrcPath.toFile().exists());
-        Assert.assertTrue(defaultModuleSrcPath.resolve(Paths.get("main.bal")).toFile().exists());
-        Assert.assertTrue(defaultModuleSrcPath.resolve(Paths.get("utils.bal")).toFile().exists());
+        Assert.assertTrue(defaultModuleSrcPath.resolve(Path.of("main.bal")).toFile().exists());
+        Assert.assertTrue(defaultModuleSrcPath.resolve(Path.of("utils.bal")).toFile().exists());
         Assert.assertFalse(defaultModuleSrcPath.resolve("modules").toFile().exists());
         Assert.assertFalse(defaultModuleSrcPath.resolve("tests").toFile().exists());
         Assert.assertFalse(defaultModuleSrcPath.resolve("targets").toFile().exists());
@@ -342,7 +341,7 @@ public void testBalaWriterWithMinimalBalProject(ITestContext ctx) throws IOExcep
         // module sources
         Path defaultModuleSrcPath = balaExportPath.resolve("modules").resolve("winery");
         Assert.assertTrue(defaultModuleSrcPath.toFile().exists());
-        Assert.assertTrue(defaultModuleSrcPath.resolve(Paths.get("main.bal")).toFile().exists());
+        Assert.assertTrue(defaultModuleSrcPath.resolve(Path.of("main.bal")).toFile().exists());
     }
 
     @Test
@@ -441,7 +440,7 @@ public void testBalaWriterWithToolProject(ITestContext ctx) throws IOException {
         // module sources
         Path defaultModuleSrcPath = balaExportPath.resolve("modules").resolve("tool_test");
         Assert.assertTrue(defaultModuleSrcPath.toFile().exists());
-        Path mainFilePath = defaultModuleSrcPath.resolve(Paths.get("main.bal"));
+        Path mainFilePath = defaultModuleSrcPath.resolve(Path.of("main.bal"));
         Assert.assertTrue(mainFilePath.toFile().exists());
         String expectedMainContent = """
                 // AUTO-GENERATED FILE.
@@ -496,7 +495,7 @@ public void testBalaWriterWithTwoDirectDependencies(ITestContext ctx) throws IOE
         // default module
         Path defaultModuleSrcPath = balaExportPath.resolve("modules").resolve("package_d");
         Assert.assertTrue(defaultModuleSrcPath.toFile().exists());
-        Assert.assertTrue(defaultModuleSrcPath.resolve(Paths.get("main.bal")).toFile().exists());
+        Assert.assertTrue(defaultModuleSrcPath.resolve(Path.of("main.bal")).toFile().exists());
 
         // dependencies.json
         Path dependencyGraphJsonPath = balaExportPath.resolve(DEPENDENCY_GRAPH_JSON);
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBirAndJarCache.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBirAndJarCache.java
index 41dc5e89cd6f..207e15d0c166 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBirAndJarCache.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBirAndJarCache.java
@@ -41,7 +41,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 import java.util.stream.Stream;
 
@@ -55,7 +54,7 @@
  * @since 2.0.0
  */
 public class TestBirAndJarCache {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     @Test(description = "tests writing of the BIR and Jar files")
     public void testBirAndJarCaching() throws IOException {
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProject.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProject.java
index 2e6c049362b4..816c812632d5 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProject.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProject.java
@@ -79,7 +79,6 @@
 import java.io.PrintStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -116,7 +115,7 @@
  * @since 2.0.0
  */
 public class TestBuildProject extends BaseTest {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
     private static Path tempResourceDir;
     static final PrintStream OUT = System.out;
     private final String dummyContent = "function foo() {\n}";
@@ -186,7 +185,7 @@ public void testBuildProjectWithInvalidDependencyPaths() {
         JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
         Assert.assertEquals(jBallerinaBackend.diagnosticResult().errorCount(), 1);
 
-        EmitResult emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, Paths.get("test.jar"));
+        EmitResult emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, Path.of("test.jar"));
         Assert.assertFalse(emitResult.successful());
 
         emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.BALA, projectPath);
@@ -293,11 +292,11 @@ public void testDiagnostics() {
         Assert.assertEquals(jBallerinaBackend.diagnosticResult().diagnosticCount(), 12);
 
         List expectedPaths = Arrays.asList(
-                Paths.get("modules").resolve("utils").resolve("utils.bal").toString(),
-                Paths.get("modules").resolve("storage").resolve("db.bal").toString(),
-                Paths.get("modules").resolve("services").resolve("svc.bal").toString(),
-                Paths.get("modules").resolve("services").resolve("tests").resolve("svc_tests.bal").toString(),
-                Paths.get("tests").resolve("main_tests.bal").toString(),
+                Path.of("modules").resolve("utils").resolve("utils.bal").toString(),
+                Path.of("modules").resolve("storage").resolve("db.bal").toString(),
+                Path.of("modules").resolve("services").resolve("svc.bal").toString(),
+                Path.of("modules").resolve("services").resolve("tests").resolve("svc_tests.bal").toString(),
+                Path.of("tests").resolve("main_tests.bal").toString(),
                 "main.bal", "utils.bal");
 
         // Verify paths in packageCompilation diagnostics
@@ -1385,7 +1384,7 @@ public function concatStrings(string a, string b) returns string {
         Assert.assertEquals(diagnosticResult.diagnosticCount(), 1);
 
         Assert.assertEquals(diagnosticResult.diagnostics().stream().findAny().get().location().lineRange().fileName(),
-                Paths.get("modules").resolve("schema").resolve("schema.bal").toString());
+                Path.of("modules").resolve("schema").resolve("schema.bal").toString());
         Assert.assertTrue(diagnosticResult.diagnostics().stream().findAny().get().message()
                 .contains("unknown type 'PersonalDetails'"));
     }
@@ -2258,14 +2257,14 @@ public void testDocumentsOrder() {
                 diagnostic.location().lineRange().fileName()).distinct().toList();
 
         List expectedDiagnosticPaths = Arrays.asList(
-                "main.bal", Paths.get("tests").resolve("main_test.bal").toString(),
-                Paths.get("tests").resolve("utils_test.bal").toString(), "utils.bal",
-                Paths.get("modules").resolve("services").resolve("auth.bal").toString(),
-                Paths.get("modules").resolve("services").resolve("subscribe.bal").toString(),
-                Paths.get("modules").resolve("services").resolve("update.bal").toString(),
-                Paths.get("modules").resolve("storage").resolve("db.bal").toString(),
-                Paths.get("modules").resolve("storage").resolve("tests").resolve("db_test.bal").toString(),
-                Paths.get("modules").resolve("utils").resolve("utils.bal").toString());
+                "main.bal", Path.of("tests").resolve("main_test.bal").toString(),
+                Path.of("tests").resolve("utils_test.bal").toString(), "utils.bal",
+                Path.of("modules").resolve("services").resolve("auth.bal").toString(),
+                Path.of("modules").resolve("services").resolve("subscribe.bal").toString(),
+                Path.of("modules").resolve("services").resolve("update.bal").toString(),
+                Path.of("modules").resolve("storage").resolve("db.bal").toString(),
+                Path.of("modules").resolve("storage").resolve("tests").resolve("db_test.bal").toString(),
+                Path.of("modules").resolve("utils").resolve("utils.bal").toString());
 
         assertEquals(actualDiagnosticPaths.size(), 10);
         assertEquals(actualDiagnosticPaths, expectedDiagnosticPaths);
@@ -2283,7 +2282,7 @@ private List getDocumentFileNames(Module module, Collection
     public void testConflictingJars() {
         Path dep1Path = tempResourceDir.resolve("conflicting_jars_test/platformLibPkg1").toAbsolutePath();
         Path dep2Path = tempResourceDir.resolve("conflicting_jars_test/platformLibPkg2").toAbsolutePath();
-        Path customUserHome = Paths.get("build", "userHome");
+        Path customUserHome = Path.of("build", "userHome");
         Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build();
         ProjectEnvironmentBuilder envBuilder = ProjectEnvironmentBuilder.getBuilder(environment);
 
@@ -2329,7 +2328,7 @@ public void testConflictingJars() {
                 CENTRAL_CACHE.resolve("bala/ballerina/platformLibPkg2/0.1.0/java17/platform/java17/lib4.txt"),
                 PlatformLibraryScope.DEFAULT)));
         Assert.assertTrue(jarLibraries.contains(new JarLibrary(
-                Paths.get("src/test/resources/conflicting_jars_test/platformLibPkg3/" +
+                Path.of("src/test/resources/conflicting_jars_test/platformLibPkg3/" +
                         "target/cache/user/platformLibPkg3/0.1.0/java17/user-platformLibPkg3-0.1.0.jar"),
                 PlatformLibraryScope.DEFAULT)));
         Assert.assertTrue(jarLibraries.contains(new JarLibrary(
@@ -2349,7 +2348,7 @@ public void testConflictingJars() {
     @Test (description = "tests platform dependency resolution with provided scope for build project")
     public void testProvidedScopeJars() {
         Path dep1Path = tempResourceDir.resolve("provided_jars_tests/jars_provided/pkg_a").toAbsolutePath();
-        Path customUserHome = Paths.get("build", "userHome");
+        Path customUserHome = Path.of("build", "userHome");
         Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build();
         ProjectEnvironmentBuilder envBuilder = ProjectEnvironmentBuilder.getBuilder(environment);
 
@@ -2381,7 +2380,7 @@ public void testProvidedScopeJars() {
     @Test (description = "tests platform dependency resolution with missing 'provided' jars for build project")
     public void testMissingProvidedScopeJars() {
         Path dep1Path = tempResourceDir.resolve("provided_jars_tests/jars_not_provided/pkg_a").toAbsolutePath();
-        Path customUserHome = Paths.get("build", "userHome");
+        Path customUserHome = Path.of("build", "userHome");
         Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build();
         ProjectEnvironmentBuilder envBuilder = ProjectEnvironmentBuilder.getBuilder(environment);
 
@@ -2399,7 +2398,7 @@ public void testMissingProvidedScopeJars() {
             if (jBallerinaBackend.diagnosticResult().hasErrors()) {
                 Assert.fail("unexpected compilation failure:\n" + getErrorsAsString(compilation.diagnosticResult()));
             }
-            jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, Paths.get("test.jar"));
+            jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, Path.of("test.jar"));
         } catch (ProjectException e) {
             Assert.assertEquals(e.getMessage(), "cannot resolve 'com.example:project1:1.0'. Dependencies with " +
                     "'provided' scope need to be manually added to Ballerina.toml.");
@@ -2412,7 +2411,7 @@ public void testMissingProvidedScopeJars() {
     public void testConflictingJarsInNonBalPackages() {
         Path dep1Path = tempResourceDir.resolve("conflicting_jars_test/platformLibNonBalPkg1").toAbsolutePath();
         Path dep2Path = tempResourceDir.resolve("conflicting_jars_test/platformLibNonBalPkg2").toAbsolutePath();
-        Path customUserHome = Paths.get("build", "userHome");
+        Path customUserHome = Path.of("build", "userHome");
         Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build();
         ProjectEnvironmentBuilder envBuilder = ProjectEnvironmentBuilder.getBuilder(environment);
 
@@ -2435,7 +2434,7 @@ public void testConflictingJarsInNonBalPackages() {
             Assert.fail("unexpected compilation failure:\n" + getErrorsAsString(compilation.diagnosticResult()));
         }
 
-        EmitResult emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, Paths.get("test.jar"));
+        EmitResult emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, Path.of("test.jar"));
 
         Assert.assertFalse(emitResult.diagnostics().hasErrors());
         Assert.assertTrue(emitResult.diagnostics().hasWarnings());
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProjectWithGeneratedSources.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProjectWithGeneratedSources.java
index 727e64cbcdd9..d221258fadce 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProjectWithGeneratedSources.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestBuildProjectWithGeneratedSources.java
@@ -33,7 +33,6 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.Optional;
 
@@ -46,7 +45,7 @@
  * @since 2201.4.0
  */
 public class TestBuildProjectWithGeneratedSources extends BaseTest {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/generated-sources-tests/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/generated-sources-tests/");
 
     @Test (description = "tests loading a valid build project with generated sources")
     public void testBuildProjectAPI() {
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestConcurrentProjectAccess.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestConcurrentProjectAccess.java
index 6d62d82778f7..a3d530fe5421 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestConcurrentProjectAccess.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestConcurrentProjectAccess.java
@@ -32,7 +32,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import static io.ballerina.projects.test.TestUtils.replaceDistributionVersionOfDependenciesToml;
 
@@ -43,9 +42,9 @@
  */
 public class TestConcurrentProjectAccess {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/projects_for_resolution_tests").toAbsolutePath();
-    private static final Path REPO_BALA_DIRECTORY = Paths.get(
+    private static final Path REPO_BALA_DIRECTORY = Path.of(
             "build/repo/bala/").toAbsolutePath();
     private static Path tempResourceDir;
 
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestExportModules.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestExportModules.java
index 39f34f560c4f..fb72f4ac5975 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestExportModules.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestExportModules.java
@@ -29,7 +29,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Arrays;
 
 /**
@@ -38,7 +37,7 @@
  * @since 2.0.0
  */
 public class TestExportModules {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
     private static final Path EXPORT_MODULES = RESOURCE_DIRECTORY.resolve("export_modules");
 
     @Test(description = "tests loading a valid bala project with export in package.json")
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestSingleFileProject.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestSingleFileProject.java
index 2499aa80f0db..3590d6be61a1 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestSingleFileProject.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestSingleFileProject.java
@@ -39,7 +39,6 @@
 import org.wso2.ballerinalang.compiler.util.CompilerContext;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 import static io.ballerina.projects.test.TestUtils.isWindows;
@@ -51,7 +50,7 @@
  * @since 2.0.0
  */
 public class TestSingleFileProject {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     @Test (description = "tests loading a valid standalone Ballerina file")
     public void testLoadSingleFile() {
@@ -87,7 +86,7 @@ public void testSingleFileTargetDirectory() {
         Path targetDirPath = project.targetDir();
         Assert.assertNotNull(targetDirPath);
         Assert.assertTrue(targetDirPath.toFile().exists());
-        Assert.assertEquals(Paths.get(System.getProperty("java.io.tmpdir")), targetDirPath.getParent());
+        Assert.assertEquals(Path.of(System.getProperty("java.io.tmpdir")), targetDirPath.getParent());
     }
 
     @Test (description = "tests loading a valid standalone Ballerina file")
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestTarget.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestTarget.java
index 3ba0bb0edef2..3d70dc70c933 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestTarget.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestTarget.java
@@ -25,7 +25,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Contains tests related to the target directory of a project.
@@ -33,7 +32,7 @@
  * @since 2.0.0
  */
 public class TestTarget {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     @Test(description = "tests writing of the BIR")
     public void testTarget() throws IOException {
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestUnknownTypeProject.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestUnknownTypeProject.java
index 03c36eb10eeb..b5f5a3f2f25a 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestUnknownTypeProject.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/TestUnknownTypeProject.java
@@ -28,7 +28,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 
 /**
@@ -37,7 +36,7 @@
  * @since 2.0.0
  */
 public class TestUnknownTypeProject {
-    private static final Path RESOURCE_DIRECTORY = Paths.get("src/test/resources/");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/");
 
     @Test (description = "tests loading a file from the default module")
     public void testLoadProjectByDefaultModuleFile() {
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginNegativeTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginNegativeTests.java
index b9fd6eaabe3b..2c84f6fed0a5 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginNegativeTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginNegativeTests.java
@@ -23,7 +23,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Contains negative cases to test compiler plugin loading and running.
@@ -58,7 +57,7 @@ public class CompilerPluginNegativeTests {
     private static final String EXCEPTION_MESSAGE_41 = "The compiler extension in package " +
             "'samjs:package_compiler_plugin_41:1.1.0' failed to complete. The value cannot be less than zero";
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/compiler_plugin_tests/negative_cases").toAbsolutePath();
 
     @Test(expectedExceptions = ProjectException.class, expectedExceptionsMessageRegExp = EXCEPTION_MESSAGE_1)
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginTests.java
index bf2788d3a810..2cf6af15bdd1 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/CompilerPluginTests.java
@@ -52,7 +52,6 @@
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Iterator;
@@ -66,7 +65,7 @@
  */
 public class CompilerPluginTests {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/compiler_plugin_tests").toAbsolutePath();
     private static final PrintStream OUT = System.out;
     private static final String PLUGIN_OP_FILE_PATH = "./src/test/resources/compiler_plugin_tests/" +
@@ -183,7 +182,7 @@ public void testInBuiltCompilerPluginBuildProject() throws IOException {
         Assert.assertEquals(diagnosticResult.errorCount(), 1);
         Assert.assertEquals(diagnosticResult.warningCount(), 2);
 
-        Path logFilePath = Paths.get("build/logs/diagnostics.log");
+        Path logFilePath = Path.of("build/logs/diagnostics.log");
         Assert.assertTrue(Files.exists(logFilePath));
         String logFileContent = Files.readString(logFilePath, Charset.defaultCharset());
         Assert.assertTrue(logFileContent.contains(diagnosticResult.warnings().stream().findFirst().get().toString()));
@@ -201,7 +200,7 @@ public void testInBuiltCompilerPluginSingleFile() throws IOException {
         Assert.assertEquals(diagnosticResult.errorCount(), 1);
         Assert.assertEquals(diagnosticResult.warningCount(), 1);
 
-        Path logFilePath = Paths.get("build/logs/single-file/diagnostics.log");
+        Path logFilePath = Path.of("build/logs/single-file/diagnostics.log");
         Assert.assertTrue(Files.exists(logFilePath));
         String logFileContent = Files.readString(logFilePath, Charset.defaultCharset());
         Assert.assertTrue(logFileContent.contains(diagnosticResult.warnings().stream().findFirst().get().toString()));
@@ -351,7 +350,7 @@ public void testCompilerPluginCodeModifyBasic() {
 
     @Test(description = "Test a combination of in-built and package provided compiler plugins")
     public void testCombinationOfCompilerPlugins() throws IOException {
-        Path logFile = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath();
+        Path logFile = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath();
         Files.writeString(logFile, "");
         Package currentPackage = loadPackage("log_creator_combined_plugin");
         currentPackage.getCompilation();
@@ -666,7 +665,7 @@ private void acquireLock() {
 
     private void releaseLock() {
         try {
-            Files.delete(Paths.get(PLUGIN_LOCK_FILE_PATH));
+            Files.delete(Path.of(PLUGIN_LOCK_FILE_PATH));
         } catch (IOException e) {
             throw new RuntimeException(
                     "Error while deleting the lock file: " + PLUGIN_LOCK_FILE_PATH + " " + e.getMessage());
@@ -675,7 +674,7 @@ private void releaseLock() {
 
     @AfterSuite
     private void cleanup() throws IOException {
-        Path logFile = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath();
+        Path logFile = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath();
         Files.delete(logFile);
     }
 }
diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/LanguageServerExtensionTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/LanguageServerExtensionTests.java
index 6fe39b80cbf0..3f5a556dbbd5 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/LanguageServerExtensionTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/plugins/LanguageServerExtensionTests.java
@@ -64,7 +64,6 @@
 import org.wso2.ballerinalang.compiler.diagnostic.properties.BSymbolicProperty;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.List;
 import java.util.Optional;
 
@@ -74,7 +73,7 @@
 @Test
 public class LanguageServerExtensionTests {
 
-    private static final Path RESOURCE_DIRECTORY = Paths.get(
+    private static final Path RESOURCE_DIRECTORY = Path.of(
             "src/test/resources/compiler_plugin_tests").toAbsolutePath();
 
     @BeforeSuite
@@ -88,7 +87,7 @@ public void testOneCompilerPluginWithOneCodeAction() {
         String path = RESOURCE_DIRECTORY.resolve("package_plugin_user_with_codeactions_1").toString();
         CompileResult result = BCompileUtil.compileAndCacheBala(path);
 
-        Path filePath = Paths.get(path, "main.bal");
+        Path filePath = Path.of(path, "main.bal");
         Project project = result.project();
         DocumentId documentId = project.documentId(filePath);
         Module module = project.currentPackage().module(documentId.moduleId());
@@ -159,7 +158,7 @@ public void testOneCompilerPluginWithOneCompletionProvider(String sourceDir, int
         Project project = result.project();
         PackageCompilation packageCompilation = project.currentPackage().getCompilation();
         CompletionManager completionManager = packageCompilation.getCompletionManager();
-        Path filePath = Paths.get(path, "main.bal");
+        Path filePath = Path.of(path, "main.bal");
         DocumentId documentId = project.documentId(filePath);
         Module module = project.currentPackage().module(documentId.moduleId());
         Document document = module.document(documentId);
@@ -202,7 +201,7 @@ public void testOneCompilerPluginWithOneCompletionProviderNegative1() {
         Project project = result.project();
         PackageCompilation packageCompilation = project.currentPackage().getCompilation();
         CompletionManager completionManager = packageCompilation.getCompletionManager();
-        Path filePath = Paths.get(path, "main.bal");
+        Path filePath = Path.of(path, "main.bal");
         DocumentId documentId = project.documentId(filePath);
         Module module = project.currentPackage().module(documentId.moduleId());
         Document document = module.document(documentId);
@@ -233,7 +232,7 @@ public void testOneCompilerPluginWithOneCompletionProviderNegative2() {
         Project project = result.project();
         PackageCompilation packageCompilation = project.currentPackage().getCompilation();
         CompletionManager completionManager = packageCompilation.getCompletionManager();
-        Path filePath = Paths.get(path, "main.bal");
+        Path filePath = Path.of(path, "main.bal");
         DocumentId documentId = project.documentId(filePath);
         Module module = project.currentPackage().module(documentId.moduleId());
         Document document = module.document(documentId);
diff --git a/project-api/test-artifacts/compiler-plugin-with-analyzer-generator-modifier/src/main/java/io/gayal/plugins/combined/CombinedCompilerPlugin.java b/project-api/test-artifacts/compiler-plugin-with-analyzer-generator-modifier/src/main/java/io/gayal/plugins/combined/CombinedCompilerPlugin.java
index 272ea84dfab9..567b3e81244e 100644
--- a/project-api/test-artifacts/compiler-plugin-with-analyzer-generator-modifier/src/main/java/io/gayal/plugins/combined/CombinedCompilerPlugin.java
+++ b/project-api/test-artifacts/compiler-plugin-with-analyzer-generator-modifier/src/main/java/io/gayal/plugins/combined/CombinedCompilerPlugin.java
@@ -31,7 +31,7 @@
 import java.io.Writer;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Locale;
 
 enum CodeType {
@@ -105,7 +105,7 @@ private void acquireLock() {
 
     private void releaseLock() {
         try {
-            Files.delete(Paths.get(lockFilePath));
+            Files.delete(Path.of(lockFilePath));
         } catch (IOException e) {
             throw new RuntimeException(
                     "Error while deleting the lock file: " + lockFilePath + " " + e.getMessage());
diff --git a/project-api/test-artifacts/logging-file-appender-plugin/src/main/java/io/ballerina/plugins/logging/appender/FileAppenderPlugin.java b/project-api/test-artifacts/logging-file-appender-plugin/src/main/java/io/ballerina/plugins/logging/appender/FileAppenderPlugin.java
index 06d9f0ded28a..a557b649f006 100644
--- a/project-api/test-artifacts/logging-file-appender-plugin/src/main/java/io/ballerina/plugins/logging/appender/FileAppenderPlugin.java
+++ b/project-api/test-artifacts/logging-file-appender-plugin/src/main/java/io/ballerina/plugins/logging/appender/FileAppenderPlugin.java
@@ -27,7 +27,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.Optional;
 
@@ -56,9 +55,9 @@ public void init(CodeAnalysisContext analysisContext) {
                     throw new UnsupportedOperationException();
                 }
                 if (compilationAnalysisContext.currentPackage().project().kind().equals(ProjectKind.BUILD_PROJECT)) {
-                    logFilePath = Paths.get("build/logs/diagnostics.log").toAbsolutePath();
+                    logFilePath = Path.of("build/logs/diagnostics.log").toAbsolutePath();
                 } else {
-                    logFilePath = Paths.get("build/logs/single-file/diagnostics.log").toAbsolutePath();
+                    logFilePath = Path.of("build/logs/single-file/diagnostics.log").toAbsolutePath();
                 }
                 StringBuilder logs = new StringBuilder();
                 compilationAnalysisContext.compilation().diagnosticResult().diagnostics().forEach(
diff --git a/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/BCompileUtil.java b/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/BCompileUtil.java
index 89cb62d24209..9fc20c3c4bfe 100644
--- a/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/BCompileUtil.java
+++ b/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/BCompileUtil.java
@@ -41,7 +41,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.stream.Stream;
 
 import static io.ballerina.projects.util.ProjectConstants.CACHES_DIR_NAME;
@@ -54,8 +53,8 @@
  */
 public final class BCompileUtil {
 
-    private static final Path testSourcesDirectory = Paths.get("src/test/resources").toAbsolutePath().normalize();
-    private static final Path testBuildDirectory = Paths.get("build").toAbsolutePath().normalize();
+    private static final Path testSourcesDirectory = Path.of("src/test/resources").toAbsolutePath().normalize();
+    private static final Path testBuildDirectory = Path.of("build").toAbsolutePath().normalize();
 
     private static final Logger logger = LoggerFactory.getLogger(BCompileUtil.class);
 
@@ -67,11 +66,11 @@ public static Project loadProject(String sourceFilePath) {
     }
 
     public static Project loadProject(String sourceFilePath, BuildOptions buildOptions) {
-        Path sourcePath = Paths.get(sourceFilePath);
+        Path sourcePath = Path.of(sourceFilePath);
         String sourceFileName = sourcePath.getFileName().toString();
         Path sourceRoot = testSourcesDirectory.resolve(sourcePath.getParent());
 
-        Path projectPath = Paths.get(sourceRoot.toString(), sourceFileName);
+        Path projectPath = Path.of(sourceRoot.toString(), sourceFileName);
 
         BuildOptions defaultOptions;
         try {
@@ -161,10 +160,10 @@ public static CompileResult compileAndCacheBala(String sourceFilePath, Path repo
 
     public static CompileResult compileAndCacheBala(String sourceFilePath, Path repoPath,
                                              ProjectEnvironmentBuilder projectEnvironmentBuilder) {
-        Path sourcePath = Paths.get(sourceFilePath);
+        Path sourcePath = Path.of(sourceFilePath);
         String sourceFileName = sourcePath.getFileName().toString();
         Path sourceRoot = testSourcesDirectory.resolve(sourcePath.getParent());
-        Path projectPath = Paths.get(sourceRoot.toString(), sourceFileName);
+        Path projectPath = Path.of(sourceRoot.toString(), sourceFileName);
 
         return compileAndCacheBala(projectPath, repoPath, projectEnvironmentBuilder);
     }
diff --git a/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BMainInstance.java b/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BMainInstance.java
index 03247beb2e04..ec8a32053aed 100644
--- a/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BMainInstance.java
+++ b/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BMainInstance.java
@@ -31,7 +31,7 @@
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintStream;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -94,10 +94,8 @@ private void initialize() {
 
     private void configureAgentArgs() {
         // add jacoco agent
-        String jacocoArgLine = "-javaagent:" + Paths.get(balServer.getServerHome())
-                .resolve("bre").resolve("lib").resolve("jacocoagent.jar") + "=destfile=" +
-                Paths.get(System.getProperty("user.dir"))
-                        .resolve("build").resolve("jacoco").resolve("test.exec");
+        String jacocoArgLine = "-javaagent:" + Path.of(balServer.getServerHome(), "bre/lib/jacocoagent.jar")
+                + "=destfile=" + Path.of(System.getProperty("user.dir"), "build/jacoco/test.exec");
         agentArgs = jacocoArgLine + " ";
     }
 
@@ -200,7 +198,7 @@ public void runMain(String sourceRoot, String packagePath,
             envProperties = new HashMap<>();
         }
         runMain("build", new String[]{packagePath}, envProperties, null, leechers, sourceRoot);
-        runJar(Paths.get(sourceRoot, packagePath).toString(), packagePath, ArrayUtils.addAll(flags, args),
+        runJar(Path.of(sourceRoot, packagePath).toString(), packagePath, ArrayUtils.addAll(flags, args),
                 envProperties, clientArgs, leechers, sourceRoot);
     }
 
@@ -220,7 +218,7 @@ public synchronized void addJavaAgents(Map envProperties) {
     }
 
     public String getBalServerHome() {
-        return Paths.get(balServer.getServerHome()).toString();
+        return Path.of(balServer.getServerHome()).toString();
     }
 
     /**
@@ -530,7 +528,7 @@ public void terminateProcessWithDescendants(Process process) {
      */
     private void runJar(String sourceRoot, String packageName, String[] args, Map envProperties,
                         String[] clientArgs, LogLeecher[] leechers, String commandDir) throws BallerinaTestException {
-        executeJarFile(Paths.get(sourceRoot, "target", "bin", packageName + ".jar").toFile().getPath(),
+        executeJarFile(Path.of(sourceRoot, "target", "bin", packageName + ".jar").toFile().getPath(),
                 args, envProperties, clientArgs, leechers, commandDir);
     }
 
@@ -547,8 +545,8 @@ private void runJar(String sourceRoot, String packageName, String[] args, Map envProperties, String[] clientArgs,
                         LogLeecher[] leechers, String commandDir) throws BallerinaTestException {
-        String balFileName = Paths.get(balFile).getFileName().toString();
-        String jarPath = Paths.get(Paths.get(commandDir).toString(), balFileName.substring(0, balFileName.length() -
+        String balFileName = Path.of(balFile).getFileName().toString();
+        String jarPath = Path.of(Path.of(commandDir).toString(), balFileName.substring(0, balFileName.length() -
                 4) + ".jar").toString();
         executeJarFile(jarPath, args, envProperties, clientArgs, leechers, commandDir);
     }
diff --git a/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BServerInstance.java b/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BServerInstance.java
index 78629188d2f9..848d8d3b387b 100644
--- a/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BServerInstance.java
+++ b/tests/ballerina-test-utils/src/main/java/org/ballerinalang/test/context/BServerInstance.java
@@ -27,7 +27,7 @@
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -87,7 +87,7 @@ private void initialize() throws BallerinaTestException {
     }
 
     private void configureAgentArgs() throws BallerinaTestException {
-        String balAgent = Paths.get(System.getProperty(BALLERINA_AGENT_PATH)).toString();
+        String balAgent = Path.of(System.getProperty(BALLERINA_AGENT_PATH)).toString();
 
         if (balAgent == null || balAgent.isEmpty()) {
             throw new BallerinaTestException("Cannot start server, Ballerina agent not provided");
@@ -97,10 +97,8 @@ private void configureAgentArgs() throws BallerinaTestException {
                 + ",exitStatus=1,timeout=15000,killStatus=5 ";
 
         // add jacoco agent
-        String jacocoArgLine = "-javaagent:" + Paths.get(balServer.getServerHome())
-                .resolve("bre").resolve("lib").resolve("jacocoagent.jar").toString() + "=destfile=" +
-                Paths.get(System.getProperty("user.dir"))
-                        .resolve("build").resolve("jacoco").resolve("test.exec");
+        String jacocoArgLine = "-javaagent:" + Path.of(balServer.getServerHome(), "bre/lib/jacocoagent.jar")
+                + "=destfile=" + Path.of(System.getProperty("user.dir"), "build/jacoco/test.exec");
 
         agentArgs = jacocoArgLine + " " + agentArgs + " ";
     }
@@ -440,7 +438,7 @@ private void runJar(String sourceRoot, String packageName, String[] args, Map envProperties, int[] requiredPorts)
             throws BallerinaTestException {
         File commandDir = new File(balServer.getServerHome());
-        String balFileName = Paths.get(balFile).getFileName().toString();
-        String jarPath = Paths.get(commandDir.getAbsolutePath(), balFileName.substring(0, balFileName.length() -
+        String balFileName = Path.of(balFile).getFileName().toString();
+        String jarPath = Path.of(commandDir.getAbsolutePath(), balFileName.substring(0, balFileName.length() -
                 4) + ".jar").toString();
         executeJarFile(jarPath, args, envProperties, commandDir, requiredPorts);
     }
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/grpc/ServicePackagingTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/grpc/ServicePackagingTestCase.java
index c0580971e7ce..89a01158aa09 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/grpc/ServicePackagingTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/grpc/ServicePackagingTestCase.java
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -57,8 +56,8 @@ public void testNestedMessageType() throws Exception {
         ballerinaBuildServer.runMain("init", args, getEnvVariables(), options, new LogLeecher[]{},
                 projectPath.toString());
         
-        Files.copy(Paths.get(getClass().getClassLoader().getResource("grpc/nested_type_service.bal").getPath()), 
-            Paths.get(projectPath.resolve("foo").toString(), "nested_type_service.bal"));
+        Files.copy(Path.of(getClass().getClassLoader().getResource("grpc/nested_type_service.bal").getPath()),
+            Path.of(projectPath.resolve("foo").toString(), "nested_type_service.bal"));
         Files.deleteIfExists(projectPath.resolve("foo").resolve("hello_service.bal"));
 
         // perform bal build and generate balx file.
@@ -72,7 +71,7 @@ public void testNestedMessageType() throws Exception {
 
         try {
             // run gRPC client to connect with the service.
-            Path balFilePath = Paths.get("src", "test", "resources", "grpc", "nested_type_client.bal");
+            Path balFilePath = Path.of("src", "test", "resources", "grpc", "nested_type_client.bal");
             BMainInstance ballerinaClientServer = new BMainInstance(balServer);
             String balFile = balFilePath.toAbsolutePath().toString();
             LogLeecher logLeecher1 = new LogLeecher("testInputNestedStruct output: Submitted name: Danesh");
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/jvm/JarRunFunctionPositiveTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/jvm/JarRunFunctionPositiveTestCase.java
index 36f7fd80a57f..3691f8297e07 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/jvm/JarRunFunctionPositiveTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/jvm/JarRunFunctionPositiveTestCase.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * This class tests invoking main function in a bal for jvm target via bal build Command and run it the jar for
@@ -47,7 +46,7 @@ public class JarRunFunctionPositiveTestCase extends JBallerinaBaseTest {
     @BeforeClass()
     public void setUp() throws BallerinaTestException, IOException {
         tempProjectDir = Files.createTempDirectory("temp-jar-func-test");
-        jarPath = Paths.get(tempProjectDir.toString(), JAR_NAME).toString();
+        jarPath = Path.of(tempProjectDir.toString(), JAR_NAME).toString();
         String[] clientArgs = {
                 "-o", jarPath,
                 (new File("src/test/resources/run/jar/test_main_for_jvm_target.bal")).getAbsolutePath()
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ConfigTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ConfigTestCase.java
index 58baa2d16a79..d5e8a6944531 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ConfigTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ConfigTestCase.java
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 
 /**
@@ -47,7 +46,7 @@ public void setUp() throws IOException {
         envVariables = TestUtils.getEnvVariables();
 
         tempProjectDirectory = Files.createTempDirectory("bal-test-integration-config-test-project-");
-        FileUtils.copyDirectory(Paths.get((new File("src/test/resources/project")).getAbsolutePath()).toFile(),
+        FileUtils.copyDirectory(Path.of((new File("src/test/resources/project")).getAbsolutePath()).toFile(),
                                 tempProjectDirectory.toFile());
         Files.createDirectories(tempProjectDirectory.resolve(".ballerina"));
     }
@@ -110,7 +109,7 @@ public void testModuleWithInvalidConfig() throws Exception {
 
     @Test(description = "Test running a ballerina file with the default config from the same directory")
     public void testRunWithInvalidDefaultConfig() throws Exception {
-        Path sourcePath = Paths.get(balSourcePkgPath, "invalid");
+        Path sourcePath = Path.of(balSourcePkgPath, "invalid");
         String[] clientArgs = {"read_from_config.bal"};
         LogLeecher clientLeecher = new LogLeecher("error: invalid toml syntax at ballerina.conf:4",
                 LogLeecher.LeecherType.ERROR);
@@ -120,7 +119,7 @@ public void testRunWithInvalidDefaultConfig() throws Exception {
 
     @Test(description = "Test running a ballerina file by specifying an invalid config file path")
     public void testRunWithInvalidConfig() throws Exception {
-        Path sourcePath = Paths.get(balSourcePkgPath, "invalid");
+        Path sourcePath = Path.of(balSourcePkgPath, "invalid");
         String confPath = (new File("src/test/resources/config/invalid/test.conf")).getAbsolutePath();
         String[] clientArgs = {"read_from_config.bal", "--b7a.config.file="+ confPath"};
         LogLeecher clientLeecher = new LogLeecher("error: invalid toml syntax at test.conf:5",
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ListDependencyTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ListDependencyTestCase.java
index 3cea4d0969a7..9fb6649d382b 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ListDependencyTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ListDependencyTestCase.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Testing pushing, pulling, searching a module from central and installing module to home repository.
@@ -46,7 +45,7 @@ public void setUp() throws IOException {
         tempProjectDirectory = Files.createTempDirectory("bal-test-integration-packaging-project-");
         // Copy sources
         String projectPath = (new File("src/test/resources/list")).getAbsolutePath();
-        FileUtils.copyDirectory(Paths.get(projectPath).toFile(), tempProjectDirectory.toFile());
+        FileUtils.copyDirectory(Path.of(projectPath).toFile(), tempProjectDirectory.toFile());
         // Create .ballerina
         Files.createDirectories(tempProjectDirectory.resolve(".ballerina"));
     }
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleBuildTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleBuildTestCase.java
index f9ba4d3d361c..991f5cb91060 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleBuildTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleBuildTestCase.java
@@ -34,7 +34,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.Map;
 
@@ -74,16 +73,16 @@ public void testBuild() throws BallerinaTestException, IOException {
         balClient.runMain("build", new String[0], envVariables, new String[0], new LogLeecher[]{}, projectPath.
                                                                                                             toString());
 
-        Path genPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path genPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                     ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "foo", VERSION);
         Assert.assertTrue(Files.exists(projectPath.resolve(genPkgPath)));
         Assert.assertTrue(Files.exists(projectPath.resolve(genPkgPath).resolve("foo" + ".zip")));
 
-        Path emptyPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path emptyPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                       ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "emptypkg", VERSION);
         Assert.assertTrue(Files.notExists(projectPath.resolve(emptyPkgPath).resolve("emptypkg" + ".zip")));
 
-        Path otherPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path otherPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                       ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "otherpkg", VERSION);
         Assert.assertTrue(Files.notExists(projectPath.resolve(otherPkgPath).resolve("otherpkg" + ".zip")));
     }
@@ -105,12 +104,12 @@ public void testBuildWithFirstPkgCombination() throws BallerinaTestException, IO
         balClient.runMain("build", new String[0], envVariables, new String[0], new LogLeecher[]{},
                           projectPath.toString());
 
-        Path genPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path genPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                     ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "foo", VERSION);
         Assert.assertTrue(Files.exists(projectPath.resolve(genPkgPath)));
         Assert.assertTrue(Files.exists(projectPath.resolve(genPkgPath).resolve("foo" + ".zip")));
 
-        Path otherPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path otherPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                       ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "otherpkg", VERSION);
         Assert.assertTrue(Files.notExists(projectPath.resolve(otherPkgPath).resolve("otherpkg" + ".zip")));
     }
@@ -131,12 +130,12 @@ public void testBuildWithSecPkgCombination() throws BallerinaTestException, IOEx
         balClient.runMain("build", new String[0], envVariables, new String[0], new LogLeecher[]{},
                           projectPath.toString());
 
-        Path genPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path genPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                     ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "foo", VERSION);
         Assert.assertTrue(Files.exists(projectPath.resolve(genPkgPath)));
         Assert.assertTrue(Files.exists(projectPath.resolve(genPkgPath).resolve("foo" + ".zip")));
 
-        Path emptyPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path emptyPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                       ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "emptypkg", VERSION);
         Assert.assertTrue(Files.notExists(projectPath.resolve(emptyPkgPath).resolve("emptypkg" + ".zip")));
     }
@@ -233,7 +232,7 @@ public void testBuildWithXML() throws BallerinaTestException, IOException {
         balClient.runMain("build", new String[0], envVariables, new String[0], new LogLeecher[]{},
                           projectPath.toString());
 
-        Path genPkgPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
+        Path genPkgPath = Path.of(ProjectDirConstants.DOT_BALLERINA_DIR_NAME,
                                     ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "foo", VERSION);
         Assert.assertTrue(Files.exists(projectPath.resolve(genPkgPath).resolve("foo.zip")));
         Assert.assertTrue(Files.exists(projectPath.resolve("target").resolve("foo.balx")));
@@ -286,7 +285,7 @@ public void testModuleOnlyWithTest() throws BallerinaTestException, IOException
         // Copy the module with tests to the temp project directory
         Path projectPath = tempProjectDirectory.resolve("testModuleBuild");
         String resourcePath = (new File("src/test/resources/testModule")).getAbsolutePath();
-        FileUtils.copyDirectory(Paths.get(resourcePath).toFile(), projectPath.toFile());
+        FileUtils.copyDirectory(Path.of(resourcePath).toFile(), projectPath.toFile());
         // Initialize the project
         initProject(projectPath, EMPTY_PROJECT_OPTS);
 
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingNegativeTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingNegativeTestCase.java
index c1e40dc0b7f0..82658b014b7d 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingNegativeTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingNegativeTestCase.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.Map;
 
@@ -343,7 +342,7 @@ public void testRunningBalInsidePackage() throws Exception {
         initProject(projectPath);
         String msg = "error: you are trying to run a ballerina file inside a package within a project. Try running " +
                 "'ballerina run '";
-        String sourcePath = Paths.get(moduleName, "main.bal").toString();
+        String sourcePath = Path.of(moduleName, "main.bal").toString();
         balClient.runMain("run", new String[] {sourcePath}, envVariables, new String[0],
                           new LogLeecher[]{new LogLeecher(msg)}, projectPath.toString());
     }
@@ -354,7 +353,7 @@ public void testBuildingBalInsidePackage() throws Exception {
         Path projectPath = tempProjectDirectory.resolve("projectxyz");
         String msg = "error: you are trying to build a ballerina file inside a package within a project. Try running " +
                 "'bal build '";
-        String sourcePath = Paths.get(moduleName, "main.bal").toString();
+        String sourcePath = Path.of(moduleName, "main.bal").toString();
         balClient.runMain("build", new String[] {sourcePath}, envVariables, new String[0],
                           new LogLeecher[]{new LogLeecher(msg)}, projectPath.toString());
     }
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingTestCase.java
index cd813d6ff2e5..d8a2a1fc6e32 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/PackagingTestCase.java
@@ -33,7 +33,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.Map;
@@ -91,7 +90,7 @@ public void testPush() throws Exception {
         balClient.runMain("push", new String[]{moduleName, "--no-build"}, envVariables, new String[]{},
                           new LogLeecher[]{clientLeecher}, projectPath.toString());
         clientLeecher.waitForText(2000);
-        Path dirPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, orgName, moduleName, "0.0.1");
+        Path dirPath = Path.of(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, orgName, moduleName, "0.0.1");
         Assert.assertTrue(Files.notExists(projectPath.resolve(dirPath)));
         Assert.assertTrue(Files.notExists(projectPath.resolve(dirPath).resolve(moduleName + ".zip")));
 
@@ -112,14 +111,14 @@ public void testInstall() throws Exception {
         balClient.runMain("install", clientArgs, envVariables, new String[]{}, new LogLeecher[]{},
                 projectPath.toString());
 
-        Path dirPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, orgName, moduleName, "0.0.1");
+        Path dirPath = Path.of(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, orgName, moduleName, "0.0.1");
         Assert.assertTrue(Files.exists(tempHomeDirectory.resolve(dirPath)));
         Assert.assertTrue(Files.exists(tempHomeDirectory.resolve(dirPath).resolve(moduleName + ".zip")));
     }
 
     @Test(description = "Test pulling a package from central", dependsOnMethods = "testPush")
     public void testPull() {
-        Path dirPath = Paths.get(ProjectDirConstants.CACHES_DIR_NAME,
+        Path dirPath = Path.of(ProjectDirConstants.CACHES_DIR_NAME,
                                  ProjectDirConstants.BALLERINA_CENTRAL_DIR_NAME,
                                  orgName, moduleName, "0.0.1");
 
@@ -193,7 +192,7 @@ public void testUninstallFromHomeRepo() throws Exception {
                           tempProjectDirectory.toString());
         clientLeecher.waitForText(2000);
 
-        Path dirPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, orgName, moduleName, "0.0.1");
+        Path dirPath = Path.of(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, orgName, moduleName, "0.0.1");
         Assert.assertTrue(Files.notExists(tempHomeDirectory.resolve(dirPath).resolve(moduleName + ".zip")));
         Assert.assertTrue(Files.notExists(tempHomeDirectory.resolve(dirPath)));
     }
@@ -209,7 +208,7 @@ public void testUninstallFromCaches() throws Exception {
                           tempProjectDirectory.toString());
         clientLeecher.waitForText(2000);
 
-        Path dirPath = Paths.get(ProjectDirConstants.CACHES_DIR_NAME,
+        Path dirPath = Path.of(ProjectDirConstants.CACHES_DIR_NAME,
                                  ProjectDirConstants.BALLERINA_CENTRAL_DIR_NAME, orgName, moduleName, "0.0.1");
         Assert.assertTrue(Files.notExists(tempHomeDirectory.resolve(dirPath).resolve(moduleName + ".zip")));
         Assert.assertTrue(Files.notExists(tempHomeDirectory.resolve(dirPath)));
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/RepoHierarchyTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/RepoHierarchyTestCase.java
index 7501bcf5c477..af0548fbc12a 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/RepoHierarchyTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/RepoHierarchyTestCase.java
@@ -33,7 +33,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 
 /**
@@ -82,7 +81,7 @@ public void testInstallingModuleA() throws BallerinaTestException {
         balClient.runMain("install", clientArgs, envVariables, new String[]{}, new LogLeecher[]{},
                 tempProjectDirectory.toString());
     
-        Path dirPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "a", VERSION);
+        Path dirPath = Path.of(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "a", VERSION);
         Assert.assertTrue(Files.exists(tempHomeDirectory.resolve(dirPath)));
         Assert.assertTrue(Files.exists(tempHomeDirectory.resolve(dirPath).resolve("a" + ".zip")));
     }
@@ -98,7 +97,7 @@ public void testInstallingModuleB() throws BallerinaTestException {
         balClient.runMain("install", clientArgs, envVariables, new String[]{}, new LogLeecher[]{},
                 tempProjectDirectory.toString());
         
-        Path dirPath = Paths.get(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "b", VERSION);
+        Path dirPath = Path.of(ProjectDirConstants.DOT_BALLERINA_REPO_DIR_NAME, ORG_NAME, "b", VERSION);
         Assert.assertTrue(Files.exists(tempHomeDirectory.resolve(dirPath)));
         Assert.assertTrue(Files.exists(tempHomeDirectory.resolve(dirPath).resolve("b" + ".zip")));
     }
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildTestCase.java
index 1370ce0abb1b..8a7d503f2470 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildTestCase.java
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.Map;
 
@@ -74,7 +73,7 @@ public void testBuildingSourceWithAbsolutePath() throws Exception {
     @Test(description = "Test building a bal file by giving the path from the current directory")
     public void testBuildingSourceWithCurrentDir() throws Exception {
         // Test bal build
-        String[] clientArgs = {Paths.get("sourcePkg", "main.bal").toString()};
+        String[] clientArgs = {Path.of("sourcePkg", "main.bal").toString()};
         balClient.runMain("build", clientArgs, envVariables, new String[]{},
                 new LogLeecher[]{}, tempProjectDirectory.toString());
         Path generatedBalx = tempProjectDirectory.resolve("main.balx");
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildWithSiddhiRuntimeTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildWithSiddhiRuntimeTestCase.java
index 569b831fbfe9..db53fb5b4e29 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildWithSiddhiRuntimeTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/packaging/SingleBalBuildWithSiddhiRuntimeTestCase.java
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.HashMap;
 import java.util.Map;
@@ -90,7 +89,7 @@ public void setUp() throws IOException {
 
     @Test(description = "Test building a bal file without the siddhiruntime flag")
     public void testBuildingWithoutSiddhiRuntime() throws Exception {
-        String[] clientArgs = {Paths.get("sourcePkg", "main.bal").toString()};
+        String[] clientArgs = {Path.of("sourcePkg", "main.bal").toString()};
         String errOutput = balClient.runMainAndReadStdOut("build", clientArgs, new HashMap<>(),
                                                   tempProjectDirectory.toString(), true);
         Assert.assertEquals(errOutput, "error: .::main.bal:22:16: undefined symbol 'e1'\n" +
@@ -109,7 +108,7 @@ public void testBuildingWithoutSiddhiRuntime() throws Exception {
     @Test(description = "Test building a bal file with the siddhiruntime flag",
             dependsOnMethods = "testBuildingWithoutSiddhiRuntime")
     public void testBuildingWithSiddhiRuntime() throws Exception {
-        String[] clientArgs = {"--siddhiruntime", Paths.get("sourcePkg", "main.bal").toString()};
+        String[] clientArgs = {"--siddhiruntime", Path.of("sourcePkg", "main.bal").toString()};
         balClient.runMain("build", clientArgs, envVariables, new String[]{},
                 new LogLeecher[]{}, tempProjectDirectory.toString());
         Path generatedBalx = tempProjectDirectory.resolve("main.balx");
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionNegativeTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionNegativeTestCase.java
index f1db8c3ede8f..e1d4505abf1c 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionNegativeTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionNegativeTestCase.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * This class tests invoking an entry function in a balx via the Ballerina Run Command and the data binding
@@ -53,7 +52,7 @@ public class BalxRunFunctionNegativeTestCase extends BaseTest {
     @BeforeClass()
     public void setUp() throws BallerinaTestException, IOException {
         tempProjectDir = Files.createTempDirectory("temp-entry-func-test");
-        String[] clientArgs = {"-o", Paths.get(tempProjectDir.toString(), "entry").toString(),
+        String[] clientArgs = {"-o", Path.of(tempProjectDir.toString(), "entry").toString(),
                 (new File("src/test/resources/run/balx/multiple_params/test_main_with_multiple_typed_params.bal"))
                         .getAbsolutePath()};
         balClient.runMain("build", clientArgs, null, new String[0], new LogLeecher[0],
@@ -62,7 +61,7 @@ public void setUp() throws BallerinaTestException, IOException {
         balxPath = generatedBalx.toString();
 
         tempProjectDirTwo = Files.createTempDirectory("temp-entry-func-test-two");
-        clientArgs = new String[]{"-o", Paths.get(tempProjectDirTwo.toString(), "entry").toString(),
+        clientArgs = new String[]{"-o", Path.of(tempProjectDirTwo.toString(), "entry").toString(),
                 (new File("src/test/resources/run/balx/no_params/test_main_with_no_params.bal")).getAbsolutePath()};
         balClient.runMain("build", clientArgs, null, new String[0], new LogLeecher[0], tempProjectDirTwo.toString());
         generatedBalx = tempProjectDirTwo.resolve("entry.balx");
diff --git a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionPositiveTestCase.java b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionPositiveTestCase.java
index 4901985cfebd..555e0d9be730 100644
--- a/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionPositiveTestCase.java
+++ b/tests/ballerina-tools-integration-test/src/test/java/org/ballerinalang/test/run/BalxRunFunctionPositiveTestCase.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * This class tests invoking the main function in a balx via the Ballerina Run Command and the data binding
@@ -46,14 +45,14 @@ public class BalxRunFunctionPositiveTestCase extends BaseTest {
     public void setUp() throws BallerinaTestException, IOException {
         // set up for testNoArg
         tempProjectDir = Files.createTempDirectory("temp-entry-func-test");
-        String[] clientArgs = {"-o", Paths.get(tempProjectDir.toString(), ENTRY_NAME).toString(),
+        String[] clientArgs = {"-o", Path.of(tempProjectDir.toString(), ENTRY_NAME).toString(),
                 (new File("src/test/resources/run/balx/no_params/test_main_with_no_params.bal")).getAbsolutePath()};
         balClient.runMain("build", clientArgs, null, new String[0],
                           new LogLeecher[0], tempProjectDir.toString());
 
         // set up for testMultipleParams
         tempProjectDirTwo = Files.createTempDirectory("temp-entry-func-test-two");
-        clientArgs = new String[]{"-o", Paths.get(tempProjectDirTwo.toString(), ENTRY_NAME).toString(),
+        clientArgs = new String[]{"-o", Path.of(tempProjectDirTwo.toString(), ENTRY_NAME).toString(),
                 (new File("src/test/resources/run/balx/multiple_params/" +
                                   "test_main_with_multiple_typed_params.bal")).getAbsolutePath()};
         balClient.runMain("build", clientArgs, null, new String[0],
diff --git a/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/BallerinaTestDebugPoint.java b/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/BallerinaTestDebugPoint.java
index 3add00bd9984..0abf71788b56 100644
--- a/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/BallerinaTestDebugPoint.java
+++ b/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/BallerinaTestDebugPoint.java
@@ -23,7 +23,6 @@
 
 import java.net.URI;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import static org.ballerinalang.debugger.test.utils.FileUtils.FILE_SEPARATOR;
 import static org.ballerinalang.debugger.test.utils.FileUtils.FILE_SEPARATOR_REGEX;
@@ -85,9 +84,9 @@ public int getLine() {
     public Source getSource() throws BallerinaTestException {
         Source source = new Source();
         if (filePathUri.getScheme().equals(URI_SCHEME_FILE)) {
-            String[] paths = Paths.get(filePathUri).toAbsolutePath().toString().split(FILE_SEPARATOR_REGEX);
+            String[] paths = Path.of(filePathUri).toAbsolutePath().toString().split(FILE_SEPARATOR_REGEX);
             source.setName(paths[paths.length - 1]);
-            source.setPath(Paths.get(filePathUri).toAbsolutePath().toString());
+            source.setPath(Path.of(filePathUri).toAbsolutePath().toString());
         } else if (filePathUri.getScheme().equals(URI_SCHEME_BALA)) {
             String[] paths = filePathUri.getPath().split(URI_SEPARATOR);
             source.setName(paths[paths.length - 1]);
diff --git a/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/connection/ProcessStreamConnectionProvider.java b/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/connection/ProcessStreamConnectionProvider.java
index 0df593274dec..435514483fb2 100644
--- a/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/connection/ProcessStreamConnectionProvider.java
+++ b/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/connection/ProcessStreamConnectionProvider.java
@@ -23,7 +23,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -81,8 +80,8 @@ private ProcessBuilder createProcessBuilder() {
      * Injects jacoco agent args into the debug server VM environment.
      */
     private void configureJacocoAgentArgs(Map envProperties) {
-        Path jacocoAgentPath = Paths.get(balHome).resolve("bre").resolve("lib").resolve("jacocoagent.jar");
-        Path destinationFile = Paths.get(System.getProperty("user.dir")).resolve("build").resolve("jacoco")
+        Path jacocoAgentPath = Path.of(balHome).resolve("bre").resolve("lib").resolve("jacocoagent.jar");
+        Path destinationFile = Path.of(System.getProperty("user.dir")).resolve("build").resolve("jacoco")
                 .resolve("debugger-core-test.exec");
         String agentArgs = String.format(JACOCO_AGENT_ARGS, jacocoAgentPath, destinationFile);
 
diff --git a/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/BaseTestCase.java b/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/BaseTestCase.java
index 50b89519dc2d..4fc6ad92dbdf 100644
--- a/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/BaseTestCase.java
+++ b/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/BaseTestCase.java
@@ -24,7 +24,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Parent test class for all debug integration test cases.
@@ -47,8 +46,8 @@ public abstract class BaseTestCase {
 
     @BeforeSuite(alwaysRun = true)
     public void initialize() throws BallerinaTestException, IOException {
-        Path projectResourcePath = Paths.get("src", "test", "resources", "project-based-tests").toAbsolutePath();
-        Path singleFileResourcePath = Paths.get("src", "test", "resources", "single-file-tests").toAbsolutePath();
+        Path projectResourcePath = Path.of("src", "test", "resources", "project-based-tests").toAbsolutePath();
+        Path singleFileResourcePath = Path.of("src", "test", "resources", "single-file-tests").toAbsolutePath();
         DebugTestRunner.initialize(projectResourcePath, singleFileResourcePath);
     }
 
diff --git a/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/remote/BallerinaRunRemoteDebugTest.java b/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/remote/BallerinaRunRemoteDebugTest.java
index 8ed12fc044a0..8e7ee8db75f2 100644
--- a/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/remote/BallerinaRunRemoteDebugTest.java
+++ b/tests/jballerina-debugger-integration-test/src/test/java/org/ballerinalang/debugger/test/remote/BallerinaRunRemoteDebugTest.java
@@ -26,7 +26,7 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -86,7 +86,7 @@ public void testSuspendOnBallerinaJarRun2() throws BallerinaTestException {
     }
 
     public void testBalJarInDebugMode(String... debugOptions) throws BallerinaTestException {
-        String executablePath = Paths.get("target", "bin", testProjectName.replaceAll("-", "_") + ".jar")
+        String executablePath = Path.of("target", "bin", testProjectName.replaceAll("-", "_") + ".jar")
                 .toFile().getPath();
         LogLeecher clientLeecher = new LogLeecher(executablePath);
         balClient.runMain("build", new String[0], null, null, new LogLeecher[]{clientLeecher},
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/async/AsyncFunctionsTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/async/AsyncFunctionsTest.java
index eff23ee0f3f5..fe8c3113c01f 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/async/AsyncFunctionsTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/async/AsyncFunctionsTest.java
@@ -23,15 +23,15 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Class to test functionality of futures.
  */
 public class AsyncFunctionsTest extends BaseTest {
 
-    private static final String testFileLocation = Paths.get("src", "test", "resources", "async")
-            .toAbsolutePath().toString();
+    private static final String testFileLocation = Path.of("src/test/resources/async").toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
     @BeforeClass
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/bindgen/BindgenTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/bindgen/BindgenTestCase.java
index 31e5ab228d24..1824ba62062b 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/bindgen/BindgenTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/bindgen/BindgenTestCase.java
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.stream.Stream;
 
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
@@ -49,7 +48,7 @@ public class BindgenTestCase extends BaseTest {
     public void setUp() throws IOException, BallerinaTestException {
         tempProjectsDir = Files.createTempDirectory("bal-test-integration-bindgen-");
         // copy TestProject to a temp
-        Path testProject = Paths.get("src", "test", "resources", "bindgen")
+        Path testProject = Path.of("src", "test", "resources", "bindgen")
                 .toAbsolutePath();
         copyFolder(testProject, tempProjectsDir);
         balClient = new BMainInstance(balServer);
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/configurables/ConfigurableTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/configurables/ConfigurableTest.java
index cb1c02d49551..bf603d4a2c40 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/configurables/ConfigurableTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/configurables/ConfigurableTest.java
@@ -28,7 +28,7 @@
 import org.testng.annotations.Test;
 
 import java.io.File;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Map;
 
 import static io.ballerina.runtime.internal.configurable.providers.toml.TomlConstants.CONFIG_DATA_ENV_VARIABLE;
@@ -41,7 +41,7 @@
  */
 public class ConfigurableTest extends BaseTest {
 
-    private static final String testFileLocation = Paths.get("src", "test", "resources", "configurables")
+    private static final String testFileLocation = Path.of("src/test/resources/configurables")
             .toAbsolutePath().toString();
     private BMainInstance bMainInstance;
     private final String testsPassed = "Tests passed";
@@ -50,7 +50,7 @@ public class ConfigurableTest extends BaseTest {
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
         // Build and push config Lib project.
-        bMainInstance.compilePackageAndPushToLocal(Paths.get(testFileLocation, "configLibProject").toString(),
+        bMainInstance.compilePackageAndPushToLocal(Path.of(testFileLocation, "configLibProject").toString(),
                 "testOrg-configLib-java17-0.1.0");
     }
 
@@ -139,8 +139,8 @@ public void testConfigurableModuleStructureWithTestAPI() throws BallerinaTestExc
     public void testFileEnvVariableBasedConfigurable() throws BallerinaTestException {
 
         // test config file location through `BAL_CONFIG_FILES` env variable
-        String configFilePaths = Paths.get(testFileLocation, "config_files", "Config-A.toml") +
-                File.pathSeparator + Paths.get(testFileLocation, "config_files", "Config-B.toml");
+        String configFilePaths = Path.of(testFileLocation, "config_files", "Config-A.toml") +
+                File.pathSeparator + Path.of(testFileLocation, "config_files", "Config-B.toml");
         executeBalCommand("", "envVarPkg",
                 addEnvironmentVariables(Map.ofEntries(Map.entry(CONFIG_FILES_ENV_VARIABLE, configFilePaths))));
     }
@@ -220,8 +220,8 @@ public void testDataEnvVariableBasedConfigurableWithNewLine() throws BallerinaTe
     @Test
     public void testConfigOverriding() throws BallerinaTestException {
         // Check multiple cases of TOML values getting overridden
-        String configFilePath1 =  Paths.get(testFileLocation, "config_files", "Config.toml").toString();
-        String configFilePath2 =  Paths.get(testFileLocation, "config_files", "Config-override.toml").toString();
+        String configFilePath1 =  Path.of(testFileLocation, "config_files", "Config.toml").toString();
+        String configFilePath2 =  Path.of(testFileLocation, "config_files", "Config-override.toml").toString();
 
 
         // test config file overriding another config file
@@ -302,16 +302,16 @@ public void testMapVariableAndModuleAmbiguitySubModule() throws BallerinaTestExc
                 "creates an ambiguity with module 'testOrg/subModuleClash.test:0.1.0'", ERROR);
         bMainInstance.runMain("pack", new String[]{}, null, new String[]{},
                 new LogLeecher[]{errorLog},
-                Paths.get(testFileLocation, "testAmbiguousCases", "subModuleClash").toString());
+                Path.of(testFileLocation, "testAmbiguousCases", "subModuleClash").toString());
         errorLog.waitForText(5000);
     }
 
     @Test
     public void testMapVariableAndModuleAmbiguityImportedModule() throws BallerinaTestException {
-        String projectPath = Paths.get(testFileLocation, "testAmbiguousCases").toString();
+        String projectPath = Path.of(testFileLocation, "testAmbiguousCases").toString();
         LogLeecher errorLog = new LogLeecher("[main.bal:(19:26,19:30)] configurable variable name 'test' creates an " +
                 "ambiguity with module 'testOrg/test:0.1.0'", ERROR);
-        bMainInstance.compilePackageAndPushToLocal(Paths.get(projectPath, "importedModuleClash", "test").toString(),
+        bMainInstance.compilePackageAndPushToLocal(Path.of(projectPath, "importedModuleClash", "test").toString(),
                 "testOrg-test-any-0.1.0");
         bMainInstance.runMain("pack", new String[]{"main"}, null, new String[]{},
                 new LogLeecher[]{errorLog}, projectPath + "/importedModuleClash");
@@ -324,7 +324,7 @@ public void testMapVariableAndModuleAmbiguityMultipleSubModule() throws Ballerin
                 "ambiguity with module 'testOrg/multipleSubModuleClash.mod1.test:0.1.0'", ERROR);
         bMainInstance.runMain("pack", new String[]{}, null, new String[]{},
                 new LogLeecher[]{errorLog},
-                Paths.get(testFileLocation, "testAmbiguousCases", "multipleSubModuleClash").toString());
+                Path.of(testFileLocation, "testAmbiguousCases", "multipleSubModuleClash").toString());
         errorLog.waitForText(5000);
     }
 
@@ -414,7 +414,7 @@ public void testModuleAmbiguityWithModuleNameAsBallerina() throws BallerinaTestE
                 "with an imported organization name. Please provide the module name as '[ballerina.ballerina]'", ERROR);
         bMainInstance.runMain("run", new String[]{}, null, new String[]{},
                 new LogLeecher[]{errorLog},
-                Paths.get(testFileLocation, "testAmbiguousCases", "moduleNamedBallerina").toString());
+                Path.of(testFileLocation, "testAmbiguousCases", "moduleNamedBallerina").toString());
         errorLog.waitForText(5000);
     }
 
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/data/streaming/TableDataStreamingTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/data/streaming/TableDataStreamingTestCase.java
index 10a681ddc3a9..c9dce7672742 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/data/streaming/TableDataStreamingTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/data/streaming/TableDataStreamingTestCase.java
@@ -31,7 +31,7 @@
 import org.testng.annotations.Test;
 
 import java.io.BufferedReader;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -56,8 +56,7 @@ public class TableDataStreamingTestCase extends BaseTest {
     private void setup() throws Exception {
         System.setProperty("enableJBallerinaTests", "true");
         setUpDatabase();
-        String balFile = Paths.get("src", "test", "resources", "data", "streaming", "streaming_test.bal")
-                .toAbsolutePath().toString();
+        String balFile = Path.of("src/test/resources/data/streaming/streaming_test.bal").toAbsolutePath().toString();
         Map envProperties = new HashMap<>(1);
         // Had to increase this to 150 from 100 which worked with BVM. Created an issue: #16846
         envProperties.put("JAVA_OPTS", "-Xms150m -Xmx150m");
@@ -67,8 +66,7 @@ private void setup() throws Exception {
     }
 
     private void setUpDatabase() throws SQLException {
-        String dbScriptPath = Paths
-                .get("data", "streaming", "datafiles", "streaming_test_data.sql").toString();
+        String dbScriptPath = Path.of("data/streaming/datafiles/streaming_test_data.sql").toString();
         testDatabase = new FileBasedTestDatabase(SQLDBUtils.DBType.H2, dbScriptPath, SQLDBUtils.DB_DIRECTORY,
                 "STREAMING_TEST_DB");
         insertDummyData(testDatabase.getJDBCUrl(), testDatabase.getUsername(), testDatabase.getPassword());
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/distinct/TypeIdViaDifferentVersionsTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/distinct/TypeIdViaDifferentVersionsTest.java
index da2c0ce891d6..2cf7de4db593 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/distinct/TypeIdViaDifferentVersionsTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/distinct/TypeIdViaDifferentVersionsTest.java
@@ -25,7 +25,8 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests type ID compatibility of the same construct via different versions of the same module.
@@ -34,8 +35,7 @@
  */
 public class TypeIdViaDifferentVersionsTest extends BaseTest {
 
-    private static final String testFileLocation =
-            Paths.get("src", "test", "resources", "packaging", "distinct")
+    private static final String testFileLocation = Path.of("src/test/resources/packaging/distinct")
             .toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
@@ -43,9 +43,9 @@ public class TypeIdViaDifferentVersionsTest extends BaseTest {
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
         // Build and push down stream packages.
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_distinct_foo").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_distinct_foo").toString(),
                                      "testorg-distinct_foo-any-1.0.0");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_distinct_bar").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_distinct_bar").toString(),
                                      "testorg-distinct_bar-any-1.0.0");
         // Triggers caching the BIR for foo 1.0.0.
         buildPackage("baz");
@@ -65,7 +65,7 @@ private void compilePackageAndPushToLocal(String packagePath, String balaFileNam
 
     @Test
     public void testTypeIDsViaDifferentVersions() throws BallerinaTestException {
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_distinct_foo_patch").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_distinct_foo_patch").toString(),
                                      "testorg-distinct_foo-any-1.0.1");
 
         buildPackage("qux");
@@ -74,7 +74,7 @@ public void testTypeIDsViaDifferentVersions() throws BallerinaTestException {
     private void buildPackage(String name) throws BallerinaTestException {
         LogLeecher buildLeecher = new LogLeecher("target/bala/testorg-distinct_" + name + "-any-1.0.0.bala");
         bMainInstance.runMain("pack", new String[]{}, null, null, new LogLeecher[]{buildLeecher},
-                              Paths.get(testFileLocation, "test_project_distinct_" + name).toString());
+                              Path.of(testFileLocation, "test_project_distinct_" + name).toString());
         buildLeecher.waitForText(5000);
     }
 }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/forwardreference/ForwardReferenceListenerVarTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/forwardreference/ForwardReferenceListenerVarTest.java
index 960e10cceba9..0df948d6d1f9 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/forwardreference/ForwardReferenceListenerVarTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/forwardreference/ForwardReferenceListenerVarTest.java
@@ -28,7 +28,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 /**
  * Integration test for forward referencing listener in a http service.
@@ -43,7 +43,7 @@ public class ForwardReferenceListenerVarTest extends BaseTest {
     @BeforeClass
     private void setup() throws Exception {
         serverInstance = new BServerInstance(balServer);
-        String balFile = Paths.get("src", "test", "resources", "forwardreference", "forward_ref_service.bal")
+        String balFile = Path.of("src/test/resources/forwardreference/forward_ref_service.bal")
                 .toAbsolutePath().toString();
         serverInstance.startServer(balFile, new int[SERVICE_PORT]);
     }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/identifier/IdentifierLiteralTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/identifier/IdentifierLiteralTest.java
index 9a3e5202f165..4ffd3877ba85 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/identifier/IdentifierLiteralTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/identifier/IdentifierLiteralTest.java
@@ -27,7 +27,6 @@
 
 import java.io.File;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 
 /**
@@ -37,20 +36,20 @@
  */
 public class IdentifierLiteralTest  extends BaseTest {
 
-    private static final String testFileLocation = Paths.get("src", "test", "resources", "identifier")
+    private static final String testFileLocation = Path.of("src", "test", "resources", "identifier")
             .toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
     @BeforeClass
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
-        bMainInstance.compilePackageAndPushToLocal(Paths.get(testFileLocation, "testProject").toString(),
+        bMainInstance.compilePackageAndPushToLocal(Path.of(testFileLocation, "testProject").toString(),
                 "a_b-foo-any-0.1.0");
     }
 
     @Test(description = "Test clashes in module names contain '.' and '_'")
     public void testModuleIdentifierClash() throws BallerinaTestException {
-        Path projectPath = Paths.get(testFileLocation, "ModuleNameClashProject")
+        Path projectPath = Path.of(testFileLocation, "ModuleNameClashProject")
                 .toAbsolutePath();
         LogLeecher runLeecher = new LogLeecher("1 passing");
         bMainInstance.runMain("test", new String[0], new HashMap<>(), new String[0],
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/isolated/IsolatedInferenceWithTestsTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/isolated/IsolatedInferenceWithTestsTest.java
index 34faf0be8ee5..3963f51e45b4 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/isolated/IsolatedInferenceWithTestsTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/isolated/IsolatedInferenceWithTestsTest.java
@@ -26,7 +26,8 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests isolated inference when the module contains tests.
@@ -36,8 +37,7 @@
 public class IsolatedInferenceWithTestsTest extends BaseTest {
 
     private static final String testFileLocation =
-            Paths.get("src", "test", "resources", "isolated-inference-projects")
-                    .toAbsolutePath().toString();
+            Path.of("src/test/resources/isolated-inference-projects").toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
     @BeforeClass
@@ -65,7 +65,7 @@ private void testPkg(String pkg, int testCount) throws BallerinaTestException {
         LogLeecher failedLeecher = new LogLeecher("0 failing");
         bMainInstance.runMain("test", new String[0], null, null,
                               new LogLeecher[]{passedLeecher, failedLeecher},
-                              Paths.get(testFileLocation, pkg).toString());
+                              Path.of(testFileLocation, pkg).toString());
         passedLeecher.waitForText(5000);
         failedLeecher.waitForText(5000);
     }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/listener/LaunchListenerTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/listener/LaunchListenerTestCase.java
index e593f421d9b4..cfd1172bf3bb 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/listener/LaunchListenerTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/listener/LaunchListenerTestCase.java
@@ -26,7 +26,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Test cases to verify launch listener init and shutdown failures.
@@ -61,18 +60,18 @@ public void testShutdownError() throws BallerinaTestException {
 
     private void verify(String jarName, String balFileName, String serverResponse) throws BallerinaTestException {
 
-        Path launchListenerJarFilePath = Paths.get("build", "launch-listener", "libs", jarName);
+        Path launchListenerJarFilePath = Path.of("build", "launch-listener", "libs", jarName);
 
         assert launchListenerJarFilePath.toFile().exists();
 
         BalServer balServer = new BalServer();
         BMainInstance balClient = new BMainInstance(balServer);
 
-        Path serverBreLib = Paths.get(balServer.getServerHome(), "bre", "lib", jarName);
+        Path serverBreLib = Path.of(balServer.getServerHome(), "bre", "lib", jarName);
         BFileUtil.copy(launchListenerJarFilePath, serverBreLib);
 
-        Path balFilepath = Paths.get("src", "test", "resources", "listener");
-        String balFile = Paths.get(balFilepath.toString(), balFileName).toFile().getAbsolutePath();
+        Path balFilepath = Path.of("src", "test", "resources", "listener");
+        String balFile = Path.of(balFilepath.toString(), balFileName).toFile().getAbsolutePath();
 
         LogLeecher clientLeecher = new LogLeecher(serverResponse, LogLeecher.LeecherType.ERROR);
 
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MavenTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MavenTestCase.java
index db92243dcf34..6ed355172c69 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MavenTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MavenTestCase.java
@@ -30,7 +30,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Map;
 
 import static org.ballerinalang.test.packaging.PackerinaTestUtils.deleteFiles;
@@ -51,7 +50,7 @@ public void setUp() throws IOException, BallerinaTestException {
         this.projectPath = Files.createTempDirectory("bal-test-integration-maven-");
 
         // copy TestProject1 to a temp
-        Path originalTestProj1 = Paths.get("src", "test", "resources", "packaging", "maven", "jyaml")
+        Path originalTestProj1 = Path.of("src", "test", "resources", "packaging", "maven", "jyaml")
                 .toAbsolutePath();
         PackerinaTestUtils.copyFolder(originalTestProj1, this.projectPath);
 
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleExecutionFlowTests.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleExecutionFlowTests.java
index 190c570f05e9..66716341347e 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleExecutionFlowTests.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/ModuleExecutionFlowTests.java
@@ -25,7 +25,6 @@
 import org.testng.annotations.Test;
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -37,19 +36,19 @@ public class ModuleExecutionFlowTests extends BaseTest {
 
     @Test
     public void testModuleExecutionOrder() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "proj1");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "proj1");
         runAndAssert(projectPath);
     }
 
     @Test
     public void testModuleMainExecutionOrder() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "proj6");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "proj6");
         runAndAssert(projectPath);
     }
 
     @Test
     public void testImportModuleHasListener() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "proj2");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "proj2");
         BServerInstance serverInstance = new BServerInstance(balServer);
         serverInstance.startServer(projectPath.toAbsolutePath().toString(), projectPath.getFileName().toString(), null,
                                    null, null);
@@ -79,7 +78,7 @@ private void runAndAssert(Path projectPath) throws BallerinaTestException {
 
     @Test(description = "Test 'init' is called only once for each module at runtime")
     public void testModuleDependencyChainForInit() throws BallerinaTestException, InterruptedException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "module_invocation_project");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "module_invocation_project");
         BServerInstance serverInstance = new BServerInstance(balServer);
         serverInstance.startServer(projectPath.toAbsolutePath().toString(), "module_invocation_project", null, null,
                                    null);
@@ -103,19 +102,19 @@ public void testModuleDependencyChainForInit() throws BallerinaTestException, In
 
     @Test
     public void testDynamicListenerExecution() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "dynamic_listener_execution");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "dynamic_listener_execution");
         runAssertDynamicListener(projectPath);
     }
 
     @Test
     public void testDynamicListenerDeregister() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "dynamic_listener_deregister");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "dynamic_listener_deregister");
         runAssertDynamicListener(projectPath);
     }
 
     @Test
     public void testMultipleDynamicListenersWithAsyncCall() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging",
+        Path projectPath = Path.of("src", "test", "resources", "packaging",
                 "dynamic_listener_async_call_test_project");
         runAssertDynamicListener(projectPath);
     }
@@ -133,7 +132,7 @@ private void runAssertDynamicListener(Path projectPath) throws BallerinaTestExce
 
     @Test
     public void testStopHandlerExecution() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "stop_handler_execution");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "stop_handler_execution");
         BServerInstance serverInstance = new BServerInstance(balServer);
         serverInstance.startServer(projectPath.toAbsolutePath().toString(), projectPath.getFileName().toString(), null,
                 null, null);
@@ -154,7 +153,7 @@ public void testStopHandlerExecution() throws BallerinaTestException {
 
     @Test
     public void testModuleShutdownRegisteredWithStopHandlers() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "module_shutdown_order_project");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "module_shutdown_order_project");
 
         BServerInstance serverInstance = new BServerInstance(balServer);
         serverInstance.startServer(projectPath.toAbsolutePath().toString(), projectPath.getFileName().toString(), null,
@@ -177,7 +176,7 @@ public void testModuleShutdownRegisteredWithStopHandlers() throws BallerinaTestE
 
     @Test
     public void testStopHandlerExecutionOrder() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging",
+        Path projectPath = Path.of("src", "test", "resources", "packaging",
                 "stop_handler_execution_order_test");
 
         BServerInstance serverInstance = new BServerInstance(balServer);
@@ -213,7 +212,7 @@ public void testStopHandlerExecutionOrder() throws BallerinaTestException {
 
     @Test
     public void testListenerStopHandlerShutdownOrderWithErrorReturn() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging",
+        Path projectPath = Path.of("src", "test", "resources", "packaging",
                 "listener_stophandler_shutdown_order_project");
 
         BServerInstance serverInstance = new BServerInstance(balServer);
@@ -249,7 +248,7 @@ public void testListenerStopHandlerShutdownOrderWithErrorReturn() throws Balleri
 
     @Test
     public void testListenerStopHandlerAsyncCall() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging",
+        Path projectPath = Path.of("src", "test", "resources", "packaging",
                 "listener_stophandler_async_call_test");
 
         BServerInstance serverInstance = new BServerInstance(balServer);
@@ -276,7 +275,7 @@ public void testListenerStopHandlerAsyncCall() throws BallerinaTestException {
 
     @Test
     public void testStopHandlerAsyncCall() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging",
+        Path projectPath = Path.of("src", "test", "resources", "packaging",
                 "stop_handler_async_call_test");
         BServerInstance serverInstance = new BServerInstance(balServer);
         serverInstance.startServer(projectPath.toAbsolutePath().toString(), projectPath.getFileName().toString(), null,
@@ -299,7 +298,7 @@ public void testStopHandlerAsyncCall() throws BallerinaTestException {
 
     @Test
     public void testModuleExecuteFunctionOrder() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "module_execute_invocation_project");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "module_execute_invocation_project");
         BServerInstance serverInstance = new BServerInstance(balServer);
         LogLeecher listenerInitLeecher = new LogLeecher("Calling init for 'current'", LogLeecher.LeecherType.INFO);
         LogLeecher moduleInitLeecher = new LogLeecher("Initializing module 'current'", LogLeecher.LeecherType.INFO);
@@ -324,7 +323,7 @@ public void testModuleExecuteFunctionOrder() throws BallerinaTestException {
 
     @Test
     public void testModuleInitWithBusyWorkerAndListener() throws BallerinaTestException {
-        Path projectPath = Paths.get("src", "test", "resources", "packaging", "module_init_worker_project");
+        Path projectPath = Path.of("src", "test", "resources", "packaging", "module_init_worker_project");
         BServerInstance serverInstance = new BServerInstance(balServer);
         LogLeecher listenerInitLeecher = new LogLeecher("Calling init for 'current'", LogLeecher.LeecherType.INFO);
         LogLeecher moduleInitLeecher = new LogLeecher("Initializing module 'current'", LogLeecher.LeecherType.INFO);
@@ -354,7 +353,7 @@ public void testModuleInitWithBusyWorkerAndListener() throws BallerinaTestExcept
     @Test
     public void testModuleInitWithBusyWorkerAndDynamicListener() throws BallerinaTestException {
         Path projectPath =
-                Paths.get("src", "test", "resources", "packaging", "module_init_worker_dynamic_listener_project");
+                Path.of("src", "test", "resources", "packaging", "module_init_worker_dynamic_listener_project");
         BServerInstance serverInstance = new BServerInstance(balServer);
         LogLeecher moduleInitLeecher = new LogLeecher("Initializing module 'current'", LogLeecher.LeecherType.INFO);
         LogLeecher mainLeecher =
@@ -385,7 +384,7 @@ public void testModuleInitWithBusyWorkerAndDynamicListener() throws BallerinaTes
     @Test
     public void testModuleInitWithBusyWorkerTerminating() throws BallerinaTestException {
         Path projectPath =
-                Paths.get("src", "test", "resources", "packaging", "module_init_worker_no_listener_project");
+                Path.of("src", "test", "resources", "packaging", "module_init_worker_no_listener_project");
         BServerInstance serverInstance = new BServerInstance(balServer);
         LogLeecher moduleInitLeecher = new LogLeecher("Initializing module 'current'", LogLeecher.LeecherType.INFO);
         LogLeecher mainLeecher =
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MultipleModuleVersionTests.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MultipleModuleVersionTests.java
index 0e58f7291d5e..bfeb647d098a 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MultipleModuleVersionTests.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/packaging/MultipleModuleVersionTests.java
@@ -25,14 +25,15 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests usage of multiple package versions.
  */
 public class MultipleModuleVersionTests extends BaseTest {
 
-    private static final String testFileLocation = Paths.get("src", "test", "resources", "packaging", "versions")
+    private static final String testFileLocation = Path.of("src/test/resources/packaging/versions")
             .toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
@@ -40,9 +41,9 @@ public class MultipleModuleVersionTests extends BaseTest {
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
         // Build and push down stream packages.
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "http1.1.1").toString(), "waruna-http-any-1.1.1");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "http1.1.2").toString(), "waruna-http-any-1.1.2");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "websub").toString(), "waruna-websub-any-1.0.1");
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "http1.1.1").toString(), "waruna-http-any-1.1.1");
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "http1.1.2").toString(), "waruna-http-any-1.1.2");
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "websub").toString(), "waruna-websub-any-1.0.1");
     }
 
     private void compilePackageAndPushToLocal(String packagePath, String balaFileName) throws BallerinaTestException {
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/profiler/ProfilerTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/profiler/ProfilerTest.java
index a4f7a40658a0..a7f85638826c 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/profiler/ProfilerTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/profiler/ProfilerTest.java
@@ -29,7 +29,7 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,8 +41,7 @@
  * @since 2201.8.0
  */
 public class ProfilerTest extends BaseTest {
-    private static final String testFileLocation = Paths.get("src", "test", "resources", "profiler")
-            .toAbsolutePath().toString();
+    private static final String testFileLocation = Path.of("src/test/resources/profiler").toAbsolutePath().toString();
     private final String outputFile = "ProfilerReport.html";
     private BMainInstance bMainInstance;
     public static final String BALLERINA_HOME = "ballerina.home";
@@ -57,7 +56,7 @@ public void testProfilerExecutionWithBalPackage() throws BallerinaTestException
         String packageName = "projectForProfile" + File.separator + "package_a";
         String sourceRoot = testFileLocation + File.separator;
         Map envProperties = new HashMap<>();
-        String htmlFilePath = Paths.get(sourceRoot, packageName, "target", "profiler", outputFile).toString();
+        String htmlFilePath = Path.of(sourceRoot, packageName, "target", "profiler", outputFile).toString();
         List leechers = getProfilerLogLeechers(htmlFilePath);
         leechers.add(new LogLeecher("Is the array sorted? true"));
         bMainInstance.runMain("profile", new String[]{packageName}, envProperties,  null,
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest.java
index 063070926f0e..8cd95b12b8e5 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest.java
@@ -25,7 +25,8 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests intersection of the same construct via multiple modules.
@@ -34,8 +35,7 @@
  */
 public class ReadOnlyIntersectionViaMultipleModulesTest extends BaseTest {
 
-    private static final String testFileLocation =
-            Paths.get("src", "test", "resources", "packaging", "readonly", "one")
+    private static final String testFileLocation = Path.of("src/test/resources/packaging/readonly/one")
             .toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
@@ -43,11 +43,11 @@ public class ReadOnlyIntersectionViaMultipleModulesTest extends BaseTest {
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
         // Build and push down stream packages.
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_foo").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_foo").toString(),
                                      "testorg-selectively_immutable_foo-any-1.0.0");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_bar").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_bar").toString(),
                                      "testorg-selectively_immutable_bar-any-1.0.0");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_baz").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_baz").toString(),
                                      "testorg-selectively_immutable_baz-any-1.0.0");
     }
 
@@ -73,7 +73,7 @@ public void testSameIntersectionViaDifferentModules() throws BallerinaTestExcept
     private void buildQux() throws BallerinaTestException {
         LogLeecher buildLeecher = new LogLeecher("target/bala/testorg-selectively_immutable_qux-any-1.0.0.bala");
         bMainInstance.runMain("pack", new String[]{}, null, null, new LogLeecher[]{buildLeecher},
-                              Paths.get(testFileLocation, "test_project_immutable_qux").toString());
+                              Path.of(testFileLocation, "test_project_immutable_qux").toString());
         buildLeecher.waitForText(5000);
     }
 }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest2.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest2.java
index 34d342d0f979..2d81b8a3a495 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest2.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest2.java
@@ -25,7 +25,8 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests intersection of the same construct via multiple modules.
@@ -34,8 +35,7 @@
  */
 public class ReadOnlyIntersectionViaMultipleModulesTest2 extends BaseTest {
 
-    private static final String testFileLocation =
-            Paths.get("src", "test", "resources", "packaging", "readonly", "two")
+    private static final String testFileLocation = Path.of("src/test/resources/packaging/readonly/two")
             .toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
@@ -43,11 +43,11 @@ public class ReadOnlyIntersectionViaMultipleModulesTest2 extends BaseTest {
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
         // Build and push down stream packages.
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_foo").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_foo").toString(),
                                      "testorg-selectively_immutable_foo2-any-1.0.0");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_bar").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_bar").toString(),
                                      "testorg-selectively_immutable_bar2-any-1.0.0");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_baz").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_baz").toString(),
                                      "testorg-selectively_immutable_baz2-any-1.0.0");
     }
 
@@ -73,7 +73,7 @@ public void testSameIntersectionViaDifferentModules() throws BallerinaTestExcept
     private void buildQux() throws BallerinaTestException {
         LogLeecher buildLeecher = new LogLeecher("target/bala/testorg-selectively_immutable_qux2-any-1.0.0.bala");
         bMainInstance.runMain("pack", new String[]{}, null, null, new LogLeecher[]{buildLeecher},
-                              Paths.get(testFileLocation, "test_project_immutable_qux").toString());
+                              Path.of(testFileLocation, "test_project_immutable_qux").toString());
         buildLeecher.waitForText(5000);
     }
 }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest3.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest3.java
index fd8983e99c72..41325ec4590b 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest3.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/readonly/ReadOnlyIntersectionViaMultipleModulesTest3.java
@@ -25,7 +25,8 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests intersection of the same construct via multiple modules.
@@ -34,8 +35,7 @@
  */
 public class ReadOnlyIntersectionViaMultipleModulesTest3 extends BaseTest {
 
-    private static final String testFileLocation =
-            Paths.get("src", "test", "resources", "packaging", "readonly", "three")
+    private static final String testFileLocation = Path.of("src/test/resources/packaging/readonly/three")
             .toAbsolutePath().toString();
     private BMainInstance bMainInstance;
 
@@ -43,11 +43,11 @@ public class ReadOnlyIntersectionViaMultipleModulesTest3 extends BaseTest {
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
         // Build and push down stream packages.
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_foo").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_foo").toString(),
                                      "testorg-selectively_immutable_foo3-any-1.0.0");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_bar").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_bar").toString(),
                                      "testorg-selectively_immutable_bar3-any-1.0.0");
-        compilePackageAndPushToLocal(Paths.get(testFileLocation, "test_project_immutable_baz").toString(),
+        compilePackageAndPushToLocal(Path.of(testFileLocation, "test_project_immutable_baz").toString(),
                                      "testorg-selectively_immutable_baz3-any-1.0.0");
     }
 
@@ -73,7 +73,7 @@ public void testSameIntersectionViaDifferentModules() throws BallerinaTestExcept
     private void buildQux() throws BallerinaTestException {
         LogLeecher buildLeecher = new LogLeecher("target/bala/testorg-selectively_immutable_qux3-any-1.0.0.bala");
         bMainInstance.runMain("pack", new String[]{}, null, null, new LogLeecher[]{buildLeecher},
-                              Paths.get(testFileLocation, "test_project_immutable_qux").toString());
+                              Path.of(testFileLocation, "test_project_immutable_qux").toString());
         buildLeecher.waitForText(5000);
     }
 }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionNegativeTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionNegativeTestCase.java
index e45fe1b6f7de..eb3478c2c0ed 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionNegativeTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionNegativeTestCase.java
@@ -25,7 +25,8 @@
 import org.ballerinalang.test.context.LogLeecher.LeecherType;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * This class tests invoking an entry function in a bal file via the Ballerina Run Command.
@@ -54,7 +55,7 @@ public void testErrorPanicInMain() throws BallerinaTestException {
 
     private void executeTest(String message, String fileName, String... args) throws BallerinaTestException {
         LogLeecher errLogLeecher = new LogLeecher(message, LeecherType.ERROR);
-        String balFile = Paths.get("src", "test", "resources", "run", "file", fileName).toAbsolutePath().toString();
+        String balFile = Path.of("src/test/resources/run/file", fileName).toAbsolutePath().toString();
         BMainInstance bMainInstance = new BMainInstance(balServer);
         bMainInstance.runMain(balFile, new String[0], args, new LogLeecher[]{errLogLeecher});
         errLogLeecher.waitForText(10000);
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionPositiveTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionPositiveTestCase.java
index 86d051431847..30adf2c883d9 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionPositiveTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BalRunFunctionPositiveTestCase.java
@@ -24,7 +24,8 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * This class tests invoking a main function in a bal file via the Ballerina Run Command and the data binding
@@ -49,8 +50,8 @@ public void testMultipleParam() throws BallerinaTestException {
 
     private void executeTest(String[] args, String expected) throws BallerinaTestException {
         BMainInstance bMainInstance = new BMainInstance(balServer);
-        String output = bMainInstance.runMainAndReadStdOut("run", args, Paths
-                .get("src", "test", "resources", "run", "file").toString());
+        String output = bMainInstance.runMainAndReadStdOut("run", args,
+                Path.of("src/test/resources/run/file").toString());
         Assert.assertTrue(output.endsWith(expected));
     }
 }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BasicJavaJarRunTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BasicJavaJarRunTestCase.java
index a722a9e9d8e3..1c534e833882 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BasicJavaJarRunTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/run/BasicJavaJarRunTestCase.java
@@ -24,7 +24,8 @@
 import org.ballerinalang.test.context.LogLeecher;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * This class tests build a bal file and execute the jar via the java jar Command and the test the basic data binding
@@ -47,7 +48,7 @@ public void testMultipleParam() throws BallerinaTestException {
 
     private void executeTest(String serverResponse, String fileName, String... args) throws BallerinaTestException {
         BMainInstance ballerinaClient = new BMainInstance(balServer);
-        String balFile = Paths.get("src", "test", "resources", "run", "file", fileName).toAbsolutePath().toString();
+        String balFile = Path.of("src/test/resources/run/file", fileName).toAbsolutePath().toString();
         LogLeecher clientLeecher = new LogLeecher(serverResponse);
         ballerinaClient.runMain(balFile, null, args, new LogLeecher[]{clientLeecher});
         clientLeecher.waitForText(10000);
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/runtime/api/RuntimeAPITest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/runtime/api/RuntimeAPITest.java
index c4709f3d83e1..5d8bb8330d55 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/runtime/api/RuntimeAPITest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/runtime/api/RuntimeAPITest.java
@@ -28,7 +28,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -41,9 +40,9 @@
  */
 public class RuntimeAPITest extends BaseTest {
 
-    private static final String testFileLocation = Paths.get("src", "test", "resources", "runtime.api")
+    private static final String testFileLocation = Path.of("src", "test", "resources", "runtime.api")
             .toAbsolutePath().toString();
-    private static final Path javaSrcLocation = Paths.get("src", "test", "java", "org", "ballerinalang",
+    private static final Path javaSrcLocation = Path.of("src", "test", "java", "org", "ballerinalang",
             "test", "runtime", "api").toAbsolutePath();
     private static final String JAVA_OPTS = "JAVA_OPTS";
     private BMainInstance bMainInstance;
@@ -51,14 +50,14 @@ public class RuntimeAPITest extends BaseTest {
     @BeforeClass
     public void setup() throws BallerinaTestException {
         bMainInstance = new BMainInstance(balServer);
-        Path sourceRoot = Paths.get(testFileLocation, "function_invocation").toAbsolutePath();
+        Path sourceRoot = Path.of(testFileLocation, "function_invocation").toAbsolutePath();
         bMainInstance.runMain("build", new String[0], new HashMap<>(), new String[0], null,
                 sourceRoot.toString());
     }
 
     @Test
     public void testRuntimeAPIsForBalFunctionInvocation() throws BallerinaTestException {
-        Path jarPath = Paths.get(testFileLocation, "function_invocation", "target", "bin",
+        Path jarPath = Path.of(testFileLocation, "function_invocation", "target", "bin",
                 "function_invocation.jar").toAbsolutePath();
         compileJavaSource(jarPath, "targetDir", "RuntimeAPICall.java", "RuntimeAPITestUtils.java");
         unzipJarFile(jarPath, "targetDir");
@@ -67,7 +66,7 @@ public void testRuntimeAPIsForBalFunctionInvocation() throws BallerinaTestExcept
         bMainInstance.addJavaAgents(envProperties);
 
         // Run the executable jar and assert the output
-        Path execJarPath = Paths.get(javaSrcLocation.toString(), "targetDir", "test-exec.jar").toAbsolutePath();
+        Path execJarPath = Path.of(javaSrcLocation.toString(), "targetDir", "test-exec.jar").toAbsolutePath();
         List runCmdSet = new ArrayList<>();
         runCmdSet.add("java");
         if (envProperties.containsKey(JAVA_OPTS)) {
@@ -99,7 +98,7 @@ public void testRuntimeAPIsForBalFunctionInvocation() throws BallerinaTestExcept
 
     @Test
     public void testBalFunctionInvocationAPINegative() throws BallerinaTestException {
-        Path jarPath = Paths.get(testFileLocation, "function_invocation", "target", "bin",
+        Path jarPath = Path.of(testFileLocation, "function_invocation", "target", "bin",
                 "function_invocation.jar").toAbsolutePath();
         compileJavaSource(jarPath, "target-dir-negative", "RuntimeAPICallNegative.java", "RuntimeAPITestUtils.java");
         unzipJarFile(jarPath, "target-dir-negative");
@@ -109,7 +108,7 @@ public void testBalFunctionInvocationAPINegative() throws BallerinaTestException
         bMainInstance.addJavaAgents(envProperties);
 
         // Run the executable jar and assert the output
-        Path execJarPath = Paths.get(javaSrcLocation.toString(), "target-dir-negative",
+        Path execJarPath = Path.of(javaSrcLocation.toString(), "target-dir-negative",
                 "test-exec.jar").toAbsolutePath();
         List runCmdSet = new ArrayList<>();
         runCmdSet.add("java");
@@ -150,9 +149,9 @@ public void testBalFunctionInvocationAPINegative() throws BallerinaTestException
     @AfterClass
     public void tearDown() {
         bMainInstance = null;
-        BFileUtil.deleteDirectory(Paths.get(javaSrcLocation.toString(), "targetDir").toFile());
-        BFileUtil.deleteDirectory(Paths.get(javaSrcLocation.toString(), "target-dir-negative").toFile());
-        BFileUtil.deleteDirectory(Paths.get(javaSrcLocation.toString(), "start-call-negative").toFile());
+        BFileUtil.deleteDirectory(Path.of(javaSrcLocation.toString(), "targetDir").toFile());
+        BFileUtil.deleteDirectory(Path.of(javaSrcLocation.toString(), "target-dir-negative").toFile());
+        BFileUtil.deleteDirectory(Path.of(javaSrcLocation.toString(), "start-call-negative").toFile());
     }
 
     private static void compileJavaSource(Path jarPath, String targetDir, String... srcFiles)
@@ -164,7 +163,7 @@ private static void compileJavaSource(Path jarPath, String targetDir, String...
         compileCmdSet.add("-d");
         compileCmdSet.add(targetDir);
         for (String srcFile : srcFiles) {
-            compileCmdSet.add(Paths.get(javaSrcLocation.toString(), srcFile).toString());
+            compileCmdSet.add(Path.of(javaSrcLocation.toString(), srcFile).toString());
         }
         ProcessBuilder compile = new ProcessBuilder(compileCmdSet).directory(javaSrcLocation.toFile());
         try {
@@ -199,7 +198,7 @@ private static void createExecutableJar(String targetDir, String mainClass) thro
         jarCmdSet.add("test-exec.jar");
         jarCmdSet.add(mainClass);
         jarCmdSet.add(".");
-        Path targetPath = Paths.get(javaSrcLocation.toString(), targetDir).toAbsolutePath();
+        Path targetPath = Path.of(javaSrcLocation.toString(), targetDir).toAbsolutePath();
         ProcessBuilder jarProcess = new ProcessBuilder(jarCmdSet).inheritIO().directory(targetPath.toFile());
         try {
             Process process = jarProcess.start();
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorNegativeTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorNegativeTest.java
index 2de694fea092..9ce03713b6cb 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorNegativeTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorNegativeTest.java
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
@@ -42,7 +41,7 @@ public class SemverValidatorNegativeTest extends SemverValidatorBaseTest {
     private void setup() throws IOException, BallerinaTestException {
         tempProjectsDir = Files.createTempDirectory("bal-test-integration-semver-");
         customRepoDir = tempProjectsDir.resolve("ballerina-home");
-        Path testProject = Paths.get("src", "test", "resources", "semver").toAbsolutePath();
+        Path testProject = Path.of("src", "test", "resources", "semver").toAbsolutePath();
         FileUtils.copyFolder(testProject, tempProjectsDir);
         balClient = new BMainInstance(balServer);
     }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorTest.java
index 64e030fb323c..780f1ed5bf40 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/semver/SemverValidatorTest.java
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -41,7 +40,7 @@ public class SemverValidatorTest extends SemverValidatorBaseTest {
     private void setup() throws IOException, BallerinaTestException {
         tempProjectsDir = Files.createTempDirectory("bal-test-integration-semver-");
         customRepoDir = tempProjectsDir.resolve("ballerina-home");
-        Path testProject = Paths.get("src", "test", "resources", "semver").toAbsolutePath();
+        Path testProject = Path.of("src", "test", "resources", "semver").toAbsolutePath();
         FileUtils.copyFolder(testProject, tempProjectsDir);
         balClient = new BMainInstance(balServer);
     }
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/testarina/TestarinaTestCase.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/testarina/TestarinaTestCase.java
index fd8b9981cf29..1173a13d167f 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/testarina/TestarinaTestCase.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/testarina/TestarinaTestCase.java
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.stream.Stream;
 
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
@@ -49,7 +48,7 @@ public void setUp() throws IOException, BallerinaTestException {
         tempProjectDirectory = Files.createTempDirectory("bal-test-integration-testarina-project-");
 
         // copy TestProject1 to a temp
-        Path originalTestProj1 = Paths.get("src", "test", "resources",
+        Path originalTestProj1 = Path.of("src", "test", "resources",
                 "testarina", "ServiceTestProject").toAbsolutePath();
         this.serviceProjectPath = this.tempProjectDirectory.resolve("ServiceTestProject");
         copyFolder(originalTestProj1, this.serviceProjectPath);
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/troubleshoot/StrandDumpTest.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/troubleshoot/StrandDumpTest.java
index a8149b761ee6..22c9166126eb 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/troubleshoot/StrandDumpTest.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/troubleshoot/StrandDumpTest.java
@@ -31,7 +31,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -46,7 +45,7 @@
  */
 public class StrandDumpTest extends BaseTest {
 
-    private static final String testFileLocation = Paths.get("src/test/resources/troubleshoot/strandDump")
+    private static final String testFileLocation = Path.of("src/test/resources/troubleshoot/strandDump")
             .toAbsolutePath().toString();
     private static final String JAVA_OPTS = "JAVA_OPTS";
     private static final int TIMEOUT = 60000;
@@ -59,16 +58,16 @@ public void setup() throws BallerinaTestException {
 
     @Test
     public void testStrandDumpOfBalPackage() throws BallerinaTestException {
-        Path expectedOutputFilePath = Paths.get(testFileLocation, "testOutputs",
+        Path expectedOutputFilePath = Path.of(testFileLocation, "testOutputs",
                 "testPackageWithModulesStrandDumpRegEx.txt");
-        Path steadyStateOutputFilePath = Paths.get(testFileLocation, "testOutputs",
+        Path steadyStateOutputFilePath = Path.of(testFileLocation, "testOutputs",
                 "testPackageWithModulesSteadyState.txt");
         String sourceRoot = testFileLocation + "/";
         String packageName = "testPackageWithModules";
         Map envProperties = new HashMap<>();
         bMainInstance.runMain("build", new String[]{packageName}, envProperties, null, null, sourceRoot);
 
-        String jarPath = Paths.get(Paths.get(sourceRoot, packageName).toString(), "target", "bin",
+        String jarPath = Path.of(Path.of(sourceRoot, packageName).toString(), "target", "bin",
                 packageName + ".jar").toFile().getPath();
         runJarAndVerifyStrandDump(envProperties, jarPath, sourceRoot, expectedOutputFilePath,
                 steadyStateOutputFilePath);
@@ -80,8 +79,8 @@ public void testStrandDumpDuringBalTest() throws BallerinaTestException {
             return;
         }
 
-        Path expectedOutputFilePath = Paths.get(testFileLocation, "testOutputs", "balTestStrandDumpRegEx.txt");
-        Path steadyStateOutputFilePath = Paths.get(testFileLocation, "testOutputs", "balTestSteadyState.txt");
+        Path expectedOutputFilePath = Path.of(testFileLocation, "testOutputs", "balTestStrandDumpRegEx.txt");
+        Path steadyStateOutputFilePath = Path.of(testFileLocation, "testOutputs", "balTestSteadyState.txt");
         String sourceRoot = testFileLocation + "/";
         String packageName = "testPackageWithModules";
         Map envProperties = new HashMap<>();
@@ -95,15 +94,15 @@ public void testStrandDumpDuringBalTest() throws BallerinaTestException {
 
     @Test
     public void testStrandDumpOfSingleBalFile() throws BallerinaTestException {
-        Path expectedOutputFilePath = Paths.get(testFileLocation, "testOutputs", "balProgram1StrandDumpRegEx.txt");
-        Path steadyStateOutputFilePath = Paths.get(testFileLocation, "testOutputs", "balProgram1SteadyStateOutput.txt");
+        Path expectedOutputFilePath = Path.of(testFileLocation, "testOutputs", "balProgram1StrandDumpRegEx.txt");
+        Path steadyStateOutputFilePath = Path.of(testFileLocation, "testOutputs", "balProgram1SteadyStateOutput.txt");
         String commandDir = balServer.getServerHome();
         String balFile = testFileLocation + "/singleBalFiles/balProgram1.bal";
         Map envProperties = new HashMap<>();
         bMainInstance.runMain("build", new String[]{balFile}, envProperties, null, null, commandDir);
 
-        String balFileName = Paths.get(balFile).getFileName().toString();
-        String jarPath = Paths.get(Paths.get(commandDir).toString(),
+        String balFileName = Path.of(balFile).getFileName().toString();
+        String jarPath = Path.of(Path.of(commandDir).toString(),
                 balFileName.substring(0, balFileName.length() - 4) + ".jar").toString();
         runJarAndVerifyStrandDump(envProperties, jarPath, commandDir, expectedOutputFilePath,
                 steadyStateOutputFilePath);
diff --git a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/util/SQLDBUtils.java b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/util/SQLDBUtils.java
index 6fc74658293c..350d7ea92c06 100644
--- a/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/util/SQLDBUtils.java
+++ b/tests/jballerina-integration-test/src/test/java/org/ballerinalang/test/util/SQLDBUtils.java
@@ -27,7 +27,7 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
@@ -64,7 +64,7 @@ private static String readFileToString(String path) {
         URL fileResource = BCompileUtil.class.getClassLoader().getResource(path);
         try {
             if (fileResource == null) {
-                fileResource = Paths.get(path).toUri().toURL();
+                fileResource = Path.of(path).toUri().toURL();
             }
             return FileUtils.readFileToString(new File(fileResource.toURI()), StandardCharsets.UTF_8);
         } catch (IOException | URISyntaxException e) {
diff --git a/tests/jballerina-semtype-test/src/test/java/io/ballerina/test/SemTypeTest.java b/tests/jballerina-semtype-test/src/test/java/io/ballerina/test/SemTypeTest.java
index 573c25929a8e..80a1c769613e 100644
--- a/tests/jballerina-semtype-test/src/test/java/io/ballerina/test/SemTypeTest.java
+++ b/tests/jballerina-semtype-test/src/test/java/io/ballerina/test/SemTypeTest.java
@@ -36,7 +36,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -130,7 +129,7 @@ private Set expectedSubTypeRelations(String filePath) throws IOException
     }
 
     private Path resolvePath(String filepath) {
-        return Paths.get("src/test/resources").resolve(filepath);
+        return Path.of("src/test/resources").resolve(filepath);
     }
 
     private String relation(String subType, String superType) {
diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/ParserTestRunner.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/ParserTestRunner.java
index 34b1d65408c9..c8d481c4cd7c 100644
--- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/ParserTestRunner.java
+++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/ParserTestRunner.java
@@ -23,7 +23,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashSet;
 import java.util.stream.Stream;
 
@@ -34,7 +33,7 @@
  */
 public class ParserTestRunner {
 
-    private final Path ballerinaLangDir = Paths.get("").toAbsolutePath().getParent().getParent();
+    private final Path ballerinaLangDir = Path.of("").toAbsolutePath().getParent().getParent();
     private final Path parserDir = ballerinaLangDir.resolve("compiler").resolve("ballerina-parser");
 
     @Test(dataProvider = "parser-test-file-provider")
diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/BirVariableOptimizationTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/BirVariableOptimizationTest.java
index df00cb7a9dc1..841cbb481a7b 100644
--- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/BirVariableOptimizationTest.java
+++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/BirVariableOptimizationTest.java
@@ -32,7 +32,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.stream.Stream;
 
 /**
@@ -76,7 +75,7 @@ private String readFile(String name) throws IOException {
         // The files in the bir-dump folder are named with the function name and contain the expected bir dump for
         // the function
         name = name.replaceAll("<", "").replaceAll(">", "");
-        Path filePath = Paths.get("src", "test", "resources", "test-src", "bir", "bir-dump", name).toAbsolutePath();
+        Path filePath = Path.of("src", "test", "resources", "test-src", "bir", "bir-dump", name).toAbsolutePath();
         if (Files.exists(filePath)) {
             StringBuilder contentBuilder = new StringBuilder();
             try (Stream stream = Files.lines(filePath, StandardCharsets.UTF_8)) {
diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/RecordDesugarTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/RecordDesugarTest.java
index 1704aaa73a3f..8e1cd001147a 100644
--- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/RecordDesugarTest.java
+++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/bir/RecordDesugarTest.java
@@ -31,7 +31,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Stream;
@@ -73,7 +72,7 @@ private void assertFunctions(BIRNode.BIRFunction function) {
     private String readFile(String name) throws IOException {
         // The files in the bir-dump folder are named with the function name and contain the expected bir dump for
         // the function
-        Path filePath = Paths.get("src", "test", "resources", "test-src", "bir", "bir-dump", name).toAbsolutePath();
+        Path filePath = Path.of("src", "test", "resources", "test-src", "bir", "bir-dump", name).toAbsolutePath();
         if (Files.exists(filePath)) {
             StringBuilder contentBuilder = new StringBuilder();
             try (Stream stream = Files.lines(filePath, StandardCharsets.UTF_8)) {
diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/packaging/PathConverterIntegrationTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/packaging/PathConverterIntegrationTest.java
index a15c7e71edd9..d48c68c7af63 100644
--- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/packaging/PathConverterIntegrationTest.java
+++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/packaging/PathConverterIntegrationTest.java
@@ -10,7 +10,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Comparator;
 import java.util.List;
 import java.util.stream.Stream;
@@ -31,11 +30,11 @@ public class PathConverterIntegrationTest {
     @BeforeClass
     public void setup() throws IOException {
         tempDirectory = Files.createTempDirectory("bal-unit-test-patten-resolver-");
-        Path deep = tempDirectory.resolve(Paths.get("very", "deep", "path#to the", "dir.bal"));
+        Path deep = tempDirectory.resolve(Path.of("very", "deep", "path#to the", "dir.bal"));
         Files.createDirectories(deep);
-        Path semVer = tempDirectory.resolve(Paths.get("1.2.3", "path#to the", "dir.bal"));
+        Path semVer = tempDirectory.resolve(Path.of("1.2.3", "path#to the", "dir.bal"));
         Files.createDirectories(semVer);
-        Path semVerLatest = tempDirectory.resolve(Paths.get("1.5.0", "path#to the", "dir.bal"));
+        Path semVerLatest = tempDirectory.resolve(Path.of("1.5.0", "path#to the", "dir.bal"));
         Files.createDirectories(semVerLatest);
         tempNonSourceFile = Files.createFile(deep.resolve("my.bala"));
         tempFile = Files.createFile(deep.resolve("tempFile.bal"));
diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/ErrorOptimizationTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/ErrorOptimizationTest.java
index 9ca17bdc1d21..6e67228428f1 100644
--- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/ErrorOptimizationTest.java
+++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/ErrorOptimizationTest.java
@@ -26,7 +26,8 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests the optimizations done for error related type checks, to not pass through the TypeChecker.
@@ -37,8 +38,7 @@ public class ErrorOptimizationTest {
 
     @BeforeClass
     public void setup() {
-        compileResult = BCompileUtil.compile(
-                Paths.get("test-src", "typechecker", "error_optimizations.bal").toString());
+        compileResult = BCompileUtil.compile(Path.of("test-src/typechecker/error_optimizations.bal").toString());
     }
 
     @Test(dataProvider = "FunctionList")
diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/NilOptimizationTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/NilOptimizationTest.java
index 2eb10e617284..e7de027570ba 100644
--- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/NilOptimizationTest.java
+++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/typechecker/NilOptimizationTest.java
@@ -26,7 +26,8 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import java.nio.file.Paths;
+import java.nio.file.Path;
+
 
 /**
  * Tests the optimizations done for nil related type checks, to not pass through the TypeChecker.
@@ -37,8 +38,7 @@ public class NilOptimizationTest {
 
     @BeforeClass
     public void setup() {
-        compileResult = BCompileUtil.compile(
-                Paths.get("test-src", "typechecker", "nil_optimizations.bal").toString());
+        compileResult = BCompileUtil.compile(Path.of("test-src/typechecker/nil_optimizations.bal").toString());
     }
 
     @Test(dataProvider = "FunctionList")
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BaseTestCase.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BaseTestCase.java
index 7979e245e3a1..370009dab2fa 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BaseTestCase.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BaseTestCase.java
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Stream;
@@ -49,13 +48,11 @@ public void initialize() throws BallerinaTestException, IOException {
         tempProjectDirectory = Files.createTempDirectory("bal-test-integration-testerina-project-");
 
         // copy TestProjects to a temp
-        Path originalSingleFileTestsDir = Paths.get("src", "test", "resources", "single-file-tests")
-                .toAbsolutePath();
+        Path originalSingleFileTestsDir = Path.of("src/test/resources/single-file-tests").toAbsolutePath();
         singleFileTestsPath = tempProjectDirectory.resolve("single-file-tests");
         FileUtils.copyFolder(originalSingleFileTestsDir, singleFileTestsPath);
 
-        Path originalProjTestsDir = Paths.get("src", "test", "resources", "project-based-tests")
-                .toAbsolutePath();
+        Path originalProjTestsDir = Path.of("src/test/resources/project-based-tests").toAbsolutePath();
         projectBasedTestsPath = tempProjectDirectory.resolve("project-based-tests");
         FileUtils.copyFolder(originalProjTestsDir, projectBasedTestsPath);
     }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BasicCasesTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BasicCasesTest.java
index ee4ab4a8cfd0..afcfaea8c3d7 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BasicCasesTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/BasicCasesTest.java
@@ -26,7 +26,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 
 /**
@@ -41,8 +41,7 @@ public class BasicCasesTest extends BaseTestCase {
     public void setup() throws BallerinaTestException, IOException {
         balClient = new BMainInstance(balServer);
         projectPath = projectBasedTestsPath.toString();
-        FileUtils.copyFolder(Paths.get("build/libs"),
-                Paths.get(projectPath, "runtime-api-tests", "libs"));
+        FileUtils.copyFolder(Path.of("build/libs"), Path.of(projectPath, "runtime-api-tests", "libs"));
     }
 
     @Test
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/CodegenCodeCoverageTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/CodegenCodeCoverageTest.java
index 4e321b2e1171..f46e9e4ca6e4 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/CodegenCodeCoverageTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/CodegenCodeCoverageTest.java
@@ -36,7 +36,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Map;
 
@@ -59,9 +58,9 @@ public class CodegenCodeCoverageTest extends BaseTestCase {
     @BeforeClass
     public void setup() throws BallerinaTestException, IOException {
         balClient = new BMainInstance(balServer);
-        FileUtils.copyFolder(Paths.get("build").resolve("compiler-plugin-jars"),
+        FileUtils.copyFolder(Path.of("build/compiler-plugin-jars"),
                 projectBasedTestsPath.resolve("compiler-plugin-jars"));
-        repoBalaPath = Paths.get(balServer.getServerHome()).resolve("repo");
+        repoBalaPath = Path.of(balServer.getServerHome(), "repo");
     }
 
     @DataProvider(name = "provideCoverageData")
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/MockTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/MockTest.java
index 7c0400d59367..0c6f0e8848f4 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/MockTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/MockTest.java
@@ -38,7 +38,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 
 /**
@@ -53,8 +52,8 @@ public class MockTest extends BaseTestCase {
     public void setup() throws BallerinaTestException, IOException {
         balClient = new BMainInstance(balServer);
         projectPath = projectBasedTestsPath.toString();
-        FileUtils.copyFolder(Paths.get("build/libs"),
-                Paths.get(projectPath, "object-mocking-tests", "libs"));
+        FileUtils.copyFolder(Path.of("build/libs"),
+                Path.of(projectPath, "object-mocking-tests", "libs"));
         // Build and push config Lib project.
         compilePackageAndPushToLocal(projectBasedTestsPath.resolve("mockLibProject").toString(),
                 "testOrg-mockLib-any-0.1.0");
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionFlowTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionFlowTest.java
index 6a29076a0860..4d84c4189ede 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionFlowTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionFlowTest.java
@@ -26,7 +26,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 
 /**
@@ -57,7 +57,7 @@ public void testModuleExecutionFlow() throws BallerinaTestException, IOException
     @AfterMethod
     public void copyExec() {
         try {
-            FileUtils.copyBallerinaExec(Paths.get(projectPath), String.valueOf(System.currentTimeMillis()));
+            FileUtils.copyBallerinaExec(Path.of(projectPath), String.valueOf(System.currentTimeMillis()));
         } catch (IOException e) {
             // ignore exception
         }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionTest.java
index 4b3751655db9..851ac4f1da06 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionTest.java
@@ -28,7 +28,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 
 /**
@@ -168,7 +168,7 @@ public void test_Module1_WithGroups() throws BallerinaTestException, IOException
     @AfterMethod
     public void copyExec() {
         try {
-            FileUtils.copyBallerinaExec(Paths.get(projectPath), String.valueOf(System.currentTimeMillis()));
+            FileUtils.copyBallerinaExec(Path.of(projectPath), String.valueOf(System.currentTimeMillis()));
         } catch (IOException e) {
             // ignore exception
         }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionWithInitStartFailuresTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionWithInitStartFailuresTest.java
index 0ce6d8a21e0c..fc49490dfb4b 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionWithInitStartFailuresTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleExecutionWithInitStartFailuresTest.java
@@ -27,7 +27,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 
 import static org.ballerinalang.testerina.test.BaseTestCase.balServer;
@@ -63,7 +63,7 @@ public void testModuleExecutionFlow() throws BallerinaTestException, IOException
     @AfterMethod
     public void copyExec() {
         try {
-            FileUtils.copyBallerinaExec(Paths.get(projectPath), String.valueOf(System.currentTimeMillis()));
+            FileUtils.copyBallerinaExec(Path.of(projectPath), String.valueOf(System.currentTimeMillis()));
         } catch (IOException e) {
             // ignore exception
         }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleGracefulStopTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleGracefulStopTest.java
index 3344f33d1073..7ec7fb3e98e7 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleGracefulStopTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/ModuleGracefulStopTest.java
@@ -27,7 +27,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 
 /**
@@ -60,7 +60,7 @@ public void testModuleGracefulStop() throws BallerinaTestException, IOException
     @AfterMethod
     public void copyExec() {
         try {
-            FileUtils.copyBallerinaExec(Paths.get(projectPath), String.valueOf(System.currentTimeMillis()));
+            FileUtils.copyBallerinaExec(Path.of(projectPath), String.valueOf(System.currentTimeMillis()));
         } catch (IOException e) {
             // ignore exception
         }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/RerunFailedTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/RerunFailedTest.java
index baac889f9d28..29eed1d88166 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/RerunFailedTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/RerunFailedTest.java
@@ -28,7 +28,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -101,7 +101,7 @@ public void testRerunFailedTestWithMissingModuleNameInRunTestJson() throws Balle
     @AfterMethod
     public void copyExec() {
         try {
-            FileUtils.copyBallerinaExec(Paths.get(projectPath), String.valueOf(System.currentTimeMillis()));
+            FileUtils.copyBallerinaExec(Path.of(projectPath), String.valueOf(System.currentTimeMillis()));
         } catch (IOException e) {
             // ignore exception
         }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/TestExecutionWithInitFailuresTest.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/TestExecutionWithInitFailuresTest.java
index 906a1aa637e0..156c8ddac611 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/TestExecutionWithInitFailuresTest.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/TestExecutionWithInitFailuresTest.java
@@ -28,7 +28,7 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.HashMap;
 
 import static org.ballerinalang.testerina.test.BaseTestCase.balServer;
@@ -59,7 +59,7 @@ public void testModuleExecutionFlow() throws BallerinaTestException, IOException
     @AfterMethod
     public void copyExec() {
         try {
-            FileUtils.copyBallerinaExec(Paths.get(projectPath), String.valueOf(System.currentTimeMillis()));
+            FileUtils.copyBallerinaExec(Path.of(projectPath), String.valueOf(System.currentTimeMillis()));
         } catch (IOException e) {
             // ignore exception
         }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/negative/InvalidDataProviderTestCase.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/negative/InvalidDataProviderTestCase.java
index 36663c1938a8..1d4f4d8f9bff 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/negative/InvalidDataProviderTestCase.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/negative/InvalidDataProviderTestCase.java
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 
 /**
@@ -44,7 +43,7 @@ public class InvalidDataProviderTestCase extends BaseTestCase {
     public void setup() throws BallerinaTestException {
         balClient = new BMainInstance(balServer);
         projectPath = singleFileTestsPath.resolve("invalid-data-providers").toString();
-        errorlogFile = Paths.get(projectPath).resolve("ballerina-internal.log");
+        errorlogFile = Path.of(projectPath).resolve("ballerina-internal.log");
     }
 
     @BeforeMethod
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/AssertionUtils.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/AssertionUtils.java
index a84ae8d020f0..71aad517f9a6 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/AssertionUtils.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/AssertionUtils.java
@@ -22,7 +22,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Locale;
 
 /**
@@ -35,8 +34,7 @@ public final class AssertionUtils {
     private static final Boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.getDefault())
             .contains("win");
 
-    private static final Path commandOutputsDir = Paths
-            .get("src", "test", "resources", "command-outputs");
+    private static final Path commandOutputsDir = Path.of("src", "test", "resources", "command-outputs");
 
     private AssertionUtils() {
     }
diff --git a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/FileUtils.java b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/FileUtils.java
index f66d07a2e51f..0df2dc26e214 100644
--- a/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/FileUtils.java
+++ b/tests/testerina-integration-test/src/test/java/org/ballerinalang/testerina/test/utils/FileUtils.java
@@ -20,7 +20,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.stream.Stream;
 
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
@@ -78,7 +77,7 @@ public static void copyBallerinaExec(Path packagePath, String suffix) throws IOE
                 .resolve("coverage").resolve("ballerina.exec");
         if (execPath.toFile().exists()) {
             Files.copy(execPath,
-                    Paths.get(System.getProperty("user.dir")).resolve("build").resolve("jacoco").resolve(
+                    Path.of(System.getProperty("user.dir"), "build", "jacoco",
                             packagePath.getFileName().toString() + suffix + ".exec"));
 
         }

From da2755d315f6e20535c2b4b51f4193b2c64b40dd Mon Sep 17 00:00:00 2001
From: Felix Schnabel 
Date: Fri, 19 Jul 2024 13:24:45 +0200
Subject: [PATCH 2/5] Address review suggestions

---
 .../ballerinalang/repository/fs/LocalFSPackageRepository.java   | 1 -
 .../compiler/parser/test/syntax/misc/AbstractMiscTest.java      | 1 -
 .../parser/test/syntax/statements/AbstractStatementTest.java    | 1 -
 .../compiler/parser/test/syntax/trivia/AbstractTriviaTest.java  | 1 -
 .../compiler/parser/test/syntax/types/AbstractTypesTest.java    | 1 -
 .../compiler/parser/test/tree/DeprecatedSyntaxAPITest.java      | 1 -
 .../org/ballerinalang/docgen/docs/BallerinaDocGenerator.java    | 2 +-
 .../formatter/core/actions/CheckingActionsTest.java             | 2 +-
 .../ballerinalang/formatter/core/actions/FlushActionsTest.java  | 2 +-
 .../ballerinalang/formatter/core/actions/QueryActionsTest.java  | 2 +-
 .../formatter/core/actions/SendReceiveActionsTest.java          | 2 +-
 .../ballerinalang/formatter/core/actions/StartActionsTest.java  | 2 +-
 .../ballerinalang/formatter/core/actions/TrapActionsTest.java   | 2 +-
 .../formatter/core/actions/TypeCastActionsTest.java             | 2 +-
 .../ballerinalang/formatter/core/actions/WaitActionsTest.java   | 2 +-
 .../formatter/core/configurations/RemoteConfigurationTest.java  | 2 +-
 .../core/declarations/ClassDefinitionDeclarationsTest.java      | 2 +-
 .../core/declarations/FunctionDefinitionDeclarationsTest.java   | 2 +-
 .../formatter/core/declarations/ImportDeclarationsTest.java     | 2 +-
 .../formatter/core/declarations/ModuleEnumDeclarationsTest.java | 2 +-
 .../core/declarations/ModuleTypeDefinitionDeclarationsTest.java | 2 +-
 .../core/declarations/ModuleVariableDeclarationsTest.java       | 2 +-
 .../core/declarations/ServiceListenerDeclarationsTest.java      | 2 +-
 .../core/expressions/BinaryBitwiseExpressionsTest.java          | 2 +-
 .../formatter/core/expressions/ConditionalExpressionsTest.java  | 2 +-
 .../formatter/core/expressions/ConstantExpressionsTest.java     | 2 +-
 .../formatter/core/expressions/EqualityExpressionsTest.java     | 2 +-
 .../formatter/core/expressions/LetExpressionsTest.java          | 2 +-
 .../formatter/core/expressions/LiteralExpressionsTest.java      | 2 +-
 .../formatter/core/expressions/LogicalExpressionsTest.java      | 2 +-
 .../core/expressions/MultiplicativeExpressionsTest.java         | 2 +-
 .../formatter/core/expressions/NewExpressionsTest.java          | 2 +-
 .../core/expressions/ObjectConstructorExpressionsTest.java      | 2 +-
 .../core/expressions/OptionalFieldAccessExpressionsTest.java    | 2 +-
 .../formatter/core/expressions/QueryExpressionsTest.java        | 2 +-
 .../formatter/core/expressions/RangeExpressionsTest.java        | 2 +-
 .../formatter/core/expressions/RawTemplateExpressionsTest.java  | 2 +-
 .../formatter/core/expressions/RelationalExpressionsTest.java   | 2 +-
 .../formatter/core/expressions/ShiftExpressionsTest.java        | 2 +-
 .../core/expressions/StringTemplateExpressionsTest.java         | 2 +-
 .../formatter/core/expressions/TypeTestExpressionsTest.java     | 2 +-
 .../formatter/core/expressions/UnaryExpressionsTest.java        | 2 +-
 .../formatter/core/expressions/XMLTemplateExpressionsTest.java  | 2 +-
 .../java/org/ballerinalang/formatter/core/misc/BlocksTest.java  | 2 +-
 .../org/ballerinalang/formatter/core/misc/LineBreaksTest.java   | 2 +-
 .../org/ballerinalang/formatter/core/misc/LineWrappingTest.java | 2 +-
 .../org/ballerinalang/formatter/core/misc/MetadataTest.java     | 2 +-
 .../formatter/core/statements/AssignmentStatementsTest.java     | 2 +-
 .../formatter/core/statements/BlockStatementsTest.java          | 2 +-
 .../formatter/core/statements/BreakStatementsTest.java          | 2 +-
 .../formatter/core/statements/CallStatementsTest.java           | 2 +-
 .../core/statements/CompoundAssignmentStatementsTest.java       | 2 +-
 .../formatter/core/statements/ContinueStatementsTest.java       | 2 +-
 .../formatter/core/statements/DoStatementsTest.java             | 2 +-
 .../formatter/core/statements/ForEachStatementsTest.java        | 2 +-
 .../formatter/core/statements/ForkStatementsTest.java           | 2 +-
 .../formatter/core/statements/IfElseStatementsTest.java         | 2 +-
 .../core/statements/LocalTypeDefinitionStatementsTest.java      | 2 +-
 .../formatter/core/statements/LockStatementsTest.java           | 2 +-
 .../formatter/core/statements/MatchStatementsTest.java          | 2 +-
 .../formatter/core/statements/PanicStatementsTest.java          | 2 +-
 .../formatter/core/statements/ReturnStatementsTest.java         | 2 +-
 .../formatter/core/statements/WhileStatementsTest.java          | 2 +-
 .../core/statements/XMLNSDeclarationStatementsTest.java         | 2 +-
 .../formatter/core/types/BehaviouralTypesTest.java              | 2 +-
 .../org/ballerinalang/formatter/core/types/OtherTypesTest.java  | 2 +-
 .../ballerinalang/formatter/core/types/SequenceTypesTest.java   | 2 +-
 .../org/ballerinalang/formatter/core/types/SimpleTypesTest.java | 2 +-
 .../ballerinalang/formatter/core/types/StructuredTypesTest.java | 2 +-
 69 files changed, 63 insertions(+), 69 deletions(-)

diff --git a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java
index 0f3a0f3848bb..af295766088f 100644
--- a/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java
+++ b/compiler/ballerina-lang/src/main/java/org/ballerinalang/repository/fs/LocalFSPackageRepository.java
@@ -21,7 +21,6 @@
 
 import java.nio.file.Path;
 
-
 /**
  * This represents a local file system based {@link org.ballerinalang.repository.PackageRepository}.
  *
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java
index f3ca4c244312..29c4d430cea8 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/misc/AbstractMiscTest.java
@@ -22,7 +22,6 @@
 
 import java.nio.file.Path;
 
-
 /**
  * Test parsing miscellaneous constructs in ballerina.
  * 
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java
index 5d4a1eaf1c7c..88699d7cf55c 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/AbstractStatementTest.java
@@ -22,7 +22,6 @@
 
 import java.nio.file.Path;
 
-
 /**
  * Test parsing statements.
  * 
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java
index 6a88473c0817..6229573220aa 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/trivia/AbstractTriviaTest.java
@@ -22,7 +22,6 @@
 
 import java.nio.file.Path;
 
-
 /**
  * Test capturing trivia.
  */
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java
index d10a8c21bc6a..614151b40ea4 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/types/AbstractTypesTest.java
@@ -22,7 +22,6 @@
 
 import java.nio.file.Path;
 
-
 /**
  * Test parsing expressions.
  */
diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java
index c9d3ee4aacd0..c64437dc4145 100644
--- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java
+++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/tree/DeprecatedSyntaxAPITest.java
@@ -25,7 +25,6 @@
 
 import java.nio.file.Path;
 
-
 /**
  * This class tests the deprecated syntax APIs.
  *
diff --git a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java
index 7ac3b24685d3..ff8974d88b62 100644
--- a/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java
+++ b/misc/docerina/src/main/java/org/ballerinalang/docgen/docs/BallerinaDocGenerator.java
@@ -230,7 +230,7 @@ public static void copyIcon(Project project, Path output, ModuleLibrary moduleLi
         if (!sourceLocation.isEmpty()) {
             output = output.resolve(moduleLib.modules.get(0).orgName).resolve(moduleLib.modules.get(0).id)
                     .resolve(moduleLib.modules.get(0).version).resolve(ICON_NAME);
-            Path iconPath = Paths.get(sourceLocation);
+            Path iconPath = Path.of(sourceLocation);
             try {
                 byte[] iconByteArray = Files.readAllBytes(iconPath);
                 Files.write(output, iconByteArray);
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java
index cee0375c0f0e..38f3b8717933 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/CheckingActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/checking").toString();
+        return Path.of("actions", "checking").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java
index 44c0c509f8ae..4e8572e8dcd3 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/FlushActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/flush").toString();
+        return Path.of("actions", "flush").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java
index 185a9261fc98..e7000cd2c99c 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/QueryActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/query").toString();
+        return Path.of("actions", "query").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java
index 066310c5540a..f9a83a3b7ff2 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/SendReceiveActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/send-receive").toString();
+        return Path.of("actions", "send-receive").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java
index 11fc24d03cb0..95e42a6eac38 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/StartActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/start").toString();
+        return Path.of("actions", "start").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java
index 203e75362a0f..38cba16bed11 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TrapActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/trap").toString();
+        return Path.of("actions", "trap").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java
index bede9b9ef48e..3a1488b2f2d6 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/TypeCastActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/type-cast").toString();
+        return Path.of("actions", "type-cast").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java
index a01f3fd7d90e..2711ddb87274 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/actions/WaitActionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("actions/wait").toString();
+        return Path.of("actions", "wait").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java
index dd085f9c819f..229a88965c6d 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/RemoteConfigurationTest.java
@@ -55,6 +55,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("configurations/remote").toString();
+        return Path.of("configurations", "remote").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java
index 12bac59198fe..2cf33724b2c8 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ClassDefinitionDeclarationsTest.java
@@ -57,6 +57,6 @@ public Object[][] dataProvider() {
      */
     @Override
     public String getTestResourceDir() {
-        return Path.of("declarations/class-definition").toString();
+        return Path.of("declarations", "class-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java
index f8f96ba7f435..0968ca9530a1 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/FunctionDefinitionDeclarationsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("declarations/function-definition").toString();
+        return Path.of("declarations", "function-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java
index 5edc01717192..8c4d9144a29e 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ImportDeclarationsTest.java
@@ -89,6 +89,6 @@ public Object[][] dataProviderWithCustomTests(Method testName) {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("declarations/import").toString();
+        return Path.of("declarations", "import").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java
index c1577299eff5..b424e2d82563 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleEnumDeclarationsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("declarations/module-enumeration").toString();
+        return Path.of("declarations", "module-enumeration").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java
index bd0759d0fabe..aabf8eeb4ff9 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleTypeDefinitionDeclarationsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("declarations/module-type-definition").toString();
+        return Path.of("declarations", "module-type-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java
index 80fff0a7529a..cc2d09542b30 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ModuleVariableDeclarationsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("declarations/module-variable").toString();
+        return Path.of("declarations", "module-variable").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java
index 4a2a73b7a517..460c7f5cb2f6 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/declarations/ServiceListenerDeclarationsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("declarations/service-listener").toString();
+        return Path.of("declarations", "service-listener").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java
index ed43ab3663ed..7d07d7f2d845 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/BinaryBitwiseExpressionsTest.java
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/binary-bitwise").toString();
+        return Path.of("expressions", "binary-bitwise").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java
index a01e6f3aaaa9..ae4690076ae1 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConditionalExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/conditional").toString();
+        return Path.of("expressions", "conditional").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java
index 651eb44f3cf6..c285bdabe6bb 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ConstantExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/constant").toString();
+        return Path.of("expressions", "constant").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java
index b9d355d3ad56..139d302416cb 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/EqualityExpressionsTest.java
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/equality").toString();
+        return Path.of("expressions", "equality").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java
index 112b46273852..731f2c434af2 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LetExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/let").toString();
+        return Path.of("expressions", "let").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java
index 2252068dca47..20df1ee517e9 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LiteralExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/literal").toString();
+        return Path.of("expressions", "literal").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java
index d1f79600de75..a3e5ecc00d54 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/LogicalExpressionsTest.java
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/logical").toString();
+        return Path.of("expressions", "logical").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java
index eb7e0911d6c4..38698da7ccc2 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/MultiplicativeExpressionsTest.java
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/multiplicative").toString();
+        return Path.of("expressions", "multiplicative").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java
index 21dd9b37be6c..4f579c70c1c1 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/NewExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/new").toString();
+        return Path.of("expressions", "new").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java
index 0cc0358e1335..3fcc1321925a 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ObjectConstructorExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/object-constructor").toString();
+        return Path.of("expressions", "object-constructor").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java
index a72f7ede2eee..1b2d95064540 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/OptionalFieldAccessExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/optional-field-access").toString();
+        return Path.of("expressions", "optional-field-access").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java
index 8a9c179ae6d3..6742bdc5beb4 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/QueryExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/query").toString();
+        return Path.of("expressions", "query").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java
index e58a154eb36c..65250402de31 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RangeExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/range").toString();
+        return Path.of("expressions", "range").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java
index c431648036e6..9d2843968293 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RawTemplateExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/raw-template").toString();
+        return Path.of("expressions", "raw-template").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java
index 393363daaff9..e24be0691b56 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/RelationalExpressionsTest.java
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/relational").toString();
+        return Path.of("expressions", "relational").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java
index 7454df5adaf8..3174d67a4d01 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/ShiftExpressionsTest.java
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/shift").toString();
+        return Path.of("expressions", "shift").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java
index 873de4104621..6e79d9c20997 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/StringTemplateExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/string-template").toString();
+        return Path.of("expressions", "string-template").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java
index de610154fa73..9e638614730b 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/TypeTestExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/type-test").toString();
+        return Path.of("expressions", "type-test").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java
index 07f4376df3d1..406a44abcc16 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/UnaryExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/unary").toString();
+        return Path.of("expressions", "unary").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java
index e8201ab4ed1f..b3c9dad2ea5d 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/expressions/XMLTemplateExpressionsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("expressions/xml-template").toString();
+        return Path.of("expressions", "xml-template").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java
index a41464b87593..9aa048949d54 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/BlocksTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("misc/blocks").toString();
+        return Path.of("misc", "blocks").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java
index 963143865735..bd9662da8260 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineBreaksTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("misc/linebreaks").toString();
+        return Path.of("misc", "linebreaks").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java
index 67ce8c0141e3..0b60fe1640f8 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/LineWrappingTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("misc/linewrapping").toString();
+        return Path.of("misc", "linewrapping").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java
index dd0e18be7b66..3f7489d1cdfe 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/misc/MetadataTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("misc/metadata").toString();
+        return Path.of("misc", "metadata").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java
index 2ffd01bb75b0..caa91b2fc123 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/AssignmentStatementsTest.java
@@ -50,6 +50,6 @@ public Object[][] testSubset() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/assignment").toString();
+        return Path.of("statements", "assignment").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java
index 16b8804e3039..093cff2da448 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BlockStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/block").toString();
+        return Path.of("statements", "block").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java
index 6e458af8358a..f5787c1ce1ca 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/BreakStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/break").toString();
+        return Path.of("statements", "break").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java
index ec964e96dd02..3419b93ef778 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CallStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/call").toString();
+        return Path.of("statements", "call").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java
index 0f83225b9be1..f455e2429573 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/CompoundAssignmentStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/compound-assignment").toString();
+        return Path.of("statements", "compound-assignment").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java
index 262ef453fdcb..77aaffb29aab 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ContinueStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/continue").toString();
+        return Path.of("statements", "continue").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java
index e06d50e77362..b4c730eb5e0a 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/DoStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/do").toString();
+        return Path.of("statements", "do").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java
index 95d9f7452ab9..82d1a91fee33 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForEachStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/foreach").toString();
+        return Path.of("statements", "foreach").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java
index 0420c1f26317..4f3e6fac1388 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ForkStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/fork").toString();
+        return Path.of("statements", "fork").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java
index 7b35929e92d5..5ddb8b3e3b48 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/IfElseStatementsTest.java
@@ -45,7 +45,7 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/if-else").toString();
+        return Path.of("statements", "if-else").toString();
     }
 
     @Override
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java
index 34337ac593af..a934ece92a17 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LocalTypeDefinitionStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/local-type-definition").toString();
+        return Path.of("statements", "local-type-definition").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java
index 766ab9d1c51b..e96758a1d73d 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/LockStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/lock").toString();
+        return Path.of("statements", "lock").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java
index 73bcb2d83915..5337367c8f02 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/MatchStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/match").toString();
+        return Path.of("statements", "match").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java
index 754e8c254b4c..4d6c230cd4af 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/PanicStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/panic").toString();
+        return Path.of("statements", "panic").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java
index c325841c508c..314388266fff 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/ReturnStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/return").toString();
+        return Path.of("statements", "return").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java
index be057e3bb2e8..ca5ca71fcaf0 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/WhileStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/while").toString();
+        return Path.of("statements", "while").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java
index 37927cc68de0..3b83a661b1a0 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/statements/XMLNSDeclarationStatementsTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("statements/xmlns-declaration").toString();
+        return Path.of("statements", "xmlns-declaration").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java
index 395815ca3a63..479cafeab8b4 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/BehaviouralTypesTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("types/behavioural").toString();
+        return Path.of("types", "behavioural").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java
index 51d61a6d7d23..8fc0a9403fcd 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/OtherTypesTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("types/other").toString();
+        return Path.of("types", "other").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java
index 07a8dc8393ce..805f56e3e710 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SequenceTypesTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("types/sequence").toString();
+        return Path.of("types", "sequence").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java
index 78fec866543b..6ac51415233a 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/SimpleTypesTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("types/simple").toString();
+        return Path.of("types", "simple").toString();
     }
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java
index fec2fd418b66..482ebc3ed840 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/types/StructuredTypesTest.java
@@ -43,6 +43,6 @@ public Object[][] dataProvider() {
 
     @Override
     public String getTestResourceDir() {
-        return Path.of("types/structured").toString();
+        return Path.of("types", "structured").toString();
     }
 }

From 6a70dcc3d1381d4b4ba99de0498adfdb0170fbb0 Mon Sep 17 00:00:00 2001
From: Felix Schnabel 
Date: Fri, 19 Jul 2024 13:26:42 +0200
Subject: [PATCH 3/5] Merge more paths to use `/` instead of multiple
 resolves/arguments

---
 .../ballerina/cli/cmd/ProfileCommandTest.java | 14 ++--
 .../io/ballerina/cli/cmd/PullCommandTest.java | 16 ++--
 .../io/ballerina/cli/cmd/PushCommandTest.java | 70 +++++++---------
 .../cli/cmd/RunBuildToolsTaskTest.java        |  2 +-
 .../io/ballerina/cli/cmd/RunCommandTest.java  | 41 ++++-----
 .../io/ballerina/cli/cmd/TestCommandTest.java | 84 +++++++++----------
 .../cli/cmd/TestNativeImageCommandTest.java   |  8 +-
 .../projects/BallerinaTomlTests.java          |  2 +-
 .../projects/CyclicDependenciesTest.java      |  2 +-
 .../projects/DependenciesTomlTests.java       |  2 +-
 .../io/ballerina/projects/DotGraphsTests.java |  3 +-
 .../FileSystemRepositoryGetPackagesTests.java |  2 +-
 .../projects/FileSystemRepositoryTests.java   |  2 +-
 .../FileSystemRepositoryValidationTests.java  |  2 +-
 .../projects/MavenPackageRepositoryTests.java | 20 ++---
 .../ballerina/projects/ProjectPathsTest.java  | 76 +++++++----------
 .../ballerina/projects/ProjectUtilsTests.java |  2 +-
 .../projects/utils/TestFileUtils.java         |  2 +-
 .../bindgen/BindgenUnitBaseTest.java          |  3 +-
 .../docgen/tests/GenDocsForBalaTest.java      | 20 ++---
 .../formatter/cli/FormatCmdTest.java          | 42 +++++-----
 .../formatter/core/FormatterTest.java         |  4 +-
 .../formatter/core/RangeFormatterTest.java    |  2 +-
 .../FormatFileResolutionTest.java             |  4 +-
 .../FormatFileValidatorTest.java              |  2 +-
 25 files changed, 188 insertions(+), 239 deletions(-)

diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java
index 6afb8b485bf8..496b8aee3e77 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProfileCommandTest.java
@@ -83,7 +83,7 @@ public void setup() throws IOException {
 
     @Test(description = "Profile a ballerina project")
     public void testRunBalProjectWithProfileFlag() throws IOException {
-        Path projectPath = this.testResources.resolve("projectForProfile").resolve("package_a");
+        Path projectPath = this.testResources.resolve("projectForProfile/package_a");
         System.setProperty(USER_DIR_PROPERTY, projectPath.toString());
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -93,7 +93,7 @@ public void testRunBalProjectWithProfileFlag() throws IOException {
         profileCommand.execute();
         String buildLog = readOutput(true).replaceAll("\r", "").replaceAll("\\\\", "/").strip();
         Assert.assertEquals(buildLog, getOutput("run-project-with-profile.txt"));
-        Path htmlPath = projectPath.resolve("target").resolve("profiler").resolve("ProfilerReport.html");
+        Path htmlPath = projectPath.resolve("target/profiler/ProfilerReport.html");
         Assert.assertTrue(htmlPath.toFile().exists());
         try {
             String htmlContent = Files.readString(htmlPath);
@@ -107,7 +107,7 @@ public void testRunBalProjectWithProfileFlag() throws IOException {
 
     @Test(description = "Profile a ballerina project with build tools")
     public void testRunBalProjectWithProfileFlagWithBuildTools() throws IOException {
-        Path projectPath = this.testResources.resolve("projectForProfile").resolve("package_b");
+        Path projectPath = this.testResources.resolve("projectForProfile/package_b");
         System.setProperty(USER_DIR_PROPERTY, projectPath.toString());
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -117,7 +117,7 @@ public void testRunBalProjectWithProfileFlagWithBuildTools() throws IOException
         profileCommand.execute();
         String buildLog = readOutput(true).replaceAll("\r", "").replaceAll("\\\\", "/").strip();
         Assert.assertEquals(buildLog, getOutput("profile-project-with-build-tool.txt"));
-        Path htmlPath = projectPath.resolve("target").resolve("profiler").resolve("ProfilerReport.html");
+        Path htmlPath = projectPath.resolve("target/profiler/ProfilerReport.html");
         Assert.assertTrue(htmlPath.toFile().exists());
         try {
             String htmlContent = Files.readString(htmlPath);
@@ -132,7 +132,7 @@ public void testRunBalProjectWithProfileFlagWithBuildTools() throws IOException
     @Test(description = "Test profile command with help")
     public void testProfileCommandAndHelp() throws IOException {
         String[] args = {"--help"};
-        Path projectPath = this.testResources.resolve("projectForProfile").resolve("package_a");
+        Path projectPath = this.testResources.resolve("projectForProfile/package_a");
         System.setProperty(USER_DIR_PROPERTY, projectPath.toString());
         ProfileCommand profileCommand = new ProfileCommand(projectPath, printStream, false);
         new CommandLine(profileCommand).parseArgs(args);
@@ -160,8 +160,8 @@ public void testProfileEmptyProject() throws IOException {
     @Test(description = "Profile an empty package with code generator build tools")
     public void testProfileEmptyProjectWithBuildTools() throws IOException {
         Path testDistCacheDirectory = Path.of("build").toAbsolutePath().resolve(DIST_CACHE_DIRECTORY);
-        BCompileUtil.compileAndCacheBala(testResources.resolve("buildToolResources").resolve("tools")
-                .resolve("ballerina-generate-file").toString());
+        BCompileUtil.compileAndCacheBala(
+                testResources.resolve("buildToolResources/tools/ballerina-generate-file").toString());
         Path projectPath = this.testResources.resolve("emptyProjectWithBuildTool");
         replaceDependenciesTomlContent(projectPath, "**INSERT_DISTRIBUTION_VERSION_HERE**",
                 RepoUtils.getBallerinaShortVersion());
diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java
index 4b5fe7384829..8de339dae3ce 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PullCommandTest.java
@@ -148,11 +148,9 @@ public void testPullCommandWithHelp() throws IOException {
     @Test(description = "Pull a package from custom remote repository")
     public void testPullCustom() throws SettingsTomlException, IOException {
 
-        Path customrRepoPath = Path.of("src", "test", "resources", "test-resources", "custom-repo",
-                "repositories", "repo-push-pull");
-        Path settingsTomlPath = Path.of("src", "test", "resources", "test-resources", "custom-repo",
-                "Settings.toml");
-        Path mockBallerinaHome = Path.of("build").resolve("ballerina-home");
+        Path customrRepoPath = Path.of("src/test/resources/test-resources/custom-repo/repositories/repo-push-pull");
+        Path settingsTomlPath = Path.of("src/test/resources/test-resources/custom-repo/Settings.toml");
+        Path mockBallerinaHome = Path.of("build/ballerina-home");
 
         PullCommand pullCommand = new PullCommand(printStream, false);
         new CommandLine(pullCommand).parseArgs("luheerathan/pact1:0.1.0", "--repository=repo-push-pull");
@@ -170,11 +168,9 @@ public void testPullCustom() throws SettingsTomlException, IOException {
     @Test(description = "Pull a package from custom remote repository(not exist in Settings.toml)")
     public void testPullNonExistingCustom() throws SettingsTomlException, IOException {
 
-        Path customrRepoPath = Path.of("src", "test", "resources", "test-resources", "custom-repo",
-                "repositories", "repo-push-pull");
-        Path settingsTomlPath = Path.of("src", "test", "resources", "test-resources", "custom-repo",
-                "Settings.toml");
-        Path mockBallerinaHome = Path.of("build").resolve("ballerina-home");
+        Path customrRepoPath = Path.of("src/test/resources/test-resources/custom-repo/repositories/repo-push-pull");
+        Path settingsTomlPath = Path.of("src/test/resources/test-resources/custom-repo/Settings.toml");
+        Path mockBallerinaHome = Path.of("build/ballerina-home");
 
         PullCommand pullCommand = new PullCommand(printStream, false);
         new CommandLine(pullCommand).parseArgs("luheerathan/pact1:0.1.0", "--repository=repo-push-pul");
diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java
index 2c63bb2e0438..3c2046740d2a 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/PushCommandTest.java
@@ -80,9 +80,9 @@ public void setup() throws IOException {
     @Override
     public void afterMethod() throws IOException {
         super.afterMethod();
-        Path validBalProject = Path.of("build").resolve("validProjectWithTarget");
+        Path validBalProject = Path.of("build/validProjectWithTarget");
         ProjectUtils.deleteDirectory(validBalProject);
-        validBalProject = Path.of("build").resolve("tool-gayals");
+        validBalProject = Path.of("build/tool-gayals");
         ProjectUtils.deleteDirectory(validBalProject);
     }
 
@@ -108,9 +108,8 @@ public void testPushPackageCustom() throws IOException {
         String expected = "Successfully pushed src/test/resources/test-resources/custom-repo/" +
                 "luheerathan-pact1-any-0.1.0.bala to 'repo-push-pull' repository.\n";
 
-        Path mockRepo = Path.of("build").resolve("ballerina-home").resolve("repositories").resolve("repo-push-pull");
-        Path balaPath = Path.of("src", "test", "resources", "test-resources", "custom-repo",
-                "luheerathan-pact1-any-0.1.0.bala");
+        Path mockRepo = Path.of("build/ballerina-home/repositories/repo-push-pull");
+        Path balaPath = Path.of("src/test/resources/test-resources/custom-repo/luheerathan-pact1-any-0.1.0.bala");
         PushCommand pushCommand = new PushCommand(null, printStream, printStream, false, balaPath);
         String[] args = { "--repository=repo-push-pull" };
         new CommandLine(pushCommand).parseArgs(args);
@@ -137,15 +136,15 @@ public void testPushPackageNonExistingCustom() throws IOException {
         String expected = "ballerina: unsupported repository 'repo-push-pul' found. " +
                 "Only 'local' repository and repositories mentioned in the Settings.toml are supported.\n";
 
-        Path mockRepo = Path.of("build").resolve("ballerina-home").resolve("repositories").resolve("repo-push-pull");
-        Path balaPath = Path.of("src", "test", "resources", "test-resources", "custom-repo",
-                "luheerathan-pact1-any-0.1.0.bala");
+        Path mockRepo = Path.of("build/ballerina-home/repositories/repo-push-pull");
+        Path balaPath = Path.of("src/test/resources/test-resources/custom-repo/luheerathan-pact1-any-0.1.0.bala");
         PushCommand pushCommand = new PushCommand(null, printStream, printStream, false, balaPath);
         String[] args = { "--repository=repo-push-pul" };
         new CommandLine(pushCommand).parseArgs(args);
         try (MockedStatic repoUtils = Mockito.mockStatic(RepoUtils.class, Mockito.CALLS_REAL_METHODS)) {
-            repoUtils.when(RepoUtils::readSettings).thenReturn(readSettings(testResources.resolve("custom-repo")
-                    .resolve("Settings.toml"), mockRepo.toAbsolutePath().toString()));
+            repoUtils.when(RepoUtils::readSettings).thenReturn(
+                    readSettings(testResources.resolve("custom-repo/Settings.toml"),
+                            mockRepo.toAbsolutePath().toString()));
             pushCommand.execute();
         }
         String buildLog = readOutput(true);
@@ -171,8 +170,7 @@ private static Settings readSettings(Path settingsFilePath, String repoPath) {
     public void testPushWithInvalidFileExtension() throws IOException {
         Path validBalProject = this.testResources.resolve(VALID_PROJECT);
         PushCommand pushCommand = new PushCommand(validBalProject, printStream, printStream, false);
-        String invalidExtensionFilePath = this.testResources.resolve("non-bal-file")
-                .resolve("hello_world.txt").toString();
+        String invalidExtensionFilePath = this.testResources.resolve("non-bal-file/hello_world.txt").toString();
         new CommandLine(pushCommand).parseArgs(invalidExtensionFilePath);
         pushCommand.execute();
 
@@ -184,21 +182,20 @@ public void testPushWithInvalidFileExtension() throws IOException {
 
     @Test(description = "Push package with custom path")
     public void testPushWithCustomPath() throws IOException {
-        Path validBalProject = Path.of("build").resolve("validProjectWithTarget");
+        Path validBalProject = Path.of("build/validProjectWithTarget");
 
         FileUtils.copyDirectory(
                 this.testResources.resolve("validProjectWithTarget").toFile(), validBalProject.toFile());
         FileUtils.moveDirectory(
                 validBalProject.resolve("target-dir").toFile(), validBalProject.resolve("custom").toFile());
 
-        Path customTargetDirBalaPath = validBalProject.resolve("custom").resolve("bala")
-                .resolve("foo-winery-any-0.1.0.bala");
+        Path customTargetDirBalaPath = validBalProject.resolve("custom/bala/foo-winery-any-0.1.0.bala");
         PushCommand pushCommand = new PushCommand(validBalProject, printStream, printStream, false,
                 customTargetDirBalaPath);
         String[] args = { "--repository=local" };
         new CommandLine(pushCommand).parseArgs(args);
 
-        Path mockRepo = Path.of("build").resolve("ballerina-home");
+        Path mockRepo = Path.of("build/ballerina-home");
 
         try (MockedStatic repoUtils = Mockito.mockStatic(RepoUtils.class)) {
             repoUtils.when(RepoUtils::createAndGetHomeReposPath).thenReturn(mockRepo);
@@ -213,8 +210,7 @@ public void testPushWithCustomPath() throws IOException {
         Assert.assertTrue(actual.contains(expected));
 
         try {
-            ProjectFiles.validateBalaProjectPath(mockRepo.resolve("repositories").resolve("local").resolve("bala")
-                    .resolve("foo").resolve("winery").resolve("0.1.0").resolve("any"));
+            ProjectFiles.validateBalaProjectPath(mockRepo.resolve("repositories/local/bala/foo/winery/0.1.0/any"));
         } catch (ProjectException e) {
             Assert.fail(e.getMessage());
         }
@@ -222,21 +218,21 @@ public void testPushWithCustomPath() throws IOException {
 
     @Test(description = "Push a tool to local repository")
     public void testPushToolToLocal() throws IOException {
-        Path validBalProject = Path.of("build").resolve("tool-gayals");
+        Path validBalProject = Path.of("build/tool-gayals");
 
         FileUtils.copyDirectory(
                 this.testResources.resolve("tool-gayals").toFile(), validBalProject.toFile());
         FileUtils.moveDirectory(
                 validBalProject.resolve("target-dir").toFile(), validBalProject.resolve("custom").toFile());
 
-        Path customTargetDirBalaPath = validBalProject.resolve("custom").resolve("bala")
-                .resolve("gayaldassanayake-tool_gayal-java17-1.1.0.bala");
+        Path customTargetDirBalaPath =
+                validBalProject.resolve("custom/bala/gayaldassanayake-tool_gayal-java17-1.1.0.bala");
         PushCommand pushCommand = new PushCommand(validBalProject, printStream, printStream, false,
                 customTargetDirBalaPath);
         String[] args = { "--repository=local" };
         new CommandLine(pushCommand).parseArgs(args);
 
-        Path mockRepo = Path.of("build").resolve("ballerina-home");
+        Path mockRepo = Path.of("build/ballerina-home");
 
         try (MockedStatic repoUtils = Mockito.mockStatic(RepoUtils.class)) {
             repoUtils.when(RepoUtils::createAndGetHomeReposPath).thenReturn(mockRepo);
@@ -251,15 +247,13 @@ public void testPushToolToLocal() throws IOException {
         Assert.assertTrue(actual.contains(expected));
 
         try {
-            ProjectFiles.validateBalaProjectPath(mockRepo.resolve("repositories").resolve("local")
-                    .resolve("bala").resolve("gayaldassanayake").resolve("tool_gayal")
-                    .resolve("1.1.0").resolve("java17"));
+            ProjectFiles.validateBalaProjectPath(
+                    mockRepo.resolve("repositories/local/bala/gayaldassanayake/tool_gayal/1.1.0/java17"));
         } catch (ProjectException e) {
             Assert.fail(e.getMessage());
         }
 
-        Path localToolJsonPath = mockRepo.resolve("repositories").resolve("local").resolve("bala")
-                .resolve("local-tools.json");
+        Path localToolJsonPath = mockRepo.resolve("repositories/local/bala/local-tools.json");
 
         Assert.assertTrue(Files.exists(localToolJsonPath));
 
@@ -299,12 +293,10 @@ public void testPushWithoutBala() throws IOException {
         packCommand.execute();
         String buildLog = readOutput(true);
         Assert.assertEquals(buildLog.replaceAll("\r", ""), getOutput("compile-bal-project.txt"));
-        Assert.assertTrue(
-                projectPath.resolve("target").resolve("bala").resolve("foo-winery-any-0.1.0.bala").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/bala/foo-winery-any-0.1.0.bala").toFile().exists());
 
         // Delete bala
-        Assert.assertTrue(
-                projectPath.resolve("target").resolve("bala").resolve("foo-winery-any-0.1.0.bala").toFile().delete());
+        Assert.assertTrue(projectPath.resolve("target/bala/foo-winery-any-0.1.0.bala").toFile().delete());
 
         // Push
         String expected = "cannot find bala file for the package: winery. Run "
@@ -344,13 +336,13 @@ public void testPushCommandWithHelp() throws IOException {
 
     @Test
     public void testPushToCustomRepo() throws IOException {
-        Path validBalProject = Path.of("build").resolve("validProjectWithTarget");
+        Path validBalProject = Path.of("build/validProjectWithTarget");
         FileUtils.copyDirectory(
                 this.testResources.resolve("validProjectWithTarget").toFile(), validBalProject.toFile());
         FileUtils.moveDirectory(
                 validBalProject.resolve("target-dir").toFile(), validBalProject.resolve("target").toFile());
 
-        Path mockRepo = Path.of("build").resolve("ballerina-home");
+        Path mockRepo = Path.of("build/ballerina-home");
         // Test if no arguments was passed in
         String[] args = { "--repository=local" };
         PushCommand pushCommand = new PushCommand(validBalProject, printStream, printStream, false);
@@ -363,8 +355,7 @@ public void testPushToCustomRepo() throws IOException {
         }
 
         try {
-            ProjectFiles.validateBalaProjectPath(mockRepo.resolve("repositories").resolve("local").resolve("bala")
-                    .resolve("foo").resolve("winery").resolve("0.1.0").resolve("any"));
+            ProjectFiles.validateBalaProjectPath(mockRepo.resolve("repositories/local/bala/foo/winery/0.1.0/any"));
         } catch (ProjectException e) {
             Assert.fail(e.getMessage());
         }
@@ -379,8 +370,7 @@ public void testPushWithoutPackageMd() throws IOException {
         PackCommand packCommand = new PackCommand(projectPath, printStream, printStream, false, true);
         new CommandLine(packCommand).parseArgs();
         packCommand.execute();
-        Assert.assertTrue(
-                projectPath.resolve("target").resolve("bala").resolve("foo-winery-any-0.1.0.bala").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/bala/foo-winery-any-0.1.0.bala").toFile().exists());
 
         // Push
         String expected = "Package.md is missing in bala file";
@@ -404,8 +394,7 @@ public void testPushWithEmptyPackageMd() throws IOException {
         PackCommand packCommand = new PackCommand(projectPath, printStream, printStream, false, true);
         new CommandLine(packCommand).parseArgs();
         packCommand.execute();
-        Assert.assertTrue(
-                projectPath.resolve("target").resolve("bala").resolve("foo-winery-any-0.1.0.bala").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/bala/foo-winery-any-0.1.0.bala").toFile().exists());
 
         Files.delete(projectPath.resolve(ProjectConstants.PACKAGE_MD_FILE_NAME));
 
@@ -428,8 +417,7 @@ public void testPushToAnUnsupportedRepo() throws IOException {
         PackCommand packCommand = new PackCommand(projectPath, printStream, printStream, false, true);
         new CommandLine(packCommand).parseArgs();
         packCommand.execute();
-        Assert.assertTrue(
-                projectPath.resolve("target").resolve("bala").resolve("foo-winery-any-0.1.0.bala").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/bala/foo-winery-any-0.1.0.bala").toFile().exists());
 
         String[] args = { "--repository=stdlib.local" };
         PushCommand pushCommand = new PushCommand(projectPath, printStream, printStream, false);
diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java
index bbcabb350e33..80f7efef4e41 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunBuildToolsTaskTest.java
@@ -245,7 +245,7 @@ public Object[][] buildToolOfflineProvider() {
     }
 
     private void addBuildJsonToProjects(String projectName, long time) {
-        Path buildJsonPath = buildToolResources.resolve(projectName).resolve("target").resolve("build");
+        Path buildJsonPath = buildToolResources.resolve(projectName).resolve("target/build");
         String buildJsonContent = "{\n" +
                 "  \"last_build_time\": 1710907945705,\n" +
                 "  \"last_update_time\": " + time + ",\n" +
diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java
index 0705df93011d..b7b7e7ff667c 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/RunCommandTest.java
@@ -75,10 +75,10 @@ public void setup() throws IOException {
 
     @Test(description = "Run a valid ballerina file", dataProvider = "optimizeDependencyCompilation")
     public void testRunValidBalFile(Boolean optimizeDependencyCompilation) throws IOException {
-        Path validBalFilePath = this.testResources.resolve("valid-run-bal-file").resolve("file_create.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-run-bal-file/file_create.bal");
 
         System.setProperty("user.dir", this.testResources.resolve("valid-run-bal-file").toString());
-        Path tempFile = this.testResources.resolve("valid-run-bal-file").resolve("temp.txt");
+        Path tempFile = this.testResources.resolve("valid-run-bal-file/temp.txt");
         // set valid source root
         RunCommand runCommand = new RunCommand(validBalFilePath, printStream, false, optimizeDependencyCompilation);
         // name of the file as argument
@@ -99,7 +99,7 @@ public void testRunValidBalFile(Boolean optimizeDependencyCompilation) throws IO
     @Test(description = "Run non existing bal file")
     public void testRunNonExistingBalFile() throws IOException {
         // valid source root path
-        Path validBalFilePath = this.testResources.resolve("valid-run-bal-file").resolve("xyz.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-run-bal-file/xyz.bal");
         RunCommand runCommand = new RunCommand(validBalFilePath, printStream, false);
         new CommandLine(runCommand).parseArgs(validBalFilePath.toString());
         runCommand.execute();
@@ -111,7 +111,7 @@ public void testRunNonExistingBalFile() throws IOException {
     @Test(description = "Run bal file containing syntax error")
     public void testRunBalFileWithSyntaxError() {
         // valid source root path
-        Path balFilePath = this.testResources.resolve("bal-file-with-syntax-error").resolve("hello_world.bal");
+        Path balFilePath = this.testResources.resolve("bal-file-with-syntax-error/hello_world.bal");
         RunCommand runCommand = new RunCommand(balFilePath, printStream, false);
         new CommandLine(runCommand).parseArgs(balFilePath.toString());
         try {
@@ -240,7 +240,7 @@ public void testRunJarFile() {
         // Run build command to generate jar file
         BuildCommand buildCommand = new BuildCommand(projectPath, printStream, printStream, false);
         buildCommand.execute();
-        Assert.assertTrue(projectPath.resolve("target").resolve("bin").resolve("foo.jar").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/bin/foo.jar").toFile().exists());
 
         // Try to run the har file
         Path tempFile = projectPath.resolve("foo.jar");
@@ -283,14 +283,10 @@ public void testRunWithCustomTarget() {
         RunCommand runCommand = new RunCommand(projectPath, printStream, false, customTargetDir);
         runCommand.execute();
         Assert.assertTrue(Files.exists(customTargetDir.resolve("cache")));
-        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache").resolve("wso2").resolve("foo").resolve("0.1" +
-                ".0")));
-        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache").resolve("wso2").resolve("foo").resolve("0.1" +
-                ".0")));
-        if (!(Files.exists(customTargetDir.resolve("cache").resolve("wso2").resolve("foo").resolve("0.1" +
-                ".0").resolve("java17").resolve("wso2-foo-0.1.0.jar")) || Files.exists(customTargetDir.resolve(
-                        "cache").resolve("wso2").resolve("foo").resolve("0.1" +
-                ".0").resolve("any").resolve("wso2-foo-0.1.0.jar")))) {
+        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache/wso2/foo/0.1.0")));
+        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache/wso2/foo/0.1.0")));
+        if (!(Files.exists(customTargetDir.resolve("cache/wso2/foo/0.1.0/java17/wso2-foo-0.1.0.jar")) ||
+                Files.exists(customTargetDir.resolve("cache/wso2/foo/0.1.0/any/wso2-foo-0.1.0.jar")))) {
             Assert.fail("Run command with custom target dir failed");
         }
     }
@@ -301,7 +297,7 @@ public void testRunBalProjectWithAllCompilerPlugins(Boolean optimizeDependencyCo
         Path logFile = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt").toAbsolutePath();
         Files.createDirectories(logFile.getParent());
         Files.writeString(logFile, "");
-        Path compilerPluginPath = Path.of("./src/test/resources/test-resources").resolve("compiler-plugins");
+        Path compilerPluginPath = Path.of("./src/test/resources/test-resources/compiler-plugins");
         BCompileUtil.compileAndCacheBala(compilerPluginPath.resolve("log_creator_pkg_provided_code_analyzer_im"),
                 testDistCacheDirectory, projectEnvironmentBuilder);
         BCompileUtil.compileAndCacheBala(compilerPluginPath.resolve("log_creator_pkg_provided_code_generator_im"),
@@ -309,7 +305,7 @@ public void testRunBalProjectWithAllCompilerPlugins(Boolean optimizeDependencyCo
         BCompileUtil.compileAndCacheBala(compilerPluginPath.resolve("log_creator_pkg_provided_code_modifier_im"),
                 testDistCacheDirectory, projectEnvironmentBuilder);
 
-        Path projectPath = this.testResources.resolve("compiler-plugins").resolve("log_creator_combined_plugin");
+        Path projectPath = this.testResources.resolve("compiler-plugins/log_creator_combined_plugin");
         System.setProperty("user.dir", projectPath.toString());
         RunCommand runCommand = new RunCommand(projectPath, printStream, false, optimizeDependencyCompilation);
         new CommandLine(runCommand).parseArgs();
@@ -371,9 +367,8 @@ public void testRunBalProjectWithDumpGraphFlag() throws IOException {
         String buildLog = readOutput(true).replaceAll("\r", "").strip();
 
         Assert.assertEquals(buildLog, getOutput("run-project-with-dump-graph.txt"));
-        Assert.assertTrue(projectPath.resolve("target").resolve("cache").resolve("foo")
-                .resolve("package_a").resolve("0.1.0").resolve("java17")
-                .resolve("foo-package_a-0.1.0.jar").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/cache/foo/package_a/0.1.0/java17/foo-package_a-0.1.0.jar")
+                .toFile().exists());
 
         ProjectUtils.deleteDirectory(projectPath.resolve("target"));
     }
@@ -395,9 +390,8 @@ public void testRunBalProjectWithDumpRawGraphsFlag() throws IOException {
         String buildLog = readOutput(true).replaceAll("\r", "").strip();
 
         Assert.assertEquals(buildLog, getOutput("run-project-with-dump-raw-graphs.txt"));
-        Assert.assertTrue(projectPath.resolve("target").resolve("cache").resolve("foo")
-                .resolve("package_a").resolve("0.1.0").resolve("java17")
-                .resolve("foo-package_a-0.1.0.jar").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/cache/foo/package_a/0.1.0/java17/foo-package_a-0.1.0.jar")
+                .toFile().exists());
 
         ProjectUtils.deleteDirectory(projectPath.resolve("target"));
     }
@@ -420,8 +414,9 @@ public void testRunEmptyPackage() throws IOException {
 
     @Test(description = "Run an empty package with code generator build tools")
     public void testRunEmptyProjectWithBuildTools() throws IOException {
-        BCompileUtil.compileAndCacheBala(testResources.resolve("buildToolResources").resolve("tools")
-                .resolve("ballerina-generate-file").toString(), testDistCacheDirectory, projectEnvironmentBuilder);
+        BCompileUtil.compileAndCacheBala(
+                testResources.resolve("buildToolResources/tools/ballerina-generate-file").toString(),
+                testDistCacheDirectory, projectEnvironmentBuilder);
         Path projectPath = this.testResources.resolve("emptyProjectWithBuildTool");
         replaceDependenciesTomlContent(projectPath, "**INSERT_DISTRIBUTION_VERSION_HERE**",
                 RepoUtils.getBallerinaShortVersion());
diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java
index c85daf5bb15d..d8234d9fecda 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java
@@ -88,7 +88,7 @@ public void setup() throws IOException {
             this.testResources = super.tmpDir.resolve("test-cmd-test-resources");
             Path testBuildDirectory = Path.of("build").toAbsolutePath();
             this.testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY);
-            Path customUserHome = Path.of("build", "user-home");
+            Path customUserHome = Path.of("build/user-home");
             Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build();
             projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment);
             URI testResourcesURI = Objects.requireNonNull(
@@ -102,7 +102,7 @@ public void setup() throws IOException {
 
     @Test(description = "Test a valid ballerina file", dataProvider = "optimizeDependencyCompilation")
     public void testTestBalFile(Boolean optimizeDependencyCompilation) {
-        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file").resolve("sample_tests.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file/sample_tests.bal");
 
         System.setProperty(ProjectConstants.USER_DIR, this.testResources.resolve("valid-test-bal-file").toString());
         // set valid source root
@@ -114,7 +114,7 @@ public void testTestBalFile(Boolean optimizeDependencyCompilation) {
 
     @Test(description = "Test a valid ballerina file with periods in the file name")
     public void testTestBalFileWithPeriods() {
-        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file").resolve("sample.tests.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file/sample.tests.bal");
 
         System.setProperty(ProjectConstants.USER_DIR, this.testResources.resolve("valid-test-bal-file").toString());
         // set valid source root
@@ -126,7 +126,7 @@ public void testTestBalFileWithPeriods() {
 
     @Test(description = "Test non .bal file")
     public void testNonBalFileTest() throws IOException {
-        Path nonBalFilePath = this.testResources.resolve("non-bal-file").resolve("hello_world.txt");
+        Path nonBalFilePath = this.testResources.resolve("non-bal-file/hello_world.txt");
         TestCommand testCommand = new TestCommand(nonBalFilePath, printStream, printStream, false);
         new CommandLine(testCommand).parseArgs(nonBalFilePath.toString());
         testCommand.execute();
@@ -139,7 +139,7 @@ public void testNonBalFileTest() throws IOException {
     @Test(description = "Test non existing bal file")
     public void testNonExistingBalFile() throws IOException {
         // valid source root path
-        Path validBalFilePath = this.testResources.resolve("valid-non-bal-file").resolve("xyz.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-non-bal-file/xyz.bal");
         TestCommand testCommand = new TestCommand(validBalFilePath, printStream, printStream, false);
         new CommandLine(testCommand).parseArgs(validBalFilePath.toString());
         testCommand.execute();
@@ -152,7 +152,7 @@ public void testNonExistingBalFile() throws IOException {
     @Test(description = "Test bal file containing syntax error")
     public void testBalFileWithSyntaxError() {
         // valid source root path
-        Path balFilePath = this.testResources.resolve("bal-file-with-syntax-error").resolve("sample_tests.bal");
+        Path balFilePath = this.testResources.resolve("bal-file-with-syntax-error/sample_tests.bal");
         TestCommand testCommand = new TestCommand(balFilePath, printStream, printStream, false);
         new CommandLine(testCommand).parseArgs(balFilePath.toString());
         try {
@@ -228,23 +228,20 @@ public void testTestCommandPreservingBinJarInTargetDir() throws IOException {
         BuildCommand buildCommand = new BuildCommand(projectPath, printStream, printStream, false , false);
         new CommandLine(buildCommand).parseArgs();
         buildCommand.execute();
-        Assert.assertTrue(projectPath.resolve("target").resolve("bin").resolve("winery.jar").toFile().exists());
-        String md5BinJar = DigestUtils.md5Hex(
-                Files.newInputStream(projectPath.resolve("target").resolve("bin").resolve("winery.jar")));
+        Assert.assertTrue(projectPath.resolve("target/bin/winery.jar").toFile().exists());
+        String md5BinJar = DigestUtils.md5Hex(Files.newInputStream(projectPath.resolve("target/bin/winery.jar")));
 
         // Run tests
         TestCommand testCommand = new TestCommand(projectPath, printStream, printStream, false);
         new CommandLine(testCommand).parseArgs();
         testCommand.execute();
-        Assert.assertTrue(projectPath.resolve("target").resolve("bin").resolve("winery.jar").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/bin/winery.jar").toFile().exists());
         Assert.assertEquals(md5BinJar, DigestUtils.md5Hex(
-                Files.newInputStream(projectPath.resolve("target").resolve("bin").resolve("winery.jar"))));
-        Assert.assertTrue(projectPath.resolve("target").resolve("cache").resolve("foo")
-                .resolve("winery").resolve("0.1.0").resolve("java17")
-                .resolve("foo-winery-0.1.0.jar").toFile().exists());
-        Assert.assertTrue(projectPath.resolve("target").resolve("cache").resolve("foo")
-                .resolve("winery").resolve("0.1.0").resolve("java17")
-                .resolve("foo-winery-0.1.0-testable.jar").toFile().exists());
+                Files.newInputStream(projectPath.resolve("target/bin/winery.jar"))));
+        Assert.assertTrue(projectPath.resolve("target/cache/foo/winery/0.1.0/java17/foo-winery-0.1.0.jar")
+                .toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/cache/foo/winery/0.1.0/java17/foo-winery-0.1.0-testable.jar")
+                .toFile().exists());
     }
 
     @Test(description = "Test a ballerina project with an invalid argument for --coverage-format",
@@ -276,14 +273,12 @@ public void testCustomTargetDirWithTestCmd() {
 
         Assert.assertFalse(Files.exists(customTargetDir.resolve("bin")));
         Assert.assertTrue(Files.exists(customTargetDir.resolve("cache")));
-        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache").resolve("tests_cache").resolve("test_suit" +
-                ".json")));
+        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache/tests_cache/test_suit.json")));
         Assert.assertTrue(Files.exists(customTargetDir.resolve("build")));
         Assert.assertTrue(Files.exists(customTargetDir.resolve("report")));
-        Assert.assertTrue(Files.exists(customTargetDir.resolve("report").resolve("test_results.json")));
+        Assert.assertTrue(Files.exists(customTargetDir.resolve("report/test_results.json")));
         Assert.assertTrue(Files.exists(customTargetDir.resolve("rerun_test.json")));
-        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache").resolve("tests_cache").resolve("test_suit" +
-                ".json")));
+        Assert.assertTrue(Files.exists(customTargetDir.resolve("cache/tests_cache/test_suit.json")));
     }
 
     @Test(description = "Test a ballerina project with --test-report", dataProvider = "optimizeDependencyCompilation")
@@ -295,20 +290,20 @@ public void testTestWithReport(Boolean optimizeDependencyCompilation) {
         try (MockedStatic testUtilsMockedStatic = Mockito.mockStatic(
                 TestUtils.class, Mockito.CALLS_REAL_METHODS)) {
             testUtilsMockedStatic.when(TestUtils::getReportToolsPath)
-                    .thenReturn(projectPath.resolve("resources").resolve("coverage").resolve("report.zip"));
+                    .thenReturn(projectPath.resolve("resources/coverage/report.zip"));
             testCommand.execute();
         }
-        Path reportDir = projectPath.resolve("target").resolve("report");
+        Path reportDir = projectPath.resolve("target/report");
 
         Assert.assertTrue(Files.exists(reportDir));
         Assert.assertTrue(Files.exists(reportDir.resolve("favicon.ico")));
         Assert.assertTrue(Files.exists(reportDir.resolve("index.html")));
         Assert.assertTrue(Files.exists(reportDir.resolve("test_results.json")));
         Assert.assertTrue(Files.exists(reportDir.resolve("manifest.json")));
-        Assert.assertTrue(Files.exists(reportDir.resolve("static").resolve("css").resolve("2.d5162072.chunk.css")));
-        Assert.assertTrue(Files.exists(reportDir.resolve("static").resolve("css").resolve("main.15691da7.chunk.css")));
-        Assert.assertTrue(Files.exists(reportDir.resolve("static").resolve("js").resolve("2.bc541f30.chunk.js")));
-        Assert.assertTrue(Files.exists(reportDir.resolve("static").resolve("js").resolve("main.ea323a3b.chunk.js")));
+        Assert.assertTrue(Files.exists(reportDir.resolve("static/css/2.d5162072.chunk.css")));
+        Assert.assertTrue(Files.exists(reportDir.resolve("static/css/main.15691da7.chunk.css")));
+        Assert.assertTrue(Files.exists(reportDir.resolve("static/js/2.bc541f30.chunk.js")));
+        Assert.assertTrue(Files.exists(reportDir.resolve("static/js/main.ea323a3b.chunk.js")));
     }
 
     @Test(description = "tests bal test command with sticky flag")
@@ -371,9 +366,8 @@ public void testTestBalProjectWithDumpGraphFlag() throws IOException {
         String buildLog = readOutput(true).replace("\r", "").strip();
 
         Assert.assertEquals(buildLog, getOutput("test-project-with-dump-graph.txt"));
-        Assert.assertTrue(projectPath.resolve("target").resolve("cache").resolve("foo")
-                .resolve("package_a").resolve("0.1.0").resolve("java17")
-                .resolve("foo-package_a-0.1.0.jar").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/cache/foo/package_a/0.1.0/java17/foo-package_a-0.1.0.jar")
+                .toFile().exists());
 
         ProjectUtils.deleteDirectory(projectPath.resolve("target"));
     }
@@ -398,9 +392,8 @@ public void testTestBalProjectWithDumpRawGraphsFlag() throws IOException {
         String buildLog = readOutput(true).replace("\r", "").replace("\\", "/").strip();
 
         Assert.assertEquals(buildLog, getOutput("test-project-with-dump-raw-graphs.txt"));
-        Assert.assertTrue(projectPath.resolve("target").resolve("cache").resolve("foo")
-                .resolve("package_a").resolve("0.1.0").resolve("java17")
-                .resolve("foo-package_a-0.1.0.jar").toFile().exists());
+        Assert.assertTrue(projectPath.resolve("target/cache/foo/package_a/0.1.0/java17/foo-package_a-0.1.0.jar")
+                .toFile().exists());
 
         ProjectUtils.deleteDirectory(projectPath.resolve("target"));
     }
@@ -423,8 +416,9 @@ public void testTestEmptyPackage() throws IOException {
 
     @Test(description = "Test an empty project with build tools")
     public void testTestEmptyProjectWithBuildTools() throws IOException {
-        BCompileUtil.compileAndCacheBala(testResources.resolve("buildToolResources").resolve("tools")
-                .resolve("ballerina-generate-file").toString(), testDistCacheDirectory, projectEnvironmentBuilder);
+        BCompileUtil.compileAndCacheBala(
+                testResources.resolve("buildToolResources/tools/ballerina-generate-file").toString(),
+                testDistCacheDirectory, projectEnvironmentBuilder);
         Path projectPath = this.testResources.resolve("emptyProjectWithBuildTool");
         replaceDependenciesTomlContent(projectPath, "**INSERT_DISTRIBUTION_VERSION_HERE**",
                 RepoUtils.getBallerinaShortVersion());
@@ -452,7 +446,7 @@ public void testTestableFatJarEmission() {
         new CommandLine(testCommand).parseArgs("--cloud=docker");
         testCommand.execute();
         Path targetDir = projectPath.resolve("target");
-        Path testableJar = targetDir.resolve("bin").resolve("tests").resolve("winery-testable.jar");
+        Path testableJar = targetDir.resolve("bin/tests/winery-testable.jar");
         Assert.assertTrue(Files.exists(testableJar));
         Path mainArgsFile = testableJar.getParent().resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
         Assert.assertTrue(Files.exists(mainArgsFile));
@@ -465,7 +459,7 @@ public void testTestableFatJarExecution() throws IOException {
             throw new SkipException("Currently failing on Windows");
         }
         Path projectPath = this.testResources.resolve("validProjectWithTests");
-        Path testableJar = projectPath.resolve("target").resolve("bin").resolve("tests").resolve("winery-testable.jar");
+        Path testableJar = projectPath.resolve("target/bin/tests/winery-testable.jar");
         Path mainArgsFile = testableJar.getParent().resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
 
         // Read the main args from the file (line separated)
@@ -507,7 +501,7 @@ public void testEmissionOfTestableFatJarForProjectWithMocking() throws IOExcepti
         new CommandLine(testCommand).parseArgs("--cloud=docker");
         testCommand.execute();
         Path targetDir = projectPath.resolve("target");
-        Path testableJar = targetDir.resolve("bin").resolve("tests").resolve("projectWithMocks-testable.jar");
+        Path testableJar = targetDir.resolve("bin/tests/projectWithMocks-testable.jar");
         Assert.assertTrue(Files.exists(testableJar));
         Path mainArgsFile = testableJar.getParent().resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
         Assert.assertTrue(Files.exists(mainArgsFile));
@@ -525,8 +519,7 @@ public void testExecutionOfTestableFatJarForProjectWithMocking() throws IOExcept
             throw new SkipException("Currently failing on Windows");
         }
         Path projectPath = this.testResources.resolve("projectWithMocks");
-        Path testableJar = projectPath.resolve("target").resolve("bin").resolve("tests")
-                .resolve("projectWithMocks-testable.jar");
+        Path testableJar = projectPath.resolve("target/bin/tests/projectWithMocks-testable.jar");
         Path mainArgsFile = testableJar.getParent().resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
 
         // Read the main args from the file (line separated)
@@ -570,7 +563,7 @@ public void testEmissionOfSingleFatJarForCloudAndGraalVM() throws IOException {
         new CommandLine(testCommand).parseArgs("--cloud=docker", "--graalvm");
         testCommand.execute();
         Path targetDir = projectPath.resolve("target");
-        Path testableJar = targetDir.resolve("bin").resolve("tests").resolve("winery-testable.jar");
+        Path testableJar = targetDir.resolve("bin/tests/winery-testable.jar");
         Assert.assertTrue(Files.exists(testableJar));
         Path mainArgsFile = testableJar.getParent().resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
         Assert.assertTrue(Files.exists(mainArgsFile));
@@ -594,7 +587,7 @@ public void testEmissionOfMultipleFatJarsForProjectWithMockingForCloudAndGraalVM
         new CommandLine(testCommand).parseArgs("--cloud=docker", "--graalvm");
         testCommand.execute();
         Path targetDir = projectPath.resolve("target");
-        Path mainArgsFile = targetDir.resolve("bin").resolve("tests").resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
+        Path mainArgsFile = targetDir.resolve("bin/tests").resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
         Assert.assertTrue(Files.exists(mainArgsFile));
         //should exist only one testable jar
         try (Stream files = Files.list(mainArgsFile.getParent())) {
@@ -616,8 +609,7 @@ public void testExecutionOfMultipleTestableFatJarsForProjectWithTestsAndMocks()
             throw new SkipException("Currently failing on Windows");
         }
         Path projectPath = this.testResources.resolve("projectWithMocks");
-        Path mainArgsFile = projectPath.resolve("target").resolve("bin").resolve("tests")
-                .resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
+        Path mainArgsFile = projectPath.resolve("target/bin/tests").resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
 
         // Read the main args from the file (line separated)
         List mainArgs = Files.readAllLines(mainArgsFile);
@@ -669,7 +661,7 @@ public void testEmissionOfTestableFatJarForSingleTestBalFile() {
         new CommandLine(testCommand).parseArgs("--cloud=docker", "main_tests.bal");
         testCommand.execute();
         Path targetDir = projectPath.resolve("target");
-        Path testableJar = targetDir.resolve("bin").resolve("tests").resolve("winery-testable.jar");
+        Path testableJar = targetDir.resolve("bin/tests/winery-testable.jar");
         Assert.assertFalse(Files.exists(testableJar));  //should not exist
         Path mainArgsFile = testableJar.getParent().resolve(TEST_RUNTIME_MAIN_ARGS_FILE);
         Assert.assertFalse(Files.exists(mainArgsFile)); //should not exist
diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java
index 239ace50224c..af8bb297e067 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestNativeImageCommandTest.java
@@ -42,7 +42,7 @@ public void setup() throws IOException {
             this.testResources = super.tmpDir.resolve("test-cmd-test-resources");
             Path testBuildDirectory = Path.of("build").toAbsolutePath();
             this.testDistCacheDirectory = testBuildDirectory.resolve(DIST_CACHE_DIRECTORY);
-            Path customUserHome = Path.of("build", "user-home");
+            Path customUserHome = Path.of("build/user-home");
             Environment environment = EnvironmentBuilder.getBuilder().setUserHome(customUserHome).build();
             projectEnvironmentBuilder = ProjectEnvironmentBuilder.getBuilder(environment);
             URI testResourcesURI = Objects.requireNonNull(
@@ -108,7 +108,7 @@ public void testNativeFunctionMockTests() throws IOException {
     //TODO: Change the output once the resource generation plugin is disabled
     @Test(description = "Test a valid ballerina file")
     public void testTestBalFile() {
-        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file").resolve("sample_tests.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file/sample_tests.bal");
         System.setProperty(ProjectConstants.USER_DIR, this.testResources.resolve("valid-test-bal-file").toString());
         TestCommand testCommand = new TestCommand(validBalFilePath, printStream, printStream, false, true, "");
         new CommandLine(testCommand).parseArgs(validBalFilePath.toString());
@@ -123,7 +123,7 @@ public void testTestBalFile() {
     //TODO: Change the output once the resource generation plugin is disabled
     @Test(description = "Test a valid ballerina file with additional args")
     public void testTestBalFileWithAdditionalArgs() {
-        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file").resolve("sample_tests.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file/sample_tests.bal");
         System.setProperty(ProjectConstants.USER_DIR, this.testResources.resolve("valid-test-bal-file").toString());
         TestCommand testCommand = new TestCommand(validBalFilePath, printStream, printStream,
                 false, true, "-H:Name=foo");
@@ -139,7 +139,7 @@ public void testTestBalFileWithAdditionalArgs() {
     //TODO: Change the output once the resource generation plugin is disabled
     @Test(description = "Test a valid ballerina file with periods in the file name")
     public void testTestBalFileWithPeriods() {
-        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file").resolve("sample.tests.bal");
+        Path validBalFilePath = this.testResources.resolve("valid-test-bal-file/sample.tests.bal");
 
         System.setProperty(ProjectConstants.USER_DIR, this.testResources.resolve("valid-test-bal-file").toString());
         TestCommand testCommand = new TestCommand(validBalFilePath, printStream, printStream,
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java
index b08a93609366..3398aed95554 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/BallerinaTomlTests.java
@@ -45,7 +45,7 @@
  */
 public class BallerinaTomlTests {
 
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources");
     private static final Path BAL_TOML_REPO = RESOURCE_DIRECTORY.resolve("ballerina-toml");
 
     @Test
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java
index 787517edfaf1..790ce58e859a 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/CyclicDependenciesTest.java
@@ -34,7 +34,7 @@
  * Contains test cases to validate the detection of cyclic dependencies in {@code DependencyGraph}.
  */
 public class CyclicDependenciesTest {
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources", "cyclic-graphs");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/cyclic-graphs");
 
     private static final ResolutionEngine.DependencyNode PACKAGE_01 = createNode("nipyf", "js", "1.0.2");
     private static final ResolutionEngine.DependencyNode PACKAGE_02 = createNode("nipyf", "toml", "1.0.0");
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java
index 8c49aab61a92..4289fde205ba 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DependenciesTomlTests.java
@@ -38,7 +38,7 @@
  */
 public class DependenciesTomlTests {
 
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources");
     private static final Path DEPENDENCIES_TOML_REPO = RESOURCE_DIRECTORY.resolve("dependencies-toml");
     static final PrintStream OUT = System.out;
 
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java
index afcc7a417412..077221fbbcf0 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/DotGraphsTests.java
@@ -37,8 +37,7 @@
  * @since 2.0.0
  */
 public class DotGraphsTests {
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources",
-            "dot-graphs");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/dot-graphs");
 
     @Test(enabled = false)
     public void test() {
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java
index bbc7d22a5570..6ce686ae8c3a 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryGetPackagesTests.java
@@ -38,7 +38,7 @@
  * @since 2201.2.1
  */
 public class FileSystemRepositoryGetPackagesTests {
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources", "repository-resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources/repository-resources");
     private Map> nonEmptyRepoPackages;
     private Map> emptyRepoPackages;
     private Environment environment;
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java
index 079835e679b5..818f3ba73934 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryTests.java
@@ -50,7 +50,7 @@ protected List getIncompatibleVer(List versions, PackageOrg org, Pac
         }
     }
 
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources");
     private static final Path TEST_REPO = RESOURCE_DIRECTORY.resolve("test-repo");
     private FileSystemRepository fileSystemRepository;
 
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java
index caf496f0595a..080ea9839c9f 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/FileSystemRepositoryValidationTests.java
@@ -17,7 +17,7 @@
  * @since 2.0.0
  */
 public class FileSystemRepositoryValidationTests {
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources");
     private static final Path TEST_REPO = RESOURCE_DIRECTORY.resolve("test-repo");
     private FileSystemRepository fileSystemRepository;
 
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java
index 001bf9a11d89..6da850e1ada0 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/MavenPackageRepositoryTests.java
@@ -56,11 +56,11 @@ public MockMavenPackageRepository(Environment environment, Path cacheDirectory,
 
         @Override
         public boolean getPackageFromRemoteRepo(String org, String name, String version) {
-            Path sourceFolderPath = RESOURCE_DIRECTORY.resolve("custom-repo-resources")
-                    .resolve("remote-custom-repo").resolve(name);
-            Path destinationFolderPath = RESOURCE_DIRECTORY.resolve("custom-repo-resources")
-                    .resolve("local-custom-repo")
-                    .resolve("bala").resolve(org).resolve(name);
+            Path sourceFolderPath =
+                    RESOURCE_DIRECTORY.resolve("custom-repo-resources/remote-custom-repo").resolve(name);
+            Path destinationFolderPath =
+                    RESOURCE_DIRECTORY.resolve("custom-repo-resources/local-custom-repo/bala").resolve(org)
+                            .resolve(name);
 
             try {
                 Files.walkFileTree(sourceFolderPath, new SimpleFileVisitor() {
@@ -86,9 +86,8 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
         }
     }
 
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
-    private static final Path TEST_REPO = RESOURCE_DIRECTORY.resolve("custom-repo-resources")
-            .resolve("local-custom-repo");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources");
+    private static final Path TEST_REPO = RESOURCE_DIRECTORY.resolve("custom-repo-resources/local-custom-repo");
     private MavenPackageRepository customPackageRepository;
 
     @BeforeSuite
@@ -237,9 +236,8 @@ public void testGetNonExistingPackageVersions2() throws IOException {
 
 
     private static void deleteRemotePackage() throws IOException {
-        Path destinationFolderPath = RESOURCE_DIRECTORY.resolve("custom-repo-resources").
-                resolve("local-custom-repo")
-                .resolve("bala").resolve("luheerathan").resolve("pact");
+        Path destinationFolderPath =
+                RESOURCE_DIRECTORY.resolve("custom-repo-resources/local-custom-repo/bala/luheerathan/pact");
         if (Files.exists(destinationFolderPath)) {
             try (Stream paths = Files.walk(destinationFolderPath)) {
                 paths.sorted(Comparator.reverseOrder())
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java
index 70d406b0c9d9..43b1c09c8dde 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectPathsTest.java
@@ -51,13 +51,11 @@ public void setUp() throws IOException {
         Files.createFile(buildProjectPath.resolve(ProjectConstants.TEST_DIR_NAME).resolve("main_test.bal"));
 
         // Create another module
-        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1").
-                resolve(ProjectConstants.TEST_DIR_NAME));
-        Files.createFile(buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1").
-                resolve("main.bal"));
-        Files.createFile(
-                buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1").
-                        resolve(ProjectConstants.TEST_DIR_NAME).resolve("main_test.bal"));
+        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1")
+                .resolve(ProjectConstants.TEST_DIR_NAME));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1/main.bal"));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1")
+                        .resolve(ProjectConstants.TEST_DIR_NAME).resolve("main_test.bal"));
 
         // Create standalone files outside project directory
         Files.createFile(tempDir.resolve("test.bal")); // path - /tmp/ballerina-test-223233/test.bal
@@ -65,55 +63,46 @@ public void setUp() throws IOException {
 
         // Create standalone file inside project directory
         Files.createDirectory(buildProjectPath.resolve("test-utils"));
-        Files.createFile(buildProjectPath.resolve("test-utils")
-                .resolve("utils.bal")); // path - /tmp/testProj/test-utils/utils.bal
+        Files.createFile(buildProjectPath.resolve("test-utils/utils.bal")); // path - /tmp/testProj/test-utils/utils.bal
 
         // Create generated files
         // Generated file for default module
         Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT));
         Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).
                 resolve(ProjectConstants.TEST_DIR_NAME));
-        Files.createFile(
-                buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("gen.bal"));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("gen.bal"));
         // Generate test file for default module
-        Files.createFile(
-                buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).
-                        resolve(ProjectConstants.TEST_DIR_NAME).resolve("gen_test.bal"));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT)
+                .resolve(ProjectConstants.TEST_DIR_NAME).resolve("gen_test.bal"));
 
         // Generated file for module 01
-        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).
-                resolve("module1"));
-        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1").
-                resolve(ProjectConstants.TEST_DIR_NAME));
-        Files.createFile(
-                buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1").
-                        resolve("gen_mod1.bal"));
+        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1"));
+        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1")
+                .resolve(ProjectConstants.TEST_DIR_NAME));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1")
+                .resolve("gen_mod1.bal"));
         // Generate test file for module 01
-        Files.createFile(
-                buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1").
-                        resolve(ProjectConstants.TEST_DIR_NAME).resolve("gen_test_mod1.bal"));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1")
+                .resolve(ProjectConstants.TEST_DIR_NAME).resolve("gen_test_mod1.bal"));
 
         // Generated file for module 02 (A new generated module)
         Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module2"));
-        Files.createFile(
-                buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module2").
-                        resolve("gen_mod2.bal"));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module2")
+                .resolve("gen_mod2.bal"));
 
         // Generated test file for module 03 (A new generated module)
         Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module3"));
-        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module3").
-                resolve(ProjectConstants.TEST_DIR_NAME));
-        Files.createFile(
-                buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module3").
-                        resolve(ProjectConstants.TEST_DIR_NAME).resolve("gen_test_mod3.bal"));
+        Files.createDirectories(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module3")
+                .resolve(ProjectConstants.TEST_DIR_NAME));
+        Files.createFile(buildProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module3")
+                .resolve(ProjectConstants.TEST_DIR_NAME).resolve("gen_test_mod3.bal"));
 
         // Create a bala project
         balaProjectPath = tempDir.resolve("testBalaProj");
         Files.createDirectories(balaProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("mod1"));
         Files.createFile(balaProjectPath.resolve(ProjectConstants.PACKAGE_JSON));
         Files.createFile(balaProjectPath.resolve(ProjectConstants.BALA_JSON));
-        Files.createFile(balaProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("mod1").
-                resolve("mod1.bal"));
+        Files.createFile(balaProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("mod1/mod1.bal"));
     }
 
     @Test
@@ -126,8 +115,7 @@ public void testPackageRoot() {
         Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath
                 .resolve(ProjectConstants.TEST_DIR_NAME).resolve("main_test.bal")), buildProjectPath);
         Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath
-                .resolve(ProjectConstants.MODULES_ROOT).resolve("module1")
-                .resolve("main.bal")), buildProjectPath);
+                .resolve(ProjectConstants.MODULES_ROOT).resolve("module1/main.bal")), buildProjectPath);
         Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath
                 .resolve(ProjectConstants.MODULES_ROOT).resolve("module1")
                 .resolve(ProjectConstants.TEST_DIR_NAME).resolve("main_test.bal")), buildProjectPath);
@@ -135,10 +123,9 @@ public void testPackageRoot() {
         // test package root of generated files
         Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath
                 .resolve(ProjectConstants.GENERATED_MODULES_ROOT)
-                .resolve("module1").resolve("gen_mod1.bal")), buildProjectPath);
+                .resolve("module1/gen_mod1.bal")), buildProjectPath);
         Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath
-                .resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module2")
-                .resolve("gen_mod2.bal")), buildProjectPath);
+                .resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module2/gen_mod2.bal")), buildProjectPath);
         Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath
                         .resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("gen.bal")), buildProjectPath);
 
@@ -147,7 +134,7 @@ public void testPackageRoot() {
                 .resolve("main_test.bal")), buildProjectPath);
         // test package root of bala project
         Assert.assertEquals(ProjectPaths.packageRoot(balaProjectPath
-                .resolve(ProjectConstants.MODULES_ROOT).resolve("mod1").resolve("mod1.bal")), balaProjectPath);
+                .resolve(ProjectConstants.MODULES_ROOT).resolve("mod1/mod1.bal")), balaProjectPath);
 
         // test package root of generated test files
         Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath
@@ -202,7 +189,7 @@ public void testPackageRootNegative() {
 
     @Test(expectedExceptions = ProjectException.class)
     public void testPackageRootNegative2() {
-        Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath.resolve("test-utils").resolve("utils.bal")),
+        Assert.assertEquals(ProjectPaths.packageRoot(buildProjectPath.resolve("test-utils/utils.bal")),
                 buildProjectPath);
     }
 
@@ -243,18 +230,17 @@ public void testIsBallerinaStandaloneFile() {
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(buildProjectPath.resolve("main.bal")));
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(buildProjectPath.resolve("Ballerina.toml")));
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(
-                buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1").resolve("main.bal")));
+                buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1/main.bal")));
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(
                 buildProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("module1")
                                 .resolve(ProjectConstants.TEST_DIR_NAME).resolve("main_test.bal")));
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(Path.of("/tmp/non-existent-path")));
 
-        Assert.assertTrue(ProjectPaths.isStandaloneBalFile(
-                buildProjectPath.resolve("test-utils").resolve("utils.bal")));
+        Assert.assertTrue(ProjectPaths.isStandaloneBalFile(buildProjectPath.resolve("test-utils/utils.bal")));
         Assert.assertTrue(ProjectPaths.isStandaloneBalFile(tempDir.resolve("test.bal")));
 
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(
-                balaProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("mod1").resolve("mod1.bal")));
+                balaProjectPath.resolve(ProjectConstants.MODULES_ROOT).resolve("mod1/mod1.bal")));
 
         Assert.assertFalse(ProjectPaths.isStandaloneBalFile(
                 balaProjectPath.resolve(ProjectConstants.GENERATED_MODULES_ROOT).resolve("module1")
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java
index faaaff414b6f..4e34b14905c5 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/ProjectUtilsTests.java
@@ -42,7 +42,7 @@
  */
 public class ProjectUtilsTests {
 
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources");
     private static final Path PROJECT_UTILS_RESOURCES = RESOURCE_DIRECTORY.resolve("project-utils");
     private static Path tempDirectory;
     private static BuildJson buildJson;
diff --git a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java
index 3bb9a5fa9c05..58d922f63f0e 100644
--- a/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java
+++ b/compiler/ballerina-lang/src/test/java/io/ballerina/projects/utils/TestFileUtils.java
@@ -33,7 +33,7 @@
  */
 public class TestFileUtils {
 
-    private static final Path RESOURCE_DIRECTORY = Path.of("src", "test", "resources");
+    private static final Path RESOURCE_DIRECTORY = Path.of("src/test/resources");
     private static final Path UTIL_RESOURCES = RESOURCE_DIRECTORY.resolve("utils");
 
     @DataProvider(name = "providePngFiles")
diff --git a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java
index 987324147474..bd2d0b4c5233 100644
--- a/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java
+++ b/misc/ballerina-bindgen/src/test/java/org/ballerinalang/bindgen/BindgenUnitBaseTest.java
@@ -40,8 +40,7 @@ public class BindgenUnitBaseTest {
 
     protected boolean withOptionalParamTypes = false;
     protected boolean withOptionalReturnTypes = false;
-    protected Path resourceDirectory = Path.of("src").resolve("test").resolve("resources")
-            .resolve("unit-test-resources").toAbsolutePath();
+    protected Path resourceDirectory = Path.of("src/test/resources/unit-test-resources").toAbsolutePath();
 
     /**
      * Test the constructor bindings generated.
diff --git a/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java b/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java
index 045a7e158848..e60e911e8280 100644
--- a/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java
+++ b/misc/docerina/src/test/java/org/ballerinalang/docgen/tests/GenDocsForBalaTest.java
@@ -39,7 +39,7 @@
  * Test generating API docs for a bala.
  */
 public class GenDocsForBalaTest {
-    private final Path resourceDir = Path.of("src", "test", "resources");
+    private final Path resourceDir = Path.of("src/test/resources");
     private Path docsPath;
 
     @BeforeMethod
@@ -49,7 +49,7 @@ public void setup() throws IOException {
 
     @Test
     public void generatingDocsForBalaTest() throws IOException {
-        Path balaPath = this.resourceDir.resolve("balas").resolve("foo-fb-any-1.3.5.bala");
+        Path balaPath = this.resourceDir.resolve("balas/foo-fb-any-1.3.5.bala");
 
         ProjectEnvironmentBuilder defaultBuilder = ProjectEnvironmentBuilder.getDefaultBuilder();
         defaultBuilder.addCompilationCacheFactory(TempDirCompilationCache::from);
@@ -58,8 +58,7 @@ public void generatingDocsForBalaTest() throws IOException {
         BallerinaDocGenerator.generateAPIDocs(balaProject, this.docsPath.toString(), true);
 
         String sfModuleApiDocsJsonAsString = Files.readString(
-                this.docsPath.resolve("foo").resolve("fb").resolve("1.3.5")
-                        .resolve(BallerinaDocGenerator.API_DOCS_JSON));
+                this.docsPath.resolve("foo/fb/1.3.5").resolve(BallerinaDocGenerator.API_DOCS_JSON));
         Assert.assertTrue(sfModuleApiDocsJsonAsString.contains("\"id\":\"fb\",\"summary\":\"This module " +
                         "provides an implementation to interact with fb Brokers via fb Consumer and " +
                         "fb [Ballerina](https://ballerina.io) Producer clients.\\n\""),
@@ -70,8 +69,7 @@ public void generatingDocsForBalaTest() throws IOException {
         Assert.assertTrue(sfModuleApiDocsJsonAsString.contains("Block"), "Block type is missing");
 
         String sfWorldModuleApiDocsJsonAsString = Files.readString(
-                this.docsPath.resolve("foo").resolve("fb.world").resolve("1.3.5")
-                        .resolve(BallerinaDocGenerator.API_DOCS_JSON));
+                this.docsPath.resolve("foo/fb.world/1.3.5").resolve(BallerinaDocGenerator.API_DOCS_JSON));
         Assert.assertTrue(sfWorldModuleApiDocsJsonAsString.contains("PersonZ"), "PersonZ class is missing");
     }
 
@@ -92,30 +90,28 @@ public void testDocutilsGetSummary() {
 
     @Test
     public void generatingDocsForBalaWithAnnotationTest() throws IOException {
-        Path balaPath = this.resourceDir.resolve("balas").resolve("bar-testannotation-any-1.0.0.bala");
+        Path balaPath = this.resourceDir.resolve("balas/bar-testannotation-any-1.0.0.bala");
         ProjectEnvironmentBuilder defaultBuilder = ProjectEnvironmentBuilder.getDefaultBuilder();
         defaultBuilder.addCompilationCacheFactory(TempDirCompilationCache::from);
         BalaProject balaProject = BalaProject.loadProject(defaultBuilder, balaPath);
 
         BallerinaDocGenerator.generateAPIDocs(balaProject, this.docsPath.toString(), true);
         String moduleApiDocsJsonAsString = Files.readString(
-                this.docsPath.resolve("bar").resolve("testannotation").resolve("1.0.0")
-                        .resolve(BallerinaDocGenerator.API_DOCS_JSON));
+                this.docsPath.resolve("bar/testannotation/1.0.0").resolve(BallerinaDocGenerator.API_DOCS_JSON));
         Assert.assertTrue(moduleApiDocsJsonAsString.contains("Expose"), "Variable annotation attachments missing");
         Assert.assertTrue(moduleApiDocsJsonAsString.contains("Task"), "Function annotation attachments missing");
     }
 
     @Test (enabled = false)
     public void generatingDocsForBalaWithAnnotationTest2() throws IOException {
-        Path balaPath = this.resourceDir.resolve("balas").resolve("ballerina-http-java17-2.4.0.bala");
+        Path balaPath = this.resourceDir.resolve("balas/ballerina-http-java17-2.4.0.bala");
         ProjectEnvironmentBuilder defaultBuilder = ProjectEnvironmentBuilder.getDefaultBuilder();
         defaultBuilder.addCompilationCacheFactory(TempDirCompilationCache::from);
         BalaProject balaProject = BalaProject.loadProject(defaultBuilder, balaPath);
 
         BallerinaDocGenerator.generateAPIDocs(balaProject, this.docsPath.toString(), true);
         String moduleApiDocsJsonAsString = Files.readString(
-                this.docsPath.resolve("ballerina").resolve("http").resolve("2.4.0")
-                        .resolve(BallerinaDocGenerator.API_DOCS_JSON));
+                this.docsPath.resolve("ballerina/http/2.4.0").resolve(BallerinaDocGenerator.API_DOCS_JSON));
         Assert.assertTrue(moduleApiDocsJsonAsString.contains("QueryParamType"), "QueryParamType missing in docs");
     }
 
diff --git a/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java b/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java
index c8032d62370e..8a4270185e56 100644
--- a/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java
+++ b/misc/formatter/modules/formatter-cli/src/test/java/org/ballerinalang/formatter/cli/FormatCmdTest.java
@@ -34,7 +34,7 @@
  * Format CLI tool test suit for testing tool's exceptions.
  */
 public class FormatCmdTest {
-    private static final Path RES_DIR = Path.of("src").resolve("test").resolve("resources").toAbsolutePath();
+    private static final Path RES_DIR = Path.of("src/test/resources").toAbsolutePath();
     private static final String NOT_A_BAL_PROJECT = "notAProject";
     private static final String BAL_PROJECT = "project";
 
@@ -102,39 +102,39 @@ public void formatCLIOnBallerinaProjectWithConfigurations(String testCase, List<
 
     @DataProvider(name = "provideConfigurationProjects")
     private Object[][] provideConfigurationProjects() {
-        Path basePath = RES_DIR.resolve(Path.of("configurations", "options"));
+        Path basePath = RES_DIR.resolve(Path.of("configurations/options"));
         return new Object[][]{
                 {"brace", List.of(
-                        basePath.resolve(Path.of("brace", "source", "project"))
+                        basePath.resolve(Path.of("brace/source/project"))
                 )},
                 {"functionCall", List.of(
-                        basePath.resolve(Path.of("functionCall", "source", "chopDown")),
-                        basePath.resolve(Path.of("functionCall", "source", "noWrap")),
-                        basePath.resolve(Path.of("functionCall", "source", "wrap"))
+                        basePath.resolve(Path.of("functionCall/source/chopDown")),
+                        basePath.resolve(Path.of("functionCall/source/noWrap")),
+                        basePath.resolve(Path.of("functionCall/source/wrap"))
                 )},
                 {"functionDefinition", List.of(
-                        basePath.resolve(Path.of("functionDefinition", "source", "chopDown")),
-                        basePath.resolve(Path.of("functionDefinition", "source", "noWrap")),
-                        basePath.resolve(Path.of("functionDefinition", "source", "wrap"))
+                        basePath.resolve(Path.of("functionDefinition/source/chopDown")),
+                        basePath.resolve(Path.of("functionDefinition/source/noWrap")),
+                        basePath.resolve(Path.of("functionDefinition/source/wrap"))
                 )},
                 {"ifStatement", List.of(
-                        basePath.resolve(Path.of("ifStatement", "source", "ifelse"))
+                        basePath.resolve(Path.of("ifStatement/source/ifelse"))
                 )},
                 {"imports", List.of(
-                        basePath.resolve(Path.of("imports", "source", "project"))
+                        basePath.resolve(Path.of("imports/source/project"))
                 )},
                 {"indent", List.of(
-                        basePath.resolve(Path.of("indent", "source", "project"))
+                        basePath.resolve(Path.of("indent/source/project"))
                 )},
                 {"query", List.of(
-                        basePath.resolve(Path.of("query", "source", "project"))
+                        basePath.resolve(Path.of("query/source/project"))
                 )}
                 ,
                 {"spacing", List.of(
-                        basePath.resolve(Path.of("spacing", "source", "project"))
+                        basePath.resolve(Path.of("spacing/source/project"))
                 )},
                 {"wrapping", List.of(
-                        basePath.resolve(Path.of("wrapping", "source", "project"))
+                        basePath.resolve(Path.of("wrapping/source/project"))
                 )}
         };
     }
@@ -344,8 +344,8 @@ public void formatCLISingleFileInProjectTest() {
     public void formatCLIOnBallerinaProjectWithModulesWithConfigurations() {
         List argList = new ArrayList<>();
         String module = "core";
-        Path sourceDir = RES_DIR.resolve(Path.of("configurations", "module"));
-        Path projectDir = sourceDir.resolve(Path.of("source", "project"));
+        Path sourceDir = RES_DIR.resolve(Path.of("configurations/module"));
+        Path projectDir = sourceDir.resolve(Path.of("source/project"));
         Path assertDir = sourceDir.resolve("assert");
         Path moduleRelativePath = Path.of("modules", module, "core.bal");
         try {
@@ -354,7 +354,7 @@ public void formatCLIOnBallerinaProjectWithModulesWithConfigurations() {
                     Files.readString(assertDir.resolve("main.bal")));
             Assert.assertEquals(Files.readString(projectDir.resolve(moduleRelativePath)),
                     Files.readString(assertDir.resolve(moduleRelativePath)));
-            FileUtils.copyDirectory(sourceDir.resolve(Path.of("source", "projectTemp")).toFile(), projectDir.toFile());
+            FileUtils.copyDirectory(sourceDir.resolve("source/projectTemp").toFile(), projectDir.toFile());
         } catch (IOException e) {
             String exception = e.getMessage();
             Assert.assertTrue(exception.contains("error: "), "actual exception didn't match the expected.");
@@ -366,8 +366,8 @@ public void formatCLIOnBallernaProjectWithModulesWithConfigurations() {
         List argList = new ArrayList<>();
         argList.add("project");
         String module = "mod";
-        Path sourceDir = RES_DIR.resolve(Path.of("configurations", "projectWithModule"));
-        Path projectDir = sourceDir.resolve(Path.of("source", "project"));
+        Path sourceDir = RES_DIR.resolve(Path.of("configurations/projectWithModule"));
+        Path projectDir = sourceDir.resolve(Path.of("source/project"));
         Path assertDir = sourceDir.resolve("assert");
         Path moduleRelativePath = Path.of("modules", module, "mod.bal");
         try {
@@ -376,7 +376,7 @@ public void formatCLIOnBallernaProjectWithModulesWithConfigurations() {
                     Files.readString(assertDir.resolve("main.bal")));
             Assert.assertEquals(Files.readString(projectDir.resolve(moduleRelativePath)),
                     Files.readString(assertDir.resolve(moduleRelativePath)));
-            FileUtils.copyDirectory(sourceDir.resolve(Path.of("source", "projectTemp")).toFile(), projectDir.toFile());
+            FileUtils.copyDirectory(sourceDir.resolve(Path.of("source/projectTemp")).toFile(), projectDir.toFile());
         } catch (IOException e) {
             String exception = e.getMessage();
             Assert.assertTrue(exception.contains("error: "), "actual exception didn't match the expected.");
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java
index 1cde35998469..85b5ee275133 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/FormatterTest.java
@@ -47,7 +47,7 @@ public abstract class FormatterTest {
 
     // TODO: Add test cases for syntax error scenarios as well
 
-    private final Path resourceDirectory = Path.of("src").resolve("test").resolve("resources").toAbsolutePath();
+    private final Path resourceDirectory = Path.of("src/test/resources").toAbsolutePath();
     private Path buildDirectory = Path.of("build").toAbsolutePath().normalize();
     private static final String ASSERT_DIR = "assert";
     private static final String SOURCE_DIR = "source";
@@ -209,7 +209,7 @@ Object[][] getParserTestConfigs() {
             return this.testSubset();
         }
         List skippedTests = this.skipList();
-        try (Stream testPaths = Files.walk(this.buildDirectory.resolve("resources").resolve("test")
+        try (Stream testPaths = Files.walk(this.buildDirectory.resolve("resources/test")
                                 .resolve(this.getTestResourceDir()))) {
             return testPaths.filter(path -> {
                         File file = path.toFile();
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java
index 5b9b38579b68..0c60cdb45635 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/RangeFormatterTest.java
@@ -46,7 +46,7 @@
  * @since 2.0.0
  */
 public abstract class RangeFormatterTest {
-    private final Path resourceDirectory = Path.of("src").resolve("test").resolve("resources").toAbsolutePath();
+    private final Path resourceDirectory = Path.of("src/test/resources").toAbsolutePath();
     private static final String ASSERT_DIR = "assert";
     private static final String SOURCE_DIR = "source";
 
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileResolutionTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileResolutionTest.java
index ce3fe382a2d6..cff809ef7b9e 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileResolutionTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileResolutionTest.java
@@ -33,7 +33,7 @@
  */
 public class FormatFileResolutionTest {
 
-    private final Path resDir = Path.of("src", "test", "resources", "configurations", "resolution");
+    private final Path resDir = Path.of("src/test/resources/configurations/resolution");
     private final String validRemoteUrl =
             "https://gist.githubusercontent.com/ballerina-bot/ae54cc7303e9d474d730d732c1594c61/raw" +
                     "/8dc3204aec3f158105a811a6a67488bef45ff742/format.toml";
@@ -113,7 +113,7 @@ public void failureToWriteCacheFileTest() throws FormatterException {
     @AfterClass
     public void tearDown() {
         ProjectUtils.deleteDirectory(validRemote.resolve("target"));
-        ProjectUtils.deleteDirectory(withTarget.resolve("target").resolve("format"));
+        ProjectUtils.deleteDirectory(withTarget.resolve("target/format"));
     }
 
 }
diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileValidatorTest.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileValidatorTest.java
index d8fdb9c0543d..33aeeb3235f4 100644
--- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileValidatorTest.java
+++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/configurations/FormatFileValidatorTest.java
@@ -31,7 +31,7 @@
  */
 public class FormatFileValidatorTest {
 
-    private final Path resDir = Path.of("src", "test", "resources", "configurations", "validator");
+    private final Path resDir = Path.of("src/test/resources/configurations/validator");
 
     @Test(description = "Test validator on valid formatting configuration file")
     public void testValidatorOnValidFile() throws FormatterException {

From 536ed3c463e11972339f77932037cb9fdbeb651a Mon Sep 17 00:00:00 2001
From: Felix Schnabel 
Date: Tue, 6 Aug 2024 00:25:54 +0200
Subject: [PATCH 4/5] Fix compilation error

---
 .../java/io/ballerina/projects/test/PackageResolutionTests.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java
index 22fa2051cb89..b66c925a162b 100644
--- a/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java
+++ b/project-api/project-api-test/src/test/java/io/ballerina/projects/test/PackageResolutionTests.java
@@ -562,7 +562,7 @@ public void testProjectWithManyDependencies(boolean optimizeDependencyCompilatio
             initialOpenCount = unixOperatingSystemMXBean.getOpenFileDescriptorCount();
         }
         Project project = TestUtils.loadProject(
-                Paths.get("projects_for_resolution_tests/ultimate_package_resolution/package_http"),
+                Path.of("projects_for_resolution_tests/ultimate_package_resolution/package_http"),
                 BuildOptions.builder().setOptimizeDependencyCompilation(optimizeDependencyCompilation).build());
 
         PackageCompilation compilation = project.currentPackage().getCompilation();

From ea91d2909bbca719c44aa06c8943be9e3d41bfe1 Mon Sep 17 00:00:00 2001
From: Felix Schnabel 
Date: Mon, 16 Sep 2024 23:04:37 +0200
Subject: [PATCH 5/5] Fix new `Paths.get` occurences

---
 .../test/java/io/ballerina/cli/cmd/ProjectWatcherTest.java   | 5 ++---
 .../inbuilt/analyzer/LogCodeAnalyzerInBuiltPlugin.java       | 3 +--
 .../inbuilt/generator/LogCodeGeneratorInBuiltPlugin.java     | 3 +--
 .../inbuilt/modifier/LogCodeModifierInBuiltPlugin.java       | 3 +--
 .../luhee/plugins/pkg/analyzer/LogCodeAnalyzerPkgPlugin.java | 3 +--
 .../plugins/pkg/generator/LogCodeGeneratorPkgPlugin.java     | 3 +--
 .../luhee/plugins/pkg/modifier/LogCodeModifierPkgPlugin.java | 3 +--
 .../debugger/test/utils/client/DAPClientConnector.java       | 5 ++---
 8 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProjectWatcherTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProjectWatcherTest.java
index 80ee3056b6af..842d86aa12a4 100644
--- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProjectWatcherTest.java
+++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/ProjectWatcherTest.java
@@ -12,7 +12,6 @@
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Objects;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicReference;
@@ -42,8 +41,8 @@ public void setup() throws IOException {
             this.watchTestResources = testResources.resolve("watchFlagResources");
             URI testResourcesURI = Objects.requireNonNull(
                     getClass().getClassLoader().getResource("test-resources")).toURI();
-            Files.walkFileTree(Paths.get(testResourcesURI),
-                    new BuildCommandTest.Copy(Paths.get(testResourcesURI), testResources));
+            Files.walkFileTree(Path.of(testResourcesURI),
+                    new BuildCommandTest.Copy(Path.of(testResourcesURI), testResources));
             watcher = new AtomicReference<>();
         } catch (URISyntaxException e) {
             Assert.fail("error loading resources");
diff --git a/project-api/test-artifacts/log-creator-in-built-code-analyzer/src/main/java/io/luhee/plugins/inbuilt/analyzer/LogCodeAnalyzerInBuiltPlugin.java b/project-api/test-artifacts/log-creator-in-built-code-analyzer/src/main/java/io/luhee/plugins/inbuilt/analyzer/LogCodeAnalyzerInBuiltPlugin.java
index 768116979c65..69b1dc2472ea 100644
--- a/project-api/test-artifacts/log-creator-in-built-code-analyzer/src/main/java/io/luhee/plugins/inbuilt/analyzer/LogCodeAnalyzerInBuiltPlugin.java
+++ b/project-api/test-artifacts/log-creator-in-built-code-analyzer/src/main/java/io/luhee/plugins/inbuilt/analyzer/LogCodeAnalyzerInBuiltPlugin.java
@@ -30,7 +30,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /***
  * A in-built code analyzer which adds a log statement to the beginning of the file.
@@ -38,7 +37,7 @@
  * @since 2.7.1
  */
 public class LogCodeAnalyzerInBuiltPlugin extends CompilerPlugin {
-    private static final Path filePath = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
+    private static final Path filePath = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
             .toAbsolutePath();
 
     @Override
diff --git a/project-api/test-artifacts/log-creator-in-built-code-generator/src/main/java/io/luhee/plugins/inbuilt/generator/LogCodeGeneratorInBuiltPlugin.java b/project-api/test-artifacts/log-creator-in-built-code-generator/src/main/java/io/luhee/plugins/inbuilt/generator/LogCodeGeneratorInBuiltPlugin.java
index 43b480bb0eb3..e7c4ff44fb51 100644
--- a/project-api/test-artifacts/log-creator-in-built-code-generator/src/main/java/io/luhee/plugins/inbuilt/generator/LogCodeGeneratorInBuiltPlugin.java
+++ b/project-api/test-artifacts/log-creator-in-built-code-generator/src/main/java/io/luhee/plugins/inbuilt/generator/LogCodeGeneratorInBuiltPlugin.java
@@ -30,7 +30,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 
 /***
@@ -39,7 +38,7 @@
  * @since 2.7.1
  */
 public class LogCodeGeneratorInBuiltPlugin extends CompilerPlugin {
-    private static final Path filePath = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
+    private static final Path filePath = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
             .toAbsolutePath();
 
     @Override
diff --git a/project-api/test-artifacts/log-creator-in-built-code-modifier/src/main/java/io/luhee/plugins/inbuilt/modifier/LogCodeModifierInBuiltPlugin.java b/project-api/test-artifacts/log-creator-in-built-code-modifier/src/main/java/io/luhee/plugins/inbuilt/modifier/LogCodeModifierInBuiltPlugin.java
index 38a4dd886df4..642b3582421c 100644
--- a/project-api/test-artifacts/log-creator-in-built-code-modifier/src/main/java/io/luhee/plugins/inbuilt/modifier/LogCodeModifierInBuiltPlugin.java
+++ b/project-api/test-artifacts/log-creator-in-built-code-modifier/src/main/java/io/luhee/plugins/inbuilt/modifier/LogCodeModifierInBuiltPlugin.java
@@ -30,7 +30,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 
 /***
@@ -39,7 +38,7 @@
  * @since 2.7.1
  */
 public class LogCodeModifierInBuiltPlugin extends CompilerPlugin {
-    private static final Path filePath = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
+    private static final Path filePath = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
             .toAbsolutePath();
 
     @Override
diff --git a/project-api/test-artifacts/log-creator-pkg-provided-code-analyzer/src/main/java/io/luhee/plugins/pkg/analyzer/LogCodeAnalyzerPkgPlugin.java b/project-api/test-artifacts/log-creator-pkg-provided-code-analyzer/src/main/java/io/luhee/plugins/pkg/analyzer/LogCodeAnalyzerPkgPlugin.java
index 8bfa072a12a2..520536c211ea 100644
--- a/project-api/test-artifacts/log-creator-pkg-provided-code-analyzer/src/main/java/io/luhee/plugins/pkg/analyzer/LogCodeAnalyzerPkgPlugin.java
+++ b/project-api/test-artifacts/log-creator-pkg-provided-code-analyzer/src/main/java/io/luhee/plugins/pkg/analyzer/LogCodeAnalyzerPkgPlugin.java
@@ -31,7 +31,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 
 /***
@@ -40,7 +39,7 @@
  * @since 2.7.1
  */
 public class LogCodeAnalyzerPkgPlugin extends CompilerPlugin {
-    private static final Path filePath = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
+    private static final Path filePath = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
             .toAbsolutePath();
 
     @Override
diff --git a/project-api/test-artifacts/log-creator-pkg-provided-code-generator/src/main/java/io/luhee/plugins/pkg/generator/LogCodeGeneratorPkgPlugin.java b/project-api/test-artifacts/log-creator-pkg-provided-code-generator/src/main/java/io/luhee/plugins/pkg/generator/LogCodeGeneratorPkgPlugin.java
index 4a455c79bee3..d795cad85edd 100644
--- a/project-api/test-artifacts/log-creator-pkg-provided-code-generator/src/main/java/io/luhee/plugins/pkg/generator/LogCodeGeneratorPkgPlugin.java
+++ b/project-api/test-artifacts/log-creator-pkg-provided-code-generator/src/main/java/io/luhee/plugins/pkg/generator/LogCodeGeneratorPkgPlugin.java
@@ -30,7 +30,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 
 /***
@@ -40,7 +39,7 @@
  */
 public class LogCodeGeneratorPkgPlugin extends CompilerPlugin {
 
-    private static final Path filePath = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
+    private static final Path filePath = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
             .toAbsolutePath();
 
     @Override
diff --git a/project-api/test-artifacts/log-creator-pkg-provided-code-modifier/src/main/java/io/luhee/plugins/pkg/modifier/LogCodeModifierPkgPlugin.java b/project-api/test-artifacts/log-creator-pkg-provided-code-modifier/src/main/java/io/luhee/plugins/pkg/modifier/LogCodeModifierPkgPlugin.java
index a47ce3e07fd0..71176eeebc88 100644
--- a/project-api/test-artifacts/log-creator-pkg-provided-code-modifier/src/main/java/io/luhee/plugins/pkg/modifier/LogCodeModifierPkgPlugin.java
+++ b/project-api/test-artifacts/log-creator-pkg-provided-code-modifier/src/main/java/io/luhee/plugins/pkg/modifier/LogCodeModifierPkgPlugin.java
@@ -31,7 +31,6 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 
 /***
@@ -41,7 +40,7 @@
  */
 public class LogCodeModifierPkgPlugin extends CompilerPlugin {
 
-    private static final Path filePath = Paths.get("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
+    private static final Path filePath = Path.of("build/logs/log_creator_combined_plugin/compiler-plugin.txt")
             .toAbsolutePath();
 
     @Override
diff --git a/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/DAPClientConnector.java b/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/DAPClientConnector.java
index 1b7572bd3854..31b23ca111c9 100644
--- a/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/DAPClientConnector.java
+++ b/tests/jballerina-debugger-integration-test/src/main/java/org/ballerinalang/debugger/test/utils/client/DAPClientConnector.java
@@ -36,7 +36,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -237,10 +236,10 @@ private StreamConnectionProvider createConnectionProvider(String balHome) {
         if (Utils.getOSName().toLowerCase(Locale.ENGLISH).contains("windows")) {
             processArgs.add("cmd.exe");
             processArgs.add("/c");
-            processArgs.add(Paths.get(balHome, "bin", Constant.BALLERINA_SERVER_SCRIPT_NAME + ".bat").toString());
+            processArgs.add(Path.of(balHome, "bin", Constant.BALLERINA_SERVER_SCRIPT_NAME + ".bat").toString());
         } else {
             processArgs.add("bash");
-            processArgs.add(Paths.get(balHome, "bin", Constant.BALLERINA_SERVER_SCRIPT_NAME).toString());
+            processArgs.add(Path.of(balHome, "bin", Constant.BALLERINA_SERVER_SCRIPT_NAME).toString());
         }
 
         processArgs.add(DebugUtils.JBAL_DEBUG_CMD_NAME);