Commit Graph

899 Commits

Author SHA1 Message Date
Jesse Wilson
4c2980e6ff Fix a bug in integer parsing. 2012-08-27 02:34:52 +00:00
Jesse Wilson
c7cb503cdb Restore fast skips.
document            api      ns linear runtime
      TWEETS    GSON_STREAM  397568 =========
      TWEETS      GSON_SKIP  300058 =======
READER_SHORT    GSON_STREAM   76632 =
READER_SHORT      GSON_SKIP   57796 =
 READER_LONG    GSON_STREAM  894690 =====================
 READER_LONG      GSON_SKIP  565114 =============
2012-08-27 01:17:50 +00:00
Jesse Wilson
085856c128 Don't leave the JsonReader in an invalid state if nextInt(), nextDouble() or nextLong() fails. We now save a reference to the string before we parse it, and keep that referenced value if parsing fails. 2012-08-26 22:06:57 +00:00
Jesse Wilson
e7bfd0c97d Promote JsonReader2 to be the main JsonReader implementation. 2012-08-26 19:34:46 +00:00
Jesse Wilson
553fa6b742 Prepare to replace JsonReader with JsonReader2 2012-08-26 19:33:49 +00:00
Jesse Wilson
b96d2d9837 Support non-execute prefixes. 2012-08-26 19:31:06 +00:00
Jesse Wilson
97cb326ad2 Delete an old version of the rewritten JsonReader 2012-08-26 04:04:22 +00:00
Jesse Wilson
46b4346505 Get JsonReader2 to the point that it's passing most tests.
Still missing: 
 - non-execute prefixes
 - rolling back 'pos' when a double fails to parse
 - octal prefix failures
2012-08-26 04:02:09 +00:00
Jesse Wilson
c5c65ba626 Add an experimental rewrite of JsonReader.
The motivating difference is that JsonReaderV2 tries to read each character at most once. This means that when it reads literals, it also attempts to decode them to a keyword (true/false/null) or a number.

This change also _doesn't_ read strings until demanded to do so. This should permit streaming access to strings down the road.

