Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String based parser: Linking objects not working on classes named starting by class_ #4480

Closed
sync-by-unito bot opened this issue Mar 2, 2021 · 7 comments · Fixed by #4508
Closed
Assignees

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented Mar 2, 2021

Linking objects not working on classes which name starts by class_. This can be triggered on Realm-Java by

  • directly setting an inner name;
  • or setting LOWER_CASE_WITH_UNDERSCORES naming policy on a class whose name starts by Class

Trying query links on these classes would result in that the table can not be resolved:

"No property 'with_underscores' found in type 'with_policy' which links to type 'class_with_policy'"

It can be seen in the error with_policy should be class_with_policy.

Example:

Query

"parents.pascal_case = $0" $0 = 1

Class

@RealmClass(fieldNamingPolicy = RealmNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
public class ClassWithPolicy extends RealmObject {

    public static final String CLASS_NAME = "class_with_policy";
    public static final String FIELD_CAMEL_CASE = "camel_case";
    public static final String FIELD_PASCAL_CASE = "pascal_case";
    public static final String FIELD_M_HUNGARIAN = "hungarian";
    public static final String FIELD_ALLCAPS = "allcaps";
    public static final String FIELD_ALLLOWER = "alllower";
    public static final String FIELD_FIRST_CAPS = "first_caps";
    public static final String FIELD_WITH_UNDERSCORES = "with_underscores";
    public static final String FIELD_WITH_SPECIAL_CHARS = "internal_var";
    public static final String FIELD_CUSTOM_NAME = "a different name";
    public static final List<String> ALL_FIELDS = Arrays.asList(
            FIELD_CAMEL_CASE,
            FIELD_PASCAL_CASE,
            FIELD_M_HUNGARIAN,
            FIELD_ALLCAPS,
            FIELD_ALLLOWER,
            FIELD_FIRST_CAPS,
            FIELD_WITH_UNDERSCORES,
            FIELD_WITH_SPECIAL_CHARS,
            FIELD_CUSTOM_NAME
    );

    public String camelCase;
    public int PascalCase;
    public boolean mHungarian;
    public byte[] ALLCAPS;
    public Date alllower;
    public long FIRSTCaps;
    public ClassWithPolicy with_underscores;
    public RealmList<ClassWithPolicy> $_internalVar;
    @RealmField(name = "a different name")
    public String customName;

    @LinkingObjects("with_underscores")
    public final RealmResults<ClassWithPolicy> parents = null;
}
@sync-by-unito
Copy link
Author

sync-by-unito bot commented Mar 3, 2021

➤ Jørgen Edelbo commented:

I can't figure out what this will translate into in Core terms. [~clemente.tort], can you provide a realm file based on this schema?

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Mar 9, 2021

➤ Clemente Tort Barbero commented:

[~jorgen.edelbo] here it is:  [^default.realm]

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Mar 9, 2021

➤ Clemente Tort Barbero commented:

I believe the issue is related to KeyPathMapping. We populate it using keypath_helpers.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Mar 9, 2021

➤ Jørgen Edelbo commented:

[~clemente.tort] What would be the actual mappings you would supply here?

@jedelbo
Copy link
Contributor

jedelbo commented Mar 9, 2021

I tried to reproduce error here #4508 but did not succeed. @clementetb can you see where I am mistaken?

@jedelbo jedelbo mentioned this issue Mar 11, 2021
2 tasks
@jedelbo
Copy link
Contributor

jedelbo commented Mar 11, 2021

At least I have now identified the root cause.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Mar 15, 2021

➤ Clemente Tort Barbero commented:

Changing status to investigate after the debug session we had.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant