objectbox-java icon indicating copy to clipboard operation
objectbox-java copied to clipboard

kotlin typealias not work in property converter

Open amoikevin opened this issue 11 months ago • 1 comments
trafficstars

Is there an existing issue?

Build info

  • ObjectBox version: [4.0.3]
  • OS: [Android ]
  • Device/ABI/architecture: [arm64-v8a ]

Steps to reproduce

file A.kt:

class A {
     @Convert(converter = BConverter::class, dbType = String::class)
     var b:B?=null
}

class B {
     class Converter...
}

typealias BConverter = B.Converter

Expected behavior

generated ACursor.java:

...
import apple.ios.watches.model.BConverter;
...
private final BConverter bConverter = new BConverter();
...

Actual behavior

generated ACursor.java:

...
import apple.ios.watches.model.B.Converter;
...
private final Converter bConverter = new Converter();
...

Code

Code

Logs, stack traces

Logs

amoikevin avatar Nov 28 '24 04:11 amoikevin

Thanks for reporting!

This currently can not be fixed as the ObjectBox Java generator generates Java code and:

Java has no concept of "type aliases" and can't see them

https://github.com/Kotlin/KEEP/blob/master/proposals/type-aliases.md#use-cases

For anyone else affected or interested, it helps us prioritize issues if you thumbs up the first post (GitHub can sort issues by thumbs ups)!

greenrobot-team avatar Dec 02 '24 08:12 greenrobot-team