I've tried several things, first I used a Collection, which resulted in the following exception:
Caused by: java.lang.IllegalArgumentException: abstract class or interface not allowed : interface java.util.Collection
at org.json.rpc.commons.GsonTypeChecker.isValidType(GsonTypeChecker.java:75)
at org.json.rpc.commons.GsonTypeChecker.isValidType(GsonTypeChecker.java:128)
Then I thought if I used a concrete class, it would fix that, but alas, the following exception is thrown:
Caused by: java.lang.IllegalArgumentException: parametrized classes not allowed : class java.util.ArrayList
at org.json.rpc.commons.GsonTypeChecker.isValidType(GsonTypeChecker.java:82)
at org.json.rpc.commons.GsonTypeChecker.isValidType(GsonTypeChecker.java:128)
So what's a parametrized class? Well that's to do with Java Generics, the ArrayList I had was actually something like an ArrayList
It looks like all of the Java collections now are parametrized, so using them will not work. The only thing I found that would work was to send an array of my objects instead. This is a bit messy since it means I have to allocate my array on the server side with a known size, with a collection I was just using lazy loading, which saved me some hassle.
So to sum up, my object that was being returned to the client had to change from this:
public class MyClass {
private List<MyOtherClass> otherClass;
public MyClass() {}
...
}
to this:
public class MyClass {
private MyOtherClass[] otherClass;
public MyClass() {}
...
}
-i