Spring Boot Version used: 2.2.0
Steps to reproduce
- Use kotlin
- Implement the MethodInterceptor interface
- Auto generate the methods - it generates
override fun invoke(invocation: MethodInvocation?): Any
- Call invocation.proceed on a method returning null
Analysis so far:
- Kotlin does not detect the nullability of the interface and the proceed() method correctly.
Suggestion:
- Add Spring's Nullable annotation since it is based on JSR-305 (javax.annotation)
@Nullable to at least the interface. The method also does not get picked up by the compiler (it is indicating Any!) - but that doesn't seem to be an issue.
Fix:
Replace the return type of the implemented interface method with Any? (instead of Any).
Is this my bad or should the interface suggest that there could be a null value?
Spring Boot Version used: 2.2.0
Steps to reproduce
override fun invoke(invocation: MethodInvocation?): AnyAnalysis so far:
Suggestion:
@Nullableto at least the interface. The method also does not get picked up by the compiler (it is indicating Any!) - but that doesn't seem to be an issue.Fix:
Replace the return type of the implemented interface method with Any? (instead of Any).
Is this my bad or should the interface suggest that there could be a null value?