Commit Graph

20 Commits

Author SHA1 Message Date
Marcono1234 08174e2019
Perform minor code clean-up (#2544)
* Perform minor code clean-up

Notable changes:
- Replace most usages of `<code>` with `{@code ...}` in Javadoc
- Add proper summary sentence to `GsonBuilder.enableComplexMapKeySerialization`
- Extend documentation for `GsonBuilder.setDateFormat` methods
- Fix `TypeToken.isAssignableFrom(Type)` throwing AssertionError in some cases
  Maybe the method should not throw an exception in the first place, but it
  might not matter much since it is deprecated already anyway.
- Remove outdated `throws NumberFormatException` from internal
  `JsonReader.nextQuotedValue`; the behavior had been changed by
  85ebaf7c35
- Fix incorrect documentation on JsonScope fields
- Fix unit tests having 'expected' and 'actual' switched
- Use dedicated Truth methods instead of `isTrue()` / `isFalse()`
- Use common helper methods in JsonWriterTest to avoid duplication

* Implement `toString()` for ReflectionAccessFilter constants

* Address most of the review comments

* Add comment about `source.scm.tag=HEAD` warning

Actually it looks like the warning is not actually caused by usage of
`HEAD` as value, but rather because the project has a snapshot version
during development (which is expected though), see
https://github.com/apache/maven-artifact-plugin/blob/maven-artifact-plugin-3.5.0/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java#L140

But this is not a problem either since during release a non-snapshot
version is used.
2023-11-19 09:01:19 -08:00
Marcono1234 ecb9f8c8ad
Adjust ProGuard default rules and shrinking tests (#2420)
* Adjust ProGuard default rules and shrinking tests

* Adjust comment

* Add shrinking test for class without no-args constructor; improve docs

* Improve Unsafe mention in Troubleshooting Guide

* Improve comment for `-if class *`
2023-07-24 07:34:02 -07:00
Marcono1234 43396e45fd
Add ProGuard / R8 integration tests & add default ProGuard rules (#2397)
* Add code shrinking tools integration test

* Keep no-args constructor of classes usable with JsonAdapter

* Add library ProGuard rules for Gson

They are automatically applied for all users of Gson, see
https://developer.android.com/build/shrink-code#configuration-files

* Skip japicmp-maven-plugin for shrinker-test

* Add more tests for JsonAdapter, add tests for generic classes

* Extend default constructor test

* Add Troubleshooting Guide entry for TypeToken
2023-05-28 12:24:05 -07:00
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Marcono1234 82fed02fba
Mention R8 FAQ in Android example (#2075) 2022-02-11 11:06:14 -08:00
Marcono1234 abd2191b0e
Add READMEs to Maven modules (#2039)
* Add READMEs to Maven modules

* Address feedback
2021-12-27 10:17:41 -08:00
Christoffer Quist Adamsen d3a75cb569 Retain generic signature of TypeToken with R8 version 3.0 and higher 2021-08-05 09:18:32 +02:00
Marius Volkhart ceae88bd66
Update proguard.cfg (#1693)
TypeAdapter is an abstract class, and R8 warns about this during the build.
2020-05-13 12:49:59 -07:00
hqzxzwb d6e6a01f02 Keep `TypeAdapter`s from being stripped (#1546) 2019-10-03 15:50:21 -07:00
donaldchai 49d8630978 Update sample ProGuard config to mark fields instead of all members. (#1531)
GSON only needs to reflect based on fields:
4d942db168/gson/src/main/java/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java (L152)

There's no reason to disallow optimizing methods.
2019-05-08 23:23:54 -07:00
Farid Forootan Shad f426700bc4 update proguard to fix R8 compatibility issue (#1527)
https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#member-in-a-data-object-is-always
2019-05-07 15:18:59 -07:00
Lyubomyr Shaydariv bdea5b9e99 Removed the executable flag from clearly text files 2018-04-26 10:23:15 +03:00
Warren Smith 9f8ace9ac4 Dont warn on sun.misc package. 2017-09-15 08:18:32 -07:00
Chaitanya Pramod 74f4f74b8b Prevent Proguard from stripping interface info from @JsonAdapter classes
Previously after Proguard, the classes would no longer implement the interfaces, leading to `JsonAdapterAnnotationTypeAdapterFactory` throwing.

Fixes #925
2016-09-14 18:57:35 +05:30
Marcelo Camargo bddc1a9ed3 Fixed code style to remove explicit casting op.
· Separated binary operators
2016-02-14 03:47:05 -02:00
inder123 8cf538169c Updated proguard.cfg example to Gson only settings
Fixed https://github.com/google/gson/issues/713
2015-10-18 10:21:32 -07:00
Jesse Wilson bb92447317 Retain annotations when using proguard + gson. From patch on issue 358.
Fixes issue 358.
2011-12-16 05:18:01 +00:00
Inderjeet Singh f127398ad1 Made the proguard example work by using -keepattributes Signature (as advised in https://sourceforge.net/tracker/?func=detail&aid=3375947&group_id=54750&atid=474704) 2011-07-25 06:23:02 +00:00
Inderjeet Singh a85807818f Invoking Gson toJson and fromJson with-in the Android application.
Gson.fromJson does not currently work in this application with proguard enabled: The reason seems to be that Cart's field List<LineItem> gets rewritten as raw List type.
2011-07-23 01:08:34 +00:00
Inderjeet Singh ea4cfcd4b9 initial cut at an example Android application that uses Proguard with Gson 2011-07-22 20:55:37 +00:00