objectbox / objectbox/objectbox-java

Cursor class generation name conflict

Open
#715 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

not sure about this
Dominant language
Java
Stars
4.6k
Forks
311
PR merge metrics
No merged PRs in 30d

Description

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;

.....
}
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated TradingSessionCursor.put(TradingSession entity) shown in the issue and trace the cursor-generation entry point that produces it. Reproduce the case using the Entity backlink and TradingSession ToOne property, then verify that the generated cursor compiles without a parameter/local-variable name conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.