# Java squid:S2583 with kotlin nullable object

**URL:** <https://community.sonarsource.com/t/java-squid-s2583-with-kotlin-nullable-object/3650>\
**Category:** Report False-positive / False-negative...\
**Tags:** kotlin, java\
**Created:** [October 24, 2018, 9:21pm UTC](https://community.sonarsource.com/t/java-squid-s2583-with-kotlin-nullable-object/3650 "2018-10-24T21:21:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Thrailkill](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@Tyler\_Thrailkill](https://community.sonarsource.com/u/Tyler_Thrailkill)\
**Post date:** [October 24, 2018, 9:21pm UTC](https://community.sonarsource.com/t/java-squid-s2583-with-kotlin-nullable-object/3650/1 "2018-10-24T21:21:35Z")

</div>

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

SonarQube Version: 6.7.5.38563  
SonarAnalyzer (Java)

```auto
data class OnlineSalesDetailsView(
        ...
        val loanPurpose: LoanPurpose?,
        ...
)

```

```java
        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();
        }

```

 ![01](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/1/18e4a6710ac34afbd13eab668181aad25653d38f.png)

---

<div class="post-metadata">

**Author:** ![Nicolas\_Peru](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nicolas_peru/32/22_2.png) [@Nicolas\_Peru](https://community.sonarsource.com/u/Nicolas_Peru)\
**Post date:** [July 10, 2019, 12:27pm UTC](https://community.sonarsource.com/t/java-squid-s2583-with-kotlin-nullable-object/3650/2 "2019-07-10T12:27:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Margarita\_Nedzelska](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/margarita_nedzelska/32/47493_2.png) [@Margarita\_Nedzelska](https://community.sonarsource.com/u/Margarita_Nedzelska)\
**Post date:** [April 26, 2021, 10:16am UTC](https://community.sonarsource.com/t/java-squid-s2583-with-kotlin-nullable-object/3650/3 "2021-04-26T10:16:04Z")

</div>


