Skip to content

Lists Of Primitives for Kotlin-types (String, Int etc.) #5594

@hardysim

Description

@hardysim

Goal

I want to use the new Lists Of Primitives-Feature with Kotlin.
So it needs to support Kotlin-types as well (e.g. kotlin.String instead of only java.lang.String).

See https://realm.io/docs/java/latest/#lists-of-primitives
Refs #5031 (comment)

Expected Results

A RealmList with a Kotlin-type should be possible.

open class Foo(
        var bar: RealmList<kotlin.String>? = null
) : RealmObject()

Actual Results

The compiler gives the following error:

Error:Element type of RealmList must be a class implementing 'RealmModel' or one of the 'java.lang.String', 'byte[]', 'java.lang.Boolean', 'java.lang.Long', 'java.lang.Integer', 'java.lang.Short', 'java.lang.Byte', 'java.lang.Double', 'java.lang.Float', 'java.util.Date'.

Using RealmList<java.lang.String> produces the same error.

Steps & Code to Reproduce

Just create a new Kotlin-class with the code above and try to compile.

Code Sample

See code above

Version of Realm and tooling

Realm version(s): 4.2.0 / 4.3.0

Realm sync feature enabled: no

Android Studio version: 3.0.1

Which Android version and device: 8.1 beta (but doesn't matter)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions