From 91bb1b955c5be1ae1a5a743f68398b119dd14ddd Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 5 May 2017 12:47:29 -0700 Subject: [PATCH] Warnings. --- .../main/kotlin/com/beust/kobalt/misc/LocalProperties.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt index 4fe16a5c..64cecbb4 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt @@ -6,6 +6,9 @@ import java.nio.file.Files import java.nio.file.Paths import java.util.* +/** + * Encapsulate read access to local.properties. + */ @Singleton class LocalProperties { val localProperties: Properties by lazy { @@ -22,11 +25,11 @@ class LocalProperties { result } - fun getNoThrows(name: String, docUrl: String? = null) = localProperties.getProperty(name) + fun getNoThrows(name: String, docUrl: String? = null): String? = localProperties.getProperty(name, docUrl) fun get(name: String, docUrl: String? = null) : String { val result = getNoThrows(name, docUrl) ?: throw KobaltException("Couldn't find $name in local.properties", docUrl = docUrl) - return result as String + return result } }