ikozlowski
04/08/2020, 12:07 AMresult.andExpect(status().isOk)
.andReturn()
.response!! // Problematic line
.contentAsClass<SomeType>()
inline fun <reified T> MockHttpServletResponse.contentAsClass(): T? =
TestUtil.convertJsonBytesToObject(this.contentAsString, T::class.java) // This returns T
with !!
Unnecessary non-null assertion (!!) on a non-null receiver of type MockHttpServletResponse!
without !!
Call of inline function with nullable extension receiver can provoke NPE in Kotlin 1.2+
method org.springframework.test.web.servlet.MvcResult.getResponse()
has this docs/signature
/**
* Return the resulting response.
* @return the response, never {@code null}
*/
MockHttpServletResponse getResponse();
I'm using current Kotlin & plugin - 1.3.71
any ideas or should I open issue?David Eriksson
04/08/2020, 9:03 AMDavid Eriksson
04/08/2020, 9:03 AMMockHttpServletResponse?
Alexey Belkov [JB]
04/10/2020, 1:56 PM@Suppress("PlatformExtensionReceiverOfInline")
. I will investigate this further.