-
Notifications
You must be signed in to change notification settings - Fork 87
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
Generated code for Fragment with generic type gives compilation errors #37
Comments
Generics are not supported yet. Can you also please post the code of the generated Builder class. Thanks! |
Thanks for your prompt response The fragment looks something like this @FragmentWithArgs
public class CustomFragment<V extends Parcelable> extends Fragment {
@Arg
@State // from Icepick; Requires both ValueHolder & V to be Parcelable
ArrayList<ValueHolder<V>> choices;
// a lot more
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FragmentArgs.inject(this);
}
// some more code here
} The container object would look something like this (where I use @ParcelablePlease
public class ValueHolder<V extends Parcelable> implements Parcelable {
ArrayList<ValueHolder<V>> children;
V value;
// Generated parcelleable code
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
ValueHolderParcelablePlease.writeToParcel(this, dest, flags);
}
public static final Creator<ValueHolder> CREATOR = new Creator<ValueHolder>() {
public ValueHolder createFromParcel(Parcel source) {
ValueHolder target = new ValueHolder();
ValueHolderParcelablePlease.readFromParcel(target, source);
return target;
}
public ValueHolder[] newArray(int size) {
return new ValueHolder[size];
}
};
} Please let me know if you need any additional info. |
Thanks, yes generics are simply not implemented. Unfortunately I don't have much time for FragmentArgs nor ParcelablePlease at the moment. So don't expect that I will work in that before February. However, there is a simple workaround: you can define your own |
Sure. I'll use the workarounds for now. Thanks |
Do you have any example of a custom
Where my
But I still got the same issue as when I didn't had any Thank's. |
I have a fragment with generic type. When I build the project, the generated
*Builder
class contains Generic variable, but this variable is not declared in staticnew*Builder
method signatureFor now, I'm manually creating the Fragment with bundle manually for this specific fragment I have. Can you get this issue fixed
PS: Please note that this issue exists with ParcellablePlease aswell if the you have a generic type
The text was updated successfully, but these errors were encountered: