objectbox / objectbox/objectbox-java

Adding non-null Kotlin property causes crash when getting existing entity

Open
#589 15 comments 3 reactions 1 assignee View on GitHub

@greenrobot-team is already working on this.

Since Feb 26, 2019.

bug
Dominant language
Java
Stars
4.6k
Forks
311
PR merge metrics
No merged PRs in 30d

Description

Edit: The original issue described below about default values has moved to #157.

This issue is now about correctly detecting not-nullable properties of Kotlin data classes.

Issue Basics

  • ObjectBox version (are using the latest version?): 2.2

I added a new int (not Integer) property into an existing entity. And I found that the new property values for existing record are all null instead of default value (0 in this case), and the the equal query will always return empty result.

box.query().equal( intProperty, 0) -> zero result
box.query().notEqual( intProperty, 0) -> zero result
box.query().isNull( intProperty ) -> non-empty result

Is this considered a bug? Or I should expect null for primitive property

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.