Commit Graph

16 Commits

Author SHA1 Message Date
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Marcono1234 49ddab9eeb
Add CodeQL GitHub code scanning workflow (#2076)
* Add CodeQL GitHub code scanning workflow

* Only compile main sources for code scanning

* Move test .proto  files to test sources

`annotations.proto` also seems to be only relevant for tests because the test
explicitly registers them as extensions. By default the Proto adapter does not
consider them.

* Address some code scanning findings

* Fix some more findings
2022-02-17 18:40:40 -08:00
Marcono1234 e6fae590cf
Prevent Java deserialization of internal classes (#1991)
Adversaries might be able to forge data which can be abused for DoS attacks.
These classes are already writing a replacement JDK object during serialization
for a long time, so this change should not cause any issues.
2021-10-13 10:14:57 -07:00
Jake Wharton 7a1c94f986 Remove synthetic accessors from being generated. 2015-12-27 01:39:19 -05:00
Inderjeet Singh 14ba59fa88 code review fixes. Moved getFirstArgument() method from $Gson$Types to GsonTypesTest. 2014-05-19 17:34:25 +00:00
Joel Leitch f29d5bc37b Create a LinkedTreeMap based on the LinkedHashTreeMap; however, removed all the hashing from it as resorted to a single tree. The insertion order is still preserved. 2013-05-03 16:11:16 +00:00
Joel Leitch af6aa5f782 Use the LinkedHashTreeMap instead of LinkedTreeMap and delete the LinkedTreeMap version. 2013-04-04 21:31:23 +00:00
Joel Leitch edf326e756 Tag member fields as transient since a LinkedHashMap is used for serialization. 2013-01-15 20:04:26 +00:00
Joel Leitch 3f2efac95e Stop blowing up on a null key, but rather return that the element is not found. 2013-01-09 23:37:38 +00:00
Joel Leitch 14f16e2d0c Adding Red-Black Tree implementation and tying it into the Gson bindings. 2012-10-11 03:15:49 +00:00
Jesse Wilson 2fef83799d Optimizations and bug fixes for LinkedHashTreeMap.
The most interesting optimization is to replace ArrayDeque with a manual linked list that reuses the nodes 'parent' field. These optimizations save about 20%.
2012-09-17 03:30:20 +00:00
Jesse Wilson aceadaecf1 Add a hashing layer to LinkedTreeMap. Instead of having 1 root node, the class now has several root nodes, one for each hash bucket in a hash table.
Compared to LinkedTreeMap, this is slower for small (size=5) maps: 124% slower to get() and 33% slower to create and populate. It's a win for large (size=500) maps: 46% faster to get() but 8% slower to create and populate. And it's a big win for very large (size=50,000) maps: 81% faster to get() and 46% faster to create and populate.

http://microbenchmarks.appspot.com/run/limpbizkit@gmail.com/com.google.common.collect.MapBenchmark

I'm going to follow this up with some simple optimizations: caching local fields and simplifying access. That should narrow the performance gap.
2012-09-17 00:19:44 +00:00
Jesse Wilson a0493b9732 New code that can split an AVL tree into two AVL trees.
This is in preparation for a new feature where LinkedTreeMap will have multiple roots, each in its own hash bucket.
2012-09-15 06:13:33 +00:00
Jesse Wilson 01bd0d92e2 Tests for LinkedTreeMap with incompatible keys. 2012-09-12 05:06:48 +00:00
Jesse Wilson a6ab854302 Fix a bug where we were unlinking nodes that shouldn't have been unlinked.
Found by Guava's awesome collections test suite!
2012-09-12 04:41:58 +00:00
Jesse Wilson 93e38901df Draft of LinkedTreeMap. Its ordered like a LinkedHashMap but it doesn't do any hashing for DoS resistance.
Not yet adopted in our code.

Known critical bugs:
 - throws ClassCastException when get() is called with a non-comparable key
 - throws NullPointerException on get(null)
2012-09-10 20:04:38 +00:00