From 9963c4a495c194deafcb0e7f983b1e67e3effd11 Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Fri, 10 Mar 2017 10:35:30 +0100 Subject: [PATCH] Fix Kotlin warnings --- .../springframework/beans/factory/BeanFactoryExtensions.kt | 1 + .../org/springframework/jdbc/core/JdbcOperationsExtensions.kt | 2 ++ .../jdbc/core/JdbcOperationsExtensionsTests.kt | 4 ++-- .../reactive/function/server/RouterFunctionExtensionsTests.kt | 2 ++ .../view/script/ScriptTemplateWithBindingsExtensions.kt | 2 ++ .../view/script/ScriptTemplateWithBindingsExtensions.kt | 2 ++ 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt b/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt index a0212402e27..dc4f4d188b9 100644 --- a/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt +++ b/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt @@ -36,6 +36,7 @@ fun BeanFactory.getBean(name: String, requiredType: KClass) = * @author Sebastien Deleuze * @since 5.0 */ +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") inline fun BeanFactory.getBean(name: String) = getBean(name, T::class.java) diff --git a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt index a3b27cca8d4..9b2fb62c60d 100644 --- a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt +++ b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt @@ -106,6 +106,7 @@ fun JdbcOperations.queryForList(sql: String, elementType: KClass): * @author Mario Arias * @since 5.0 */ +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") inline fun JdbcOperations.queryForList(sql: String): List = queryForList(sql, T::class.java) @@ -124,6 +125,7 @@ fun JdbcOperations.queryForList(sql: String, args: Array, arg * @author Mario Arias * @since 5.0 */ +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") inline fun JdbcOperations.queryForList(sql: String, args: Array, argTypes: IntArray): List = queryForList(sql, args, argTypes, T::class.java) diff --git a/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt b/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt index 9b470c4aa46..9b9718844f6 100644 --- a/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt +++ b/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt @@ -88,7 +88,7 @@ class JdbcOperationsExtensionsTests { @Test fun `queryForObject with RowMapper-like function`() { - val i = template.queryForObject("select age from customer where id = ?", 3) { rs, i -> + val i = template.queryForObject("select age from customer where id = ?", 3) { rs, _ -> rs.getInt(1) } assertEquals(22, i) @@ -181,7 +181,7 @@ class JdbcOperationsExtensionsTests { @Test fun `query with RowMapper-like function`() { - val i = template.query("select age from customer where id = ?", 3) { rs, i -> + val i = template.query("select age from customer where id = ?", 3) { rs, _ -> rs.getInt(1) } assertEquals(22, i.first()) diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt index 71644dbd228..3681e31b04f 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt @@ -133,8 +133,10 @@ class RouterFunctionExtensionsTests { path("/baz") { handle(req) } } + @Suppress("UNUSED_PARAMETER") fun handleFromClass(req: ServerRequest) = ok().build() } } +@Suppress("UNUSED_PARAMETER") fun handle(req: ServerRequest) = ok().build() diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt index e40f00b18ce..225837076c4 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt @@ -1,3 +1,5 @@ +@file:Suppress("UNCHECKED_CAST") + package org.springframework.web.reactive.result.view.script import kotlin.script.templates.standard.ScriptTemplateWithBindings diff --git a/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt b/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt index e40f00b18ce..225837076c4 100644 --- a/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt +++ b/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt @@ -1,3 +1,5 @@ +@file:Suppress("UNCHECKED_CAST") + package org.springframework.web.reactive.result.view.script import kotlin.script.templates.standard.ScriptTemplateWithBindings