objectbox-java
objectbox-java copied to clipboard
Cursor class generation name conflict
Issue Basics
- ObjectBox version 2.3.4
- Reproducibility: allways
Reproducing the bug
Description
Add a ToMany property with a backlink to a property named "entity" in another class. When the cursor is generating, a variable name conflict occurs since the generated parameter for the put method in the cursor is also called "entity".
Code
An @Entity with ToMany link
class Entity {
...
@Backlink(to="entity")
private ToMany<TradingSession> tradingSessions;
}
The TradingSession Entiy has the ToOne link.
class TradingSession{
...
ToOne<Entity> entity;
}
The conflict occurs in the Cursor generated code.
TradingSessionCursor
{
....
@Override
public final long put(TradingSession entity) {
ToOne<Entity> entity = entity.entity;
.....
}
}
Thanks for reporting. However, not sure we should change this (e.g. replace entity -> arg0 or something) because it would make the generated code harder to read.
Typically one avoids naming classes similar to names used in an API (here the @Entity annotation) so this should not be that big of an issue.
-Uwe