-
Notifications
You must be signed in to change notification settings - Fork 273
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
No ability to suppress reflection required messages #45
Comments
A couple of things come to mind: First, if you want Parceler only to ignore certain fields you can use the Parceler specific Second, not sure if you want this, but if you have getters/setters for your bean's properties, you can use either the Other than that I could see about adding a |
A |
I'm a little curious about your gson/parceler model, can you share an example of what you are needing from gson/parcler, particularly around your private data? To reiterate |
I misunderstood what I want to be able to suppress the warning about reflection because I've I could potentially use package level access in my use case but I'd rather
|
Ok, for these private fields, do you have non-private getters and/or setters? |
Hmm, yes, and I think I see what you're getting at. I think my confusion comes from the fact that I have some static classes within a class that are only meant to be used within the context of that outer class, and as such have Unless I am understanding incorrectly, applying Also, thank you for patiently talking through this with me. 😄 Here's a gist of one of the classes that was spitting errors, but isn't now that I've applied the annotations as suggested. I'm yet to test to see what happens. |
I've since had time to test the implications of Once added to an intent with Perhaps it is because there are only getters and no setters? The objects are meant to be immutable you see, hence the builder pattern demonstrated in the gist. |
Thought I'd share that you can mute annotaion processor (Parceler) warnings via -Xlint:-processing. |
@bbqsrc, I think I'm not going to move forward with the As always, let me know if you need anything else. |
Please provide an example for how i can use @ParcelProperty(String value) when i have private filed |
@Parcel
public class PrivateFieldExample{
@ParcelProperty("value")
private String exampleValue;
} |
Thank you for speed response, But i'm still have warnings.
} Warning:(22, 20) Parceler: Reflection is required to modify private field: String aboutUsAr, consider using non-private. |
Oh, that's not what you were asking... I'd seriously consider making your fields non-private as this will significantly slow down marshaling. If you can't and you find the warnings annoying, you could add the |
Sorry, i thought that was for warnings. |
@johncarl81 I am still not clear about how to ignore this warning. I tried
|
@ibrahim132 try this.
There won't be any warnings. |
How to avoid warnings for Singleton classes were the constructor is private. Please help. |
You could use a factory method, I guess. |
FYI, Serializing and deserializing a "singleton" will mean it has a copy, and thus not a Singleton anymore. |
Yeah, I was just looking a way to avoid the warnings. Thanks, @johncarl81. |
I am already using
transient
on static fields, but I am using@Parcel
on a class that I am also using with GSON for serialisation, so I can't add transient to the private fields as that has a different meaning in GSON (it will not serialise the field).I am using the
private
access level by design, so I want to be able to suppress this warning. Could you advise me how to do this?The text was updated successfully, but these errors were encountered: