From 6fcf29fe3a46360af79522ff63cd774a4f4b3f66 Mon Sep 17 00:00:00 2001 From: Ashish Agrawal Date: Mon, 14 Mar 2022 17:40:08 -0700 Subject: [PATCH] Upgrade kotlin and fix issues related to that Signed-off-by: Ashish Agrawal --- alerting/build.gradle | 4 ++-- .../opensearch/alerting/action/AcknowledgeAlertAction.kt | 2 +- .../opensearch/alerting/action/DeleteDestinationAction.kt | 2 +- .../org/opensearch/alerting/action/DeleteMonitorAction.kt | 2 +- .../org/opensearch/alerting/action/ExecuteMonitorAction.kt | 2 +- .../org/opensearch/alerting/action/GetAlertsAction.kt | 2 +- .../org/opensearch/alerting/action/GetDestinationsAction.kt | 2 +- .../org/opensearch/alerting/action/GetEmailAccountAction.kt | 2 +- .../org/opensearch/alerting/action/GetEmailGroupAction.kt | 2 +- .../org/opensearch/alerting/action/GetMonitorAction.kt | 2 +- .../opensearch/alerting/action/IndexDestinationAction.kt | 2 +- .../opensearch/alerting/action/IndexEmailAccountAction.kt | 2 +- .../org/opensearch/alerting/action/IndexEmailGroupAction.kt | 2 +- .../org/opensearch/alerting/action/IndexMonitorAction.kt | 2 +- .../opensearch/alerting/action/SearchEmailAccountAction.kt | 2 +- .../opensearch/alerting/action/SearchEmailGroupAction.kt | 2 +- .../org/opensearch/alerting/action/SearchMonitorAction.kt | 2 +- build.gradle | 6 +++--- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/alerting/build.gradle b/alerting/build.gradle index 53b4f8b71..c952f69d7 100644 --- a/alerting/build.gradle +++ b/alerting/build.gradle @@ -50,7 +50,7 @@ configurations.all { } } -configurations.testCompile { +configurations.testImplementation { exclude module: "securemock" } @@ -67,7 +67,7 @@ dependencies { implementation "com.github.seancfoley:ipaddress:5.3.3" testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}" - testCompile "org.mockito:mockito-core:4.3.1" + testImplementation "org.mockito:mockito-core:4.3.1" } javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/AcknowledgeAlertAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/AcknowledgeAlertAction.kt index 2cdfe71c8..d1d968f71 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/AcknowledgeAlertAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/AcknowledgeAlertAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class AcknowledgeAlertAction private constructor() : ActionType(NAME, ::AcknowledgeAlertResponse) { companion object { val INSTANCE = AcknowledgeAlertAction() - val NAME = "cluster:admin/opendistro/alerting/alerts/ack" + const val NAME = "cluster:admin/opendistro/alerting/alerts/ack" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteDestinationAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteDestinationAction.kt index 721e16975..31d090d5e 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteDestinationAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteDestinationAction.kt @@ -11,6 +11,6 @@ import org.opensearch.action.delete.DeleteResponse class DeleteDestinationAction private constructor() : ActionType(NAME, ::DeleteResponse) { companion object { val INSTANCE = DeleteDestinationAction() - val NAME = "cluster:admin/opendistro/alerting/destination/delete" + const val NAME = "cluster:admin/opendistro/alerting/destination/delete" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteMonitorAction.kt index fad600e85..402b95f41 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/DeleteMonitorAction.kt @@ -11,6 +11,6 @@ import org.opensearch.action.delete.DeleteResponse class DeleteMonitorAction private constructor() : ActionType(NAME, ::DeleteResponse) { companion object { val INSTANCE = DeleteMonitorAction() - val NAME = "cluster:admin/opendistro/alerting/monitor/delete" + const val NAME = "cluster:admin/opendistro/alerting/monitor/delete" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/ExecuteMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/ExecuteMonitorAction.kt index c1f9192d9..4cc869b37 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/ExecuteMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/ExecuteMonitorAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class ExecuteMonitorAction private constructor() : ActionType(NAME, ::ExecuteMonitorResponse) { companion object { val INSTANCE = ExecuteMonitorAction() - val NAME = "cluster:admin/opendistro/alerting/monitor/execute" + const val NAME = "cluster:admin/opendistro/alerting/monitor/execute" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetAlertsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetAlertsAction.kt index 3746504ff..649993565 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetAlertsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetAlertsAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class GetAlertsAction private constructor() : ActionType(NAME, ::GetAlertsResponse) { companion object { val INSTANCE = GetAlertsAction() - val NAME = "cluster:admin/opendistro/alerting/alerts/get" + const val NAME = "cluster:admin/opendistro/alerting/alerts/get" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetDestinationsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetDestinationsAction.kt index 4e2e8bdc8..76adde8c6 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetDestinationsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetDestinationsAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class GetDestinationsAction private constructor() : ActionType(NAME, ::GetDestinationsResponse) { companion object { val INSTANCE = GetDestinationsAction() - val NAME = "cluster:admin/opendistro/alerting/destination/get" + const val NAME = "cluster:admin/opendistro/alerting/destination/get" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailAccountAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailAccountAction.kt index 0dbf85eec..c16a28e17 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailAccountAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailAccountAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class GetEmailAccountAction private constructor() : ActionType(NAME, ::GetEmailAccountResponse) { companion object { val INSTANCE = GetEmailAccountAction() - val NAME = "cluster:admin/opendistro/alerting/destination/email_account/get" + const val NAME = "cluster:admin/opendistro/alerting/destination/email_account/get" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailGroupAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailGroupAction.kt index c2c48487f..a9793f156 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailGroupAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetEmailGroupAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class GetEmailGroupAction private constructor() : ActionType(NAME, ::GetEmailGroupResponse) { companion object { val INSTANCE = GetEmailGroupAction() - val NAME = "cluster:admin/opendistro/alerting/destination/email_group/get" + const val NAME = "cluster:admin/opendistro/alerting/destination/email_group/get" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetMonitorAction.kt index 0e8807d0e..da209b983 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/GetMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/GetMonitorAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class GetMonitorAction private constructor() : ActionType(NAME, ::GetMonitorResponse) { companion object { val INSTANCE = GetMonitorAction() - val NAME = "cluster:admin/opendistro/alerting/monitor/get" + const val NAME = "cluster:admin/opendistro/alerting/monitor/get" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexDestinationAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexDestinationAction.kt index 6678b3881..76b180a5f 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexDestinationAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexDestinationAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class IndexDestinationAction private constructor() : ActionType(NAME, ::IndexDestinationResponse) { companion object { val INSTANCE = IndexDestinationAction() - val NAME = "cluster:admin/opendistro/alerting/destination/write" + const val NAME = "cluster:admin/opendistro/alerting/destination/write" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailAccountAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailAccountAction.kt index 360cd83e3..5b935bc7c 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailAccountAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailAccountAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class IndexEmailAccountAction private constructor() : ActionType(NAME, ::IndexEmailAccountResponse) { companion object { val INSTANCE = IndexEmailAccountAction() - val NAME = "cluster:admin/opendistro/alerting/destination/email_account/write" + const val NAME = "cluster:admin/opendistro/alerting/destination/email_account/write" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailGroupAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailGroupAction.kt index bef09c325..9abeb979e 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailGroupAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexEmailGroupAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class IndexEmailGroupAction private constructor() : ActionType(NAME, ::IndexEmailGroupResponse) { companion object { val INSTANCE = IndexEmailGroupAction() - val NAME = "cluster:admin/opendistro/alerting/destination/email_group/write" + const val NAME = "cluster:admin/opendistro/alerting/destination/email_group/write" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexMonitorAction.kt index 6c79cd639..4c3c8dacb 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/IndexMonitorAction.kt @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType class IndexMonitorAction private constructor() : ActionType(NAME, ::IndexMonitorResponse) { companion object { val INSTANCE = IndexMonitorAction() - val NAME = "cluster:admin/opendistro/alerting/monitor/write" + const val NAME = "cluster:admin/opendistro/alerting/monitor/write" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailAccountAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailAccountAction.kt index 736ec3b33..12cf21299 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailAccountAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailAccountAction.kt @@ -11,6 +11,6 @@ import org.opensearch.action.search.SearchResponse class SearchEmailAccountAction private constructor() : ActionType(NAME, ::SearchResponse) { companion object { val INSTANCE = SearchEmailAccountAction() - val NAME = "cluster:admin/opendistro/alerting/destination/email_account/search" + const val NAME = "cluster:admin/opendistro/alerting/destination/email_account/search" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailGroupAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailGroupAction.kt index fda4278cd..da113c857 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailGroupAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchEmailGroupAction.kt @@ -11,6 +11,6 @@ import org.opensearch.action.search.SearchResponse class SearchEmailGroupAction private constructor() : ActionType(NAME, ::SearchResponse) { companion object { val INSTANCE = SearchEmailGroupAction() - val NAME = "cluster:admin/opendistro/alerting/destination/email_group/search" + const val NAME = "cluster:admin/opendistro/alerting/destination/email_group/search" } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchMonitorAction.kt index 660813316..16725fc39 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/SearchMonitorAction.kt @@ -11,6 +11,6 @@ import org.opensearch.action.search.SearchResponse class SearchMonitorAction private constructor() : ActionType(NAME, ::SearchResponse) { companion object { val INSTANCE = SearchMonitorAction() - val NAME = "cluster:admin/opendistro/alerting/monitor/search" + const val NAME = "cluster:admin/opendistro/alerting/monitor/search" } } diff --git a/build.gradle b/build.gradle index 844b7fd0d..eef8871ec 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ buildscript { // 1.0.0 -> 1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2') common_utils_version = System.getProperty("common_utils.version", opensearch_build) - kotlin_version = '1.3.72' + kotlin_version = '1.6.10' } repositories { @@ -77,10 +77,10 @@ allprojects { apply from: "$rootDir/build-tools/repositories.gradle" plugins.withId('java') { - sourceCompatibility = targetCompatibility = "1.8" + sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11 } plugins.withId('org.jetbrains.kotlin.jvm') { - compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = "1.8" + compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_11 compileKotlin.dependsOn ktlint } }