Can I use Gson to serialize method-local classes and anonymous classes?
问题 Example: import com.google.gson.Gson; class GsonDemo { private static class Static {String key = "static";} private class NotStatic {String key = "not static";} void testGson() { Gson gson = new Gson(); System.out.println(gson.toJson(new Static())); // expected = actual: {"key":"static"} System.out.println(gson.toJson(new NotStatic())); // expected = actual: {"key":"not static"} class MethodLocal {String key = "method local";} System.out.println(gson.toJson(new MethodLocal())); // expected: {