Commit Graph

18 Commits

Author SHA1 Message Date
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Jake Wharton 9414b9b3b6 Add static factories for array and parameterized type tokens.
These are useful when creating TypeAdapterFactories that delegate to others with more complex types. They also are useful when writing dynamic code that deals with types that cannot be fully reified using the normal subclass technique.
2016-08-12 12:11:57 -04:00
Jesse Wilson f777a192ee Remove dead code and fold contents of single-member helper classes into their clients. 2011-11-20 21:02:26 +00:00
Inderjeet Singh 31964507c1 Updated SuppressWarnings annotations to Eclipse 3.6/3.7 which is unfortunately incompatible with Eclipse 3.5 (rawtypes vs unchecked)
This CL eliminates all eclipse warnings.
2011-10-20 21:32:46 +00:00
Inderjeet Singh c8bd121db2 Renamed $Preconditions to $Gson$Preconditions and $Types to $Gson$Types.
Marked the two private classes in $Types as final.
2011-04-06 00:26:57 +00:00
Jesse Wilson 4efb133b4a bling bling
Prefix internal classes with $ to prevent them from interfering with IDE's auto import functionality.
2011-03-29 21:24:26 +00:00
Joel Leitch 5e74dabad9 Re-use Preconditions instead of re-writing them here. 2011-03-29 21:18:27 +00:00
Joel Leitch 861e047a62 Create an "internals" package for classes that we do not want to share, but is needed across multiple pacakges.
As well, move non-Gson specific classes, such as Preconditions, to this new "internals" package.
2011-03-21 22:30:35 +00:00
Jesse Wilson ef7bd4c999 Don't document an API that we don't offer! 2011-03-14 21:50:14 +00:00
Inderjeet Singh 52288d7127 rawtypes -> unchecked
Fixed spurious eclipse warnings on deprecation, missing classes or parameters, etc.
2011-02-24 22:47:55 +00:00
Inderjeet Singh edc71130c4 removed unneeded suppression of warnings. 2011-01-19 07:34:44 +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 3b0f8f4340 Removed all the JDK warnings about unused fields in test classes or unused constructors for use by Gson or instanceof calls on parameterized types. 2009-09-23 17:45:16 +00:00
Joel Leitch 18b301dfeb - Serializing of Object arrays.
- Fixed incorrect warning
2009-09-22 19:04:27 +00:00
Inderjeet Singh 82771f006c removed Java 1.5 warnings 2009-08-31 17:51:47 +00:00
Inderjeet Singh 57d1f32de5 moved gson as a project under trunk 2008-09-01 03:13:32 +00:00