cmelchior / realmfieldnameshelper

Realm extension library used to create more type-safe queries.
Apache License 2.0
173 stars 21 forks source link

Cannot access XxxFields for RealmObjects in other module #15

Closed yshrsmz closed 7 years ago

yshrsmz commented 7 years ago

Realm version: 2.2.2 RealmFieldNamesHelper version: 1.1.0

Say my app is consist of 3 modules. An application module, tv module and common module. the application module is for mobile app, the tv module is for Android TV, and common module has some common classes which are used by both app and tv module. Every module has RealmObjects.

So the problem is, XxxFields classes for RealmObjects from different module(common module) are generated in its module's build directory, but cannot be accessed from other modules.

I know it's not specific to this library, but Realm has support for multi module project, so it would be great if RealmFiledsNameHelper also support multi module project. https://realm.io/docs/java/latest/#sharing-schemas

cmelchior commented 7 years ago

@yshrsmz The code generated by this library will be compiled in as part of that module. So I would be a bit surprised if it doesn't work already? It does depend on the common module being compiled successfully first though.

yshrsmz commented 7 years ago

fmm. Okay, let me check once more

yshrsmz commented 7 years ago

It seems like working for standard RealmObject from another module and I can access generated XxxFilelds classes But when I have following RealmObjects, I found that generated ParentFields only has name field.

// Child is from common module
@RealmClass
class Child implements RealmModel {
  // some field and getter
}

// Parent is in app module
@RealmClass
class Parent implements RealmModel {
  String name;
  Child child;
}
cmelchior commented 7 years ago

Ok. That might be a bug. I'll look into it. Thanks