Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions gson/src/main/java/com/google/gson/Gson.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@
import java.util.concurrent.ConcurrentMap;

/**
* This is the main class for using Gson. Gson is typically used by first constructing a Gson
* instance and then invoking {@link #toJson(Object)} or {@link #fromJson(String, Class)} methods on
* it. Gson instances are Thread-safe so you can reuse them freely across multiple threads.
* This is the main class for using Gson. Gson is typically used by first constructing a {@code
* Gson} instance and then invoking {@link #toJson(Object)} or {@link #fromJson(String, Class)}
* methods on it. {@code Gson} instances are Thread-safe so you can reuse them freely across
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the distracting capitalization of "Thread-safe" while you are here?

* multiple threads.
*
* <p>You can create a Gson instance by invoking {@code new Gson()} if the default configuration is
* all you need. You can also use {@link GsonBuilder} to build a Gson instance with various
* configuration options such as versioning support, pretty printing, custom newline, custom indent,
* custom {@link JsonSerializer}s, {@link JsonDeserializer}s, and {@link InstanceCreator}s.
* <p>You can create a {@code Gson} instance by invoking {@link #Gson() new Gson()} if the default
* configuration is all you need. You can also use {@link GsonBuilder} to build a {@code Gson}
* instance with various configuration options such as versioning support, pretty printing, custom
* newline, custom indent, custom {@link JsonSerializer}s, {@link JsonDeserializer}s, and {@link
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps rewrite this last bit to talk about {@link TypeAdapter}s and {@link TypeAdapterFactory}s.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean mentioning them additionally, or instead of JsonSerializer and JsonDeserializer?

* InstanceCreator}s.
*
* <p>Here is an example of how Gson is used for a simple Class:
*
Expand Down Expand Up @@ -89,6 +91,11 @@
* <p>See the <a href="https://github.com/google/gson/blob/main/UserGuide.md">Gson User Guide</a>
* for a more complete set of examples.
*
* <p>When serializing or deserializing a type, {@code Gson} instances cache the type adapters they
* created for that type. It can therefore improve performance to reuse a single {@code Gson}
* instance (for example by storing it in a {@code static final} field), especially when relying on
* the built-in reflection-based adapter or when using custom type adapter factories.
*
* <h2 id="default-lenient">JSON Strictness handling</h2>
*
* For legacy reasons most of the {@code Gson} methods allow JSON data which does not comply with
Expand Down