开发者

Serialization of generic types - GWT

开发者 https://www.devze.com 2022-12-28 14:14 出处:网络
I have an interface like this public interface IField<T> extends IsSerializable { publicString getKey();

I have an interface like this

public interface IField<T> extends IsSerializable {
public  String getKey();
public void setKey(String name);
public T getValue();
public void setValue(T role); }

And a class like this

public class FieldImpl<T> implements IField<T> {
private String key;
public String getKey() {
    return key;
}
public void setKey(String key) {
    this.key = key;
}
public T getValue() {
    return value;
}
public void setValue(T value) {
    this.value = value;
}
private T value;

public FieldImpl() {
}

public FieldImpl(String key, T value) {
super();
this.key = key;
this.value = value;
} }

When I try to compile I'm getting

[ERROR] In order to produce smal开发者_StackOverflowler client-side code, 'Object' is not allowed; please use a more specific type (reached via server.sdk.model.IField)

What is the cause for this? Is there any place I can read about GWT's generics support?


Oops.. the error was due to wrong async service definition

void testMethod( AsyncCallback<IField> callback);

I should not have used raw type here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号