GsonBuilder.disableUnsafe
See original GitHub issueWhile it is nice to know that Unsafe is only used when no-arg ctors or instance
creators are not present, it would be better to have a means to enforce it
cannot be used. Particularly in google app engine, I'd like to know that the
code I use offline is safe inside GAE, rather than a delayed
UnsupportedOperationException
Can you add GsonBuilder.disableUnsafe or similar?
Original issue reported on code.google.com by adrian.f...@gmail.com
on 16 May 2012 at 5:58
Issue Analytics
- State:
- Created 9 years ago
- Reactions:7
- Comments:15
Top Results From Across the Web
GsonBuilder - gson 2.10 javadoc
Configures Gson to exclude all fields from consideration for serialization and deserialization that do not have the Expose annotation. GsonBuilder.
Read more >GsonBuilder.disableUnsafe - - Bountysource
Particularly in google app engine, I'd like to know that the code I use offline is safe inside GAE, rather than a delayed...
Read more >I've trusted you! You promised no null pointer exceptions!
At the time of writing this document, Google has a proposal to add a method disableUnsafe to the GsonBuilder which will enforce the...
Read more >Android — 一個Google play console上提示的Unsafe ... - JLin
GsonBuilder.disableUnsafe · Issue #445 · google/gson. While it is nice to know that Unsafe is only used when no-arg ctors or instance creators...
Read more >Hackday 5.0 - our review - Babbel Bytes
At the time of writing this document, Google has a proposal to add a method disableUnsafe to the GsonBuilder which will enforce the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That worked, thanks a lot. For the record: my kotlin-code:
Yes. I use kotlin’s data-classes. If I supply default-values for all constructor parameters, a no-args constructor is generated and everything works fine. If I forget a default-value somewhere though, gson initializes the class with all fields set to null, which then crash with a NPE when I access them, even though kotlin “guarantees” them to be not-null.
So I need gson to crash to see that I forgot to set the parameter.