From 60afbed65fac25fa0267e2e9a7da65db153e5d38 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 7 Jan 2016 21:44:29 +0400 Subject: [PATCH] Fix crash due to @Nullable not being Runtime. --- kobalt/src/Build.kt | 1 + .../com/beust/kobalt/plugin/publish/JCenterApi.kt | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 373aaa9d..f41e3124 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -122,6 +122,7 @@ val kobaltApp = kotlinProject(kobaltPluginApi, wrapper) { "com.beust:jcommander:1.48", "com.squareup.retrofit:retrofit:1.9.0", "org.apache.maven:maven-model:3.3.3", + "com.google.code.findbugs:jsr305:3.0.1", "org.codehaus.plexus:plexus-utils:3.0.22") } diff --git a/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt b/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt index 66d8e909..7ad6d9e8 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt @@ -15,9 +15,9 @@ import com.google.gson.JsonObject import com.google.gson.JsonParser import com.google.inject.assistedinject.Assisted import com.squareup.okhttp.Response -import org.jetbrains.annotations.Nullable import retrofit.mime.TypedFile import java.io.File +import javax.annotation.Nullable import javax.inject.Inject data class JCenterPackage(val jo: JsonObject) { @@ -52,8 +52,10 @@ open public class UnauthenticatedJCenterApi @Inject constructor(open val http: H // } } -public class JCenterApi @Inject constructor (@Nullable @Assisted("username") val username: String?, - @Nullable @Assisted("password") val password: String?, @Nullable @Assisted("org") val org: String?, +public class JCenterApi @Inject constructor ( + @Nullable @Assisted("username") val username: String?, + @Nullable @Assisted("password") val password: String?, + @Nullable @Assisted("org") val org: String?, override val http: Http, val gpg: Gpg, val executors: KobaltExecutors) : UnauthenticatedJCenterApi(http) { interface IFactory { @@ -63,8 +65,9 @@ public class JCenterApi @Inject constructor (@Nullable @Assisted("username") val } fun packageExists(packageName: String) : Boolean { - val url = arrayListOf(UnauthenticatedJCenterApi.BINTRAY_URL_API, "packages", org ?: username!!, "maven", packageName) - .joinToString("/") + val url = arrayListOf(UnauthenticatedJCenterApi.BINTRAY_URL_API, "packages", org ?: username!!, + "maven", packageName) + .joinToString("/") val jcResponse = parseResponse(http.get(username, password, url)) if (jcResponse.errorMessage != null) {