objectbox-java
objectbox-java copied to clipboard
Support entity classes that are inner classes
Describe the bug
Placing entity classes annotated with @Entity
and @BaseEntity
in another class will result in an error when building.
Basic info (please complete the following information):
- ObjectBox version: 2.9.1
- Reproducibility: always
- Device: N/A (compile time error)
- OS: N/A (Android library)
To Reproduce Steps to reproduce the behavior: 1. Create the following hierarchy of classes and build
public class Holder {
@BaseEntity
public static abstract class Parent {
@Id
long boxId;
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
@Entity
public static class Child extends Parent {
}
}
Logs, stack traces Won't provide because this won't help in any way as IDE's build errors will be much clearer when dev-team build it themselves
Thanks for reporting! This is due to generated code missing imports of the inner class (error: cannot find symbol
).
A workaround is to make at least the @Entity
class a top-level class.
(An internal issue exists.)