Commit Graph

22 Commits

Author SHA1 Message Date
Marcono1234 5187808233
Enable additional Error Prone checks & fix violations (#2561)
* Enable additional Error Prone checks & fix violations

Some of them also enforce additional Google Java Format requirements which
are not handled by google-java-format, such as disallowing wildcard imports.

Not all experimental checks have been listed because some are not applicable,
such as Dependency Injection framework checks, or checks related to Guava's
immutable collections (since Gson's main code does not have a dependency on
Guava).

Other checks have been omitted because they are probably not relevant
(this was a subjective choice), or would require larger refactoring or
would flag issues with the public API, which cannot be changed easily.

* Address review feedback

---------

Co-authored-by: Éamonn McManus <emcmanus@google.com>
2024-01-09 10:19:09 -08:00
Maicol 2c94c757a6
Formats codebase (#2531)
* Formats `.java` files

* Formats `.md` files
2023-11-06 11:59:01 -08:00
Marcono1234 cbad1aa79f
Link to troubleshooting guide from exception messages (#2357)
* Link to troubleshooting guide from exception messages

* Add examples to troubleshooting guide

* Use proper anchor names for troubleshooting guide
2023-04-15 13:36:26 -07:00
Éamonn McManus c1da2d7070
Add `@CanIgnoreReturnValue` as appropriate to Gson methods. (#2369)
This annotation indicates that return value of the annotated method does
not need to be used. If it is _not_ present on a non-void method, and if
Error Prone's `CheckReturnValue` is active, then calling the method
without using the result is an error. However, we are not enabling
`CheckReturnValue` by default here.

Also update some code that does ignore return values, so that the
returned value is used, if only by assigning it to an unused variable.
2023-04-10 10:50:25 -07:00
Maicol 49b00d1a86
Port all Junit assert to Truth asserts (#2304)
* Port Junit assert to Truth in `com.google.gson.stream`

* Port Junit assert to Truth in `com.google.gson.regression`

* Port Junit assert to Truth in `om.google.gson.reflect`

* Port Junit assert to Truth in `com.google.gson.metrics`

* Port Junit assert to Truth in `com.google.gson.internal`

* Port Junit assert to Truth in `com.google.gson.internal.sql`

* Port Junit assert to Truth in `com.google.gson.internal.reflect`

* Port Junit assert to Truth in `com.google.gson.internal.bind`

* Port Junit assert to Truth in `com.google.gson.internal.bind.util`

* Port Junit assert to Truth in `com.google.gson.functional`

* Replaces `List.of` with `Arrays.asList` to grant legacy

* Simplify `==` asserts

* Simplify `.contain()` asserts + Minor fixes

* Simplify asserts
2023-01-31 11:20:54 -08:00
Maicol 1a2170b99c
Port tests from JUnit 3 to JUnit 4 (#2294)
* Port tests from JUnit 3 to JUnit 4

* Port tests from JUnit 3 to JUnit 4

* Add `@Test` above `@Ignore`
2022-12-22 06:04:16 -08:00
Snowhite dd6635dc61
Making consistent prefixs in PerformanceTest (#1760)
* Making consistent prefixs in PerformanceTest

change some "disable_" to "disabled_"

* Update PerformanceTest.java
2022-10-29 10:15:43 +02:00
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Lorenz Nickel b75e1bbc79 Code cleanup (Removed spaces) (#1474)
* Removed double spaces in comments

* Unified comments

* Removed space

* Removed spaces in code
2019-03-03 11:18:06 -08: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 389f918bb8 Add new performance test for large objects (many fields). 2010-05-19 21:29:58 +00:00
Inderjeet Singh fff9147988 Added some tests to measure serialization and deserialization performance of Gson based on the discussion in http://groups.google.com/group/google-gson/browse_thread/thread/7a50b17a390dfaeb
Surprising just marking a field as exposed halves the performance.
2009-10-20 00:04:34 +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 cbcf7defa3 Updated Grammar for matching JsonArray to be left-associative rather than right-associative. Gson can now parse arrays of size over 11MB instead of 80KB which was the prior limit. Thanks for the tip, kenotron. 2009-08-22 01:03:27 +00:00
Inderjeet Singh d8095c72fd minor improvements to the test 2009-07-14 01:08:04 +00:00
Inderjeet Singh eac1beacc9 Added performance tests for byte array serialization and deserialization. 2009-07-13 22:27:55 +00:00
Inderjeet Singh 18005bbae1 using consistent method name prefixes. 2009-03-03 22:37:26 +00:00
Inderjeet Singh 2c25fdd850 Added a test to measure performance of Gson on large collections. Gson's parser handled a collection of 1.4 million objects for serialization. For deserialization, the numbers were lower and Gson parser gave a stack overflow beyond a collection of 87,000 objects. 2009-03-03 22:20:59 +00:00
Joel Leitch e101ed1623 Adding the JavaDoc for Google Gson version 1.2.3 2008-11-15 17:38:06 +00:00
Inderjeet Singh 4d73459b7e moved performance tests under the metrics package and replaced the invalid JSON
string with \n with a valid one.
2008-10-10 23:22:27 +00:00