Java squid:S2583 with kotlin nullable object

A kotlin data object with a nullable parameter results in false positive on null checks

SonarQube Version:
SonarAnalyzer (Java)

data class OnlineSalesDetailsView(
        val loanPurpose: LoanPurpose?,
        if (!optOsView.isPresent()) {
            return Optional.empty();

        OnlineSalesDetailsView osView = optOsView.get();

        // It is possible loan amount is null (pre-approval flow)
        if(osView.getLoanAmount() == null) { // error here
            return Optional.empty();

Hi and sorry for the late reply,

Which version of sonarjava analyzer are you using ?
Could you try to reproduce with the latest version and tell us if the problem persists ?

There is something I am not really understanding in the code snippet you are showing, you show us a property named loanPurpose and the getter is : getLoanAmount which I believe does not correspond to the property you shared.