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

Allow primitive fields to have @Required annotation #4927

Open
zaki50 opened this issue Jul 6, 2017 · 7 comments
Open

Allow primitive fields to have @Required annotation #4927

zaki50 opened this issue Jul 6, 2017 · 7 comments
Labels
First-Good-Issue First Good Issue - Relatively easy issue for new contributers T-Enhancement

Comments

@zaki50
Copy link
Contributor

zaki50 commented Jul 6, 2017

I got a request from a user.

I think that just ignoring @Required annotation is fine if the field has primitive type.
What do you think? @realm/java

@beeender
Copy link
Contributor

beeender commented Jul 6, 2017

I think so ... do we throw in current release?

@Zhuinden
Copy link
Contributor

Zhuinden commented Jul 6, 2017

I don't see the purpose of it - it's implicitly @Required if it's long instead of Long.

@cmelchior
Copy link
Contributor

cmelchior commented Jul 6, 2017

What @Zhuinden said. What would the use case be for wanting this? That said, allowing it is probably not harmful so 🤷‍♂️

@zaki50
Copy link
Contributor Author

zaki50 commented Jul 6, 2017

I heard the following case.

At first, they defined a field @Required Long id; in a model class .
Then they made a refactoring that contains a change that field to @Required long id; and introduced Dagger.

After that, build failure happened with bunch of Dagger errors.
I guess errors contained Realm's one, but they couldn't find it since they didn't think
that primitive's having @Required is prohibited (I also felt it natural that primitive field is Required).

I didn't have the reason why we didn't accept for primitive fields to have @Required.

What do you think?

@cmelchior
Copy link
Contributor

I would say we accept pull requests :) TBH I don't think it is something we should prioritize.

@cmelchior cmelchior added S:Backlog First-Good-Issue First Good Issue - Relatively easy issue for new contributers T-Enhancement labels Jul 7, 2017
@swayamraina
Copy link

I would love to contribute. Is this still valid?

@Zhuinden
Copy link
Contributor

I think now that both Int? and Int describe this case in Kotlin, and Integer/int in Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-Good-Issue First Good Issue - Relatively easy issue for new contributers T-Enhancement
Projects
None yet
Development

No branches or pull requests

7 participants