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

Cannot assign object [] of type class java.util.LinkedList to field public java.util.List #2

Open
kerbymart opened this issue Nov 17, 2017 · 3 comments
Assignees

Comments

@kerbymart
Copy link

Given that we have

@RuntimeRetention
@ReflectionStrategy(keepEverything=true)
public class ParentBean {
    public List<ChildBean> children;
}

and

@RuntimeRetention
@ReflectionStrategy(keepEverything=true)
public class ChildBean {} 

Doing:

List<ChildBean> children = new LinkedList<ChildBean>();
ParentBean parent = new ParentBean();
GwtReflect.fieldSet(Parent.class, "children", parent, children);

Will result into this error:

[ERROR] Alert: Cannot assign object [] of type class java.util.LinkedList to field public java.util.List com.mycompany.ParentBean.children
@kerbymart kerbymart changed the title Cannot cas Cannot assign object [] of type class java.util.LinkedList to field public java.util.List Nov 17, 2017
@kerbymart
Copy link
Author

kerbymart commented Nov 17, 2017

A workaround to this bug is to use LinkedList as field type instead, like:

@RuntimeRetention
@ReflectionStrategy(keepEverything=true)
public class ParentBean {
    public LinkedList<ChildBean> children;
}

@JamesXNelson JamesXNelson self-assigned this Nov 17, 2017
@JamesXNelson
Copy link
Member

@kerbymart did you run GwtReflect.magicClass on ParentBean first?

@JamesXNelson
Copy link
Member

I looked, and the fieldGet/fieldSet methods were not hooked up correctly for flyweight usage, so they currently still require calling magicClass to fill in runtime lookup maps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants