views:

6

answers:

0

Basically as above.

Gson gson = new Gson();
ErrorsDocument er = ErrorsDocument.Factory.newInstance();
er.setError("monkey escaped");
System.out.println(gson.toJson(er));

craps out with:

Exception in thread "main" java.lang.IllegalStateException: How can the type variable not be present in the class declaration! at com.google.gson.TypeInfoFactory.getIndex(TypeInfoFactory.java:127) at com.google.gson.TypeInfoFactory.getActualType(TypeInfoFactory.java:93) at com.google.gson.TypeInfoFactory.getTypeInfoForField(TypeInfoFactory.java:54)

etc