From 2fb1c54bd72c1401a8a5aa1b955704780a683892 Mon Sep 17 00:00:00 2001 From: ravinperera00 Date: Fri, 6 Dec 2024 09:32:26 +0530 Subject: [PATCH] Migrate to Java 21 --- README.md | 2 +- ballerina/Ballerina.toml | 6 +++--- ballerina/Dependencies.toml | 2 +- build-config/resources/Ballerina.toml | 6 +++--- gradle.properties | 6 +++--- native/build.gradle | 7 +++++-- .../io/ballerina/lib/aws/mpe/NativeClientAdaptor.java | 9 +++------ 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index fd7ff4c..56bd7c0 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ bal run ### Setting up the prerequisites -1. Download and install Java SE Development Kit (JDK) version 17. You can download it from either of the following sources: +1. Download and install Java SE Development Kit (JDK) version 21. You can download it from either of the following sources: * [Oracle JDK](https://www.oracle.com/java/technologies/downloads/) * [OpenJDK](https://adoptium.net/) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index d518b25..56e2d30 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,5 +1,5 @@ [package] -distribution = "2201.9.2" +distribution = "2201.11.0-20241117-133400-a3054b77" org = "ballerinax" name = "aws.marketplace.mpe" version = "0.1.0" @@ -9,10 +9,10 @@ keywords = ["AWS", "Marketplace", "Cloud/Subscriptions", "Entitlement Management icon = "icon.png" repository = "https://github.com/ballerina-platform/module-ballerinax-aws.marketplace.mpe" -[platform.java17] +[platform.java21] graalvmCompatible = true -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.lib" artifactId = "aws.marketplace.mpe-native" version = "0.1.0" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 1e0f2b5..ea7dfab 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.9.2" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index 3ba671b..cacaf8f 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -1,5 +1,5 @@ [package] -distribution = "2201.9.2" +distribution = "2201.11.0-20241117-133400-a3054b77" org = "ballerinax" name = "aws.marketplace.mpe" version = "@toml.version@" @@ -9,10 +9,10 @@ keywords = ["AWS", "Marketplace", "Cloud/Subscriptions", "Entitlement Management icon = "icon.png" repository = "https://github.com/ballerina-platform/module-ballerinax-aws.marketplace.mpe" -[platform.java17] +[platform.java21] graalvmCompatible = true -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.lib" artifactId = "aws.marketplace.mpe-native" version = "@project.version@" diff --git a/gradle.properties b/gradle.properties index 0ddf3d7..e2f1d2b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,14 +3,14 @@ group=io.ballerina.lib version=0.1.1-SNAPSHOT checkstylePluginVersion=10.12.0 -spotbugsPluginVersion=5.0.14 +spotbugsPluginVersion=6.0.18 shadowJarPluginVersion=8.1.1 downloadPluginVersion=5.4.0 releasePluginVersion=2.8.0 testngVersion=7.6.1 eclipseLsp4jVersion=0.12.0 ballerinaGradlePluginVersion=2.2.4 -ballerinaLangVersion=2201.9.2 +ballerinaLangVersion=2201.11.0-20241117-133400-a3054b77 -stdlibTimeVersion=2.4.0 +stdlibTimeVersion=2.6.0-20241113-073800-201b904 awsMpEntitlementSdkVersion=2.27.6 diff --git a/native/build.gradle b/native/build.gradle index 683bfad..a2b3de7 100644 --- a/native/build.gradle +++ b/native/build.gradle @@ -62,8 +62,11 @@ test { } spotbugsMain { - effort = "max" - reportLevel = "low" + def classLoader = plugins["com.github.spotbugs"].class.classLoader + def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") + def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") + effort = SpotBugsEffort.MAX + reportLevel = SpotBugsConfidence.LOW reportsDir = file("$project.buildDir/reports/spotbugs") def excludeFile = file("${rootDir}/build-config/spotbugs-exclude.xml") if (excludeFile.exists()) { diff --git a/native/src/main/java/io/ballerina/lib/aws/mpe/NativeClientAdaptor.java b/native/src/main/java/io/ballerina/lib/aws/mpe/NativeClientAdaptor.java index 5e5af63..ca5b4d6 100644 --- a/native/src/main/java/io/ballerina/lib/aws/mpe/NativeClientAdaptor.java +++ b/native/src/main/java/io/ballerina/lib/aws/mpe/NativeClientAdaptor.java @@ -19,7 +19,6 @@ package io.ballerina.lib.aws.mpe; import io.ballerina.runtime.api.Environment; -import io.ballerina.runtime.api.Future; import io.ballerina.runtime.api.values.BError; import io.ballerina.runtime.api.values.BMap; import io.ballerina.runtime.api.values.BObject; @@ -93,20 +92,18 @@ public static Object getEntitlements(Environment env, BObject bAwsMpeClient, BMa MarketplaceEntitlementClient nativeClient = (MarketplaceEntitlementClient) bAwsMpeClient .getNativeData(NATIVE_CLIENT); GetEntitlementsRequest entitlementsRequest = CommonUtils.getNativeRequest(request); - Future future = env.markAsync(); - EXECUTOR_SERVICE.execute(() -> { + return env.yieldAndRun(() -> { try { GetEntitlementsResponse entitlementsResponse = nativeClient.getEntitlements(entitlementsRequest); BMap bResponse = CommonUtils.getBallerinaResponse(entitlementsResponse); - future.complete(bResponse); + return bResponse; } catch (Exception e) { String errorMsg = String.format("Error occurred while retrieving entitlements for the product: %s", e.getMessage()); BError bError = CommonUtils.createError(errorMsg, e); - future.complete(bError); + return bError; } }); - return null; } /**