This code is not yet complete, nor is has it been properly optimized. And the implementation is also quite a mess! It is a work in progress.
2012-08-25 04:31:56 +00:00
Jesse Wilson
9c4b23b39a JsonObject.deepCopy() for Gson. 2012-08-21 01:19:43 +00:00
Jesse Wilson
1a4f690335 Regretfully enable serialization for StringMap and LazilyParsedNumber.
One of our favorite users (my employer!) is stuck in a sad situation where they need to serialize objects returned from Gson; this is a workable escape hatch.
2012-08-15 14:58:26 +00:00
Jesse Wilson
35c13173b0 Switch on ints rather than enums in JsonReader.
Using enums was triggering this Android bug:
http://code.google.com/p/android/issues/detail?id=36349
2012-08-14 21:32:18 +00:00
Inderjeet Singh
7d901d34fb Beginning of a simple test related to codegen. 2012-08-02 01:35:45 +00:00
Jesse Wilson
3be354eb76 APT hello world. This generates an empty class for each class annotated @GeneratedTypeAdapter. 2012-08-01 22:58:04 +00:00
Inderjeet Singh
8cc703ed21 Added Gson dependency 2012-08-01 22:09:59 +00:00
Inderjeet Singh
6aad250f47 Initial creation of the codegen project 2012-08-01 22:06:29 +00:00
Inderjeet Singh
42e35e9f90 updated oss-parent version to 7 in gson-extras pom.
fixed some eclipse warnings.
2012-08-01 20:57:51 +00:00
Inderjeet Singh
982c893d65 updated extras pom to latest plugin versions.
updated organization names for Jesse and Inder.
2012-08-01 20:54:37 +00:00
Jesse Wilson
f406d3cf89 Don't fall back when we're already in the slow case. 2012-07-10 23:45:20 +00:00
Jesse Wilson
4aaa4bf20c StringMap was suffering because the string's hashCode was not cached. Address this by preferring the regular String.hashCode until hash collision problems start to occur. 2012-07-10 18:46:01 +00:00
Inderjeet Singh
b36bedb423 Javadocs for 2.2.2 2012-07-03 01:09:24 +00:00
Inderjeet Singh
33de25f9fe [maven-release-plugin] prepare for next development iteration 2012-07-03 00:44:56 +00:00
Inderjeet Singh
66cb689aae [maven-release-plugin] prepare release gson-2.2.2 2012-07-03 00:44:47 +00:00
Inderjeet Singh
f412d7ede2 changed version to 2.2.2-SNAPSHOT 2012-07-03 00:31:00 +00:00
Inderjeet Singh
b946a229b6 deleted unused field. 2012-07-03 00:28:55 +00:00
Jesse Wilson
4816941f0d Address code review comments on r1154 2012-07-02 20:32:38 +00:00
Inderjeet Singh
ae9e63fc54 using ${project.version} in MANIFEST.MF instead of hardcoding version numbers. 2012-07-02 19:20:35 +00:00
Inderjeet Singh
ccaf531b36 Updated version to 2.3 in Export-Package 2012-07-02 19:17:50 +00:00
Inderjeet Singh
6575cdebca When EOF is encountered prematurely, Streams.parse() (and JsonParser) now throw JsonSyntaxException. 2012-07-02 18:36:54 +00:00
Inderjeet Singh
582b0a0c9c Fixed issue 443 by relying on Streams.parse() to return a JsonNull on empty documents and throw a JsonParseException otherwise. 2012-06-30 18:48:11 +00:00
Jesse Wilson
1c7aee40f3 Implement Flushable. 2012-06-30 02:46:26 +00:00
Jesse Wilson
dc4e43bb23 Permit users to define type adapters for primitive types and strings.
Also expose an API to get the field naming strategy.
2012-06-30 02:37:49 +00:00
Inderjeet Singh
c3ada66749 2012-06-27 01:54:31 +00:00
Inderjeet Singh
7b329df351 2.2.1 javadocs 2012-05-11 18:52:43 +00:00
Inderjeet Singh
34a93c4049 [maven-release-plugin] prepare for next development iteration 2012-05-11 18:41:20 +00:00
Inderjeet Singh
ddbd0dff22 [maven-release-plugin] prepare release gson-2.2.1 2012-05-11 18:41:12 +00:00
Inderjeet Singh
90c6b29f4d revised to 2.2.1 2012-05-11 18:39:29 +00:00
Inderjeet Singh
e9b576c456 removed unused import 2012-05-06 07:19:23 +00:00
Inderjeet Singh
96a0fec6a1 Gson 2.2 Javadocs 2012-05-06 04:42:38 +00:00
Inderjeet Singh
61257f9b1c [maven-release-plugin] prepare for next development iteration 2012-05-06 00:31:39 +00:00
Inderjeet Singh
7129115986 [maven-release-plugin] prepare release gson-2.2 2012-05-06 00:30:39 +00:00
Inderjeet Singh
1492dd7d36 Preparing for release: updated export manifest to 2.2 2012-05-05 23:58:44 +00:00
Inderjeet Singh
7a5cef9305 Revised to the new name getDelegateAdapter. 2012-04-14 19:04:14 +00:00
Inderjeet Singh
83e5a4937c Renamed Gson.getNextAdapter to getDelegateAdapter.
Deleted testParameterizedMapSubclassDeserialization which we decided to not fix.
Added simple tests for getDelegateAdapter
2012-04-12 18:49:27 +00:00
Jesse Wilson
392f29e859 Include protected members in Javadoc.
Fixes issue 430.
2012-04-12 18:34:17 +00:00
Jesse Wilson
3df2db1f16 Don't permit a type adapter for String to be registered. 2012-04-12 18:27:48 +00:00
Jesse Wilson
7b61e784c0 Remove testParameterizedMapSubclassDeserialization that never passed. We'll eventually add an equivalent to the extras/ package. 2012-04-12 18:15:56 +00:00
Jesse Wilson
6d351fea07 Fix a documentation typo.
Fixes bug 423.
2012-04-12 18:09:07 +00:00
Jesse Wilson
a991e54157 Make fewer calls to out.write() when serializing strings. On one Android test, this improved serialization time of some documents by 83%.
TWEETS                              
   run          vm htmlSafe   ms linear runtime                    % 
Before app_process     true 68.7 ============================== 100% 
 After app_process     true 35.9 ===============                 52% 


                                  READER_LONG                         
   run          vm htmlSafe    ms linear runtime                    % 
Before app_process     true 439.0 ============================== 100%
 After app_process     true  74.5 =====                           17%
2012-04-12 13:24:37 +00:00
Inderjeet Singh
c890e31bba Simplified pom.xml by deleting plugins that we dont use. 2012-03-26 21:44:29 +00:00