Commit Graph

226 Commits

Author SHA1 Message Date
Inderjeet Singh
0e5f6704cd Added sonatype oss as parent for the pom. Diabled repository management with-in POM per instructions at: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide 2011-01-10 22:47:36 +00:00
Inderjeet Singh
8380d28e6f removed compiler warnings 2010-12-06 19:47:41 +00:00
Jesse Wilson
883ce465d5 Second half of adopting Guice's types code.
This removes a bunch of unnecessary public APIs and looks more like the GSON code that existed before this whole exercise. We no longer use TypeToken.isAssignable. I wrote a test that demonstrates at least one problem with that method, so I've deprecated it. We should be able to remove it release-after-next; nobody should be using this method anyway.

There are still some things that are public that shouldn't be. In particular there's some APIs in Types that are needed by TypeToken, which is unfortunately in a different package. Traditionally the fix is to create an 'internal' package and make the shared code public in the internal package. I'm not sure what we want to do for GSON; we could also use reflection (yuck) or duplicate the code (yuck).
2010-12-03 18:12:26 +00:00
Jesse Wilson
d1ddab2e6f Swap out GSON's type mechanics with the Type resolution code from Guice.
The most significant impact of this change is that fields whose types are type parameters should now GSONify just fine. For example, consider the class below.

abstract class Foo<A, B> {
   A a;
   B b;
   List<A> list;
   Map<A, List<B>> map;
}
class RealFoo extends Foo<String, Integer> {...}

This is a reasonable checkpoint but some work still needs to be done for this. In particular, the level of visibility of methods in TypeToken and Type should be reconsidered; we're exposing more than we need to!
2010-12-03 08:07:13 +00:00
Inderjeet Singh
d87eed510b Fixed compilation problem since we dropped registerTypeHierarchyAdapter method 2010-11-24 23:14:30 +00:00
Inderjeet Singh
98ff894863 removed unnecessary else clause. 2010-11-22 23:14:51 +00:00
Joel Leitch
56344cf067 Remove duplicate test. 2010-11-16 22:18:28 +00:00
Joel Leitch
0a3f5fa801 Required strings to be quoted even in lenient mode.
As far as Inderjeet and I can tell, this is consistent with Gson 1.5.
2010-11-16 22:14:40 +00:00
Inderjeet Singh
279649986e Added a test to ensure that Gson handles repeated invocation of itself correctly.
Revised proto maven configuration to use Gson 1.6
2010-11-15 22:56:01 +00:00
Inderjeet Singh
eac1505670 Removed eclipse warnings about unneeded else statements and rawtypes/unchecked access. 2010-11-11 07:29:55 +00:00
Joel Leitch
32afd1a4e4 Fixing parsing of unquoted strings to be (somewhat) consistent with previous versions of Gson. The difference with this version is that Gson will throw a more specific exception rather than JsonParseException. 2010-11-10 02:02:57 +00:00
Jesse Wilson
103edb9c36 Don't return null on an unexpected EOF unless the document is empty. This brings us back to compatibility with GSON 1.5. 2010-11-08 19:16:05 +00:00
Joel Leitch
6a951b427e Adding new tests (two of which are disabled, but prepping for 1.7). 2010-11-05 22:57:44 +00:00
Inderjeet Singh
7b99419aea Removed compiler warnings. 2010-11-03 23:14:42 +00:00
Inderjeet Singh
83539c534c removed compiler warnings.
Added default serial version id for MalformedJsonException.
2010-11-03 13:28:09 +00:00
Inderjeet Singh
82a1a9511e removed a System.out.println from a test. 2010-11-03 01:25:57 +00:00
Inderjeet Singh
200bccef21 Added tests for issue 249 2010-11-03 00:15:03 +00:00
Joel Leitch
c6a4f55d1a Fix for Issue #40. 2010-11-02 03:32:39 +00:00
Jesse Wilson
dea7ab89fe Restore pretty printing. The pretty printing format isn't as compact as the previous format - for example arrays of integers are printed one-per-line, whereas the previous format compacted these to all sit on the same line. 2010-11-01 23:03:41 +00:00
Inderjeet Singh
43f2a0012b Removed JavaCC parser definition and its generated classes. 2010-11-01 22:57:39 +00:00
Jesse Wilson
20d895ff95 Fix primitive wrapping and casting.
Issue: 235
2010-11-01 22:36:30 +00:00
Joel Leitch
d0977c2e3a Exposing the declaring class for the field wrapped by FieldAttributes. 2010-11-01 22:31:48 +00:00
Inderjeet Singh
d3eda04f33 Added support for deserializing from null input to a null value.
Added toString() method to ObjectTypePair.
2010-10-22 16:06:59 +00:00
Inderjeet Singh
2b1f3eec15 Removed a bunch of unused code and unnecessary else statements. 2010-09-28 13:42:43 +00:00
Jesse Wilson
4c53c0640e Exhaustive test coverage for mixed streaming & binding. 2010-09-03 07:24:59 +00:00
Jesse Wilson
4e28bf3a39 Check in a passing test for issue 204. 2010-09-03 06:44:41 +00:00
Jesse Wilson
202bbfeef0 Fixing the Java 1.5 build. 2010-09-02 09:29:26 +00:00
Jesse Wilson
747e3c3051 Support mixed streaming and databinding with new APIs. 2010-09-02 00:15:23 +00:00
Jesse Wilson
ffdf0e7012 Fix some test problems.
JsonWriter was using suboptimal escape characters for newlines etc: unicode escapes rather than \x escapes.

