Declare returned Core to always be non-null
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 5 Oct 2017 19:01:43 +0000 (21:01 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 5 Oct 2017 19:06:02 +0000 (21:06 +0200)
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt

index 49f1158..6401b43 100644 (file)
@@ -410,6 +410,7 @@ public class WebInterface implements SessionProvider {
         *
         * @return The Sone core
         */
+       @Nonnull
        public Core getCore() {
                return sonePlugin.core();
        }
index 3e9eed0..932827e 100644 (file)
@@ -11,7 +11,7 @@ import java.net.URI
  */
 class GetImagePage(webInterface: WebInterface): FreenetPage {
 
-       private val core = webInterface.core!!
+       private val core = webInterface.core
 
        override fun getPath(): String {
                return "getImage.html"
index fc59639..a1fc2de 100644 (file)
@@ -47,7 +47,7 @@ open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePag
        val currentSone = mock<Sone>()
        val template = mock<Template>()
        val webInterface = deepMock<WebInterface>()
-       val core = webInterface.core!!
+       val core = webInterface.core
        val eventBus = mock<EventBus>()
        val preferences = Preferences(eventBus)
        val l10n = webInterface.l10n!!