JsonObjectTest was banning empty and whitespace-only keys. These values are permitted as of r585.
2010-09-02 00:10:26 +00:00
Jesse Wilson
78d1011ec5 Test escaping HTML characters! 2010-09-02 00:03:18 +00:00
Jesse Wilson
486820f515 Fix some test problems.
JsonWriter was using suboptimal escape characters for newlines etc: unicode escapes rather than \x escapes.

JsonObjectTest was banning empty and whitespace-only keys. These values are permitted as of r585.
2010-08-28 08:18:13 +00:00
Jesse Wilson
7e1e4eab07 Remove the constraint that map keys mustn't be the empty string.
See bug 227.
2010-08-28 05:02:33 +00:00
Jesse Wilson
69ecb9465a Test case demonstrating that issue 212 is fixed. We got comment parsing support for free when we switched to JsonReader. 2010-08-27 07:33:33 +00:00
Jesse Wilson
d5741b321f Don't exclude enum constants, even if they are anonymous.
See issue 226.
2010-08-27 07:26:35 +00:00
Jesse Wilson
eb7b1e4ac7 Test attempting (and failing) to reproduce issue 215. 2010-08-27 07:10:00 +00:00
Jesse Wilson
7a7bbf754c Use JsonReader internally rather than JsonParserJavacc.
For raw parsing (ie. new JsonParser().parse()) the parse time has improved substantially. For example, JsonParserJavacc parsed my 48KiB buzz feed in 4.8ms. JsonReader parses the same feed in 0.9ms.

http://microbenchmarks.appspot.com/run/limpbizkit@gmail.com/com.google.gson.GsonBenchmark/430001
2010-08-27 05:59:18 +00:00
Jesse Wilson
765a9f1ecd Brand new classes for streaming JSON efficiently.
Notable features:
 - Efficiency. The parser is faster than the current javacc parser. It's also faster than popular libraries for JSON streaming.
 - Toggle lenient/strict
 - Toggle pretty/compact
 - Friendly error messages on bad JSON
 - GSON-quality Javadoc
 - Non-execute prefix handling

This doesn't wire JsonReader up into Gson just yet. That's coming soon...
2010-08-26 08:44:02 +00:00
Joel Leitch
3fc4bcc061 Minor test fixes. Explicitly fail test if the expected exception was not thrown. 2010-08-21 03:19:17 +00:00
Inderjeet Singh
de0f8da151 replaced unchecked suppressed warnings token with more specific rawtypes.
removed unused imports.
2010-08-20 16:27:46 +00:00
Inderjeet Singh
ed838ec104 replaced unchecked suppressed warnings token with more specific rawtypes 2010-08-20 16:20:37 +00:00
Jesse Wilson
bc5b836103 Test demonstrating a bug reported in issue 182, wherein malformed JSON is emitted when an property name contains a double-quote. 2010-08-20 05:45:51 +00:00
Jesse Wilson
8b5cc3256d Test demonstrating a bug reported in issue 178, wherein malformed JSON is emitted when a map key contains a double-quote. 2010-08-20 05:43:17 +00:00
Inderjeet Singh
dc60cb1931 Made FieldNamingStrategy2 is package protected class.
Made type hierarchy adapter registration package protected.
Marked some of the classes final.
Minor changes in the performance tests.
2010-08-19 00:10:42 +00:00
Joel Leitch
89c18452ae Ensure date with pattern is not override with the "default" date type adapter when a custom JsonSerializer/JsonDeserializer is registered. 2010-08-18 23:58:52 +00:00
Inderjeet Singh
c3f61ee5ad Added a test to reproduce bug described in http://groups.google.com/group/google-gson/browse_thread/thread/9591c539e3c19d59
Seems like an invalid bug report as Gson can deserialize primitive values in Integer fields.
2010-07-19 23:32:24 +00:00
Inderjeet Singh
b2af57d288 Added checks to ensure that typeHierarchyAdapter being registered doesn't hide a previously existing one.
Fixed a bug where registerIfAbsent was adding type adapters in the reverse order of priority.
Added toString() to Pair.
2010-06-24 21:51:18 +00:00
Inderjeet Singh
8aedbc84db Added a new GsonBuilder option to register a type adapter for a type hierarchy instead of a single type.
Upgraded Gson version to 1.5 since a new API call is being added.
2010-06-21 23:26:06 +00:00
Joel Leitch
9cd72ca7fb Add new tests with SerializedName annotation that contains a space in the name. 2010-05-28 02:13:11 +00:00
Joel Leitch
ba0154867d Add support to allow spaces in the JSON field name. 2010-05-26 17:40:19 +00:00
Joel Leitch
389f918bb8 Add new performance test for large objects (many fields). 2010-05-19 21:29:58 +00:00