Skip to content

Commit

Permalink
Fix incorrect HTML headings in Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Sep 24, 2022
1 parent 0864a02 commit 82c0933
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
* .registerSubtype(Diamond.class);
* }</pre>
*
* <h3>Serialization and deserialization</h3>
* <h2>Serialization and deserialization</h2>
* In order to serialize and deserialize a polymorphic object,
* you must specify the base type explicitly.
* <pre> {@code
Expand Down Expand Up @@ -158,7 +158,7 @@ private RuntimeTypeAdapterFactory(
public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType, String typeFieldName, boolean maintainType) {
return new RuntimeTypeAdapterFactory<>(baseType, typeFieldName, maintainType);
}

/**
* Creates a new runtime type adapter using for {@code baseType} using {@code
* typeFieldName} as the type field name. Type field names are case sensitive.
Expand Down Expand Up @@ -244,7 +244,7 @@ public <R> TypeAdapter<R> create(Gson gson, TypeToken<R> type) {
} else {
labelJsonElement = jsonElement.getAsJsonObject().remove(typeFieldName);
}

if (labelJsonElement == null) {
throw new JsonParseException("cannot deserialize " + baseType
+ " because it does not define a field named " + typeFieldName);
Expand Down Expand Up @@ -282,7 +282,7 @@ public <R> TypeAdapter<R> create(Gson gson, TypeToken<R> type) {
+ " because it already defines a field named " + typeFieldName);
}
clone.add(typeFieldName, new JsonPrimitive(label));

for (Map.Entry<String, JsonElement> e : jsonObject.entrySet()) {
clone.add(e.getKey(), e.getValue());
}
Expand Down
2 changes: 1 addition & 1 deletion gson/src/main/java/com/google/gson/TypeAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
*/
// non-Javadoc:
//
// <h3>JSON Conversion</h3>
// <h2>JSON Conversion</h2>
// <p>A type adapter registered with Gson is automatically invoked while serializing
// or deserializing JSON. However, you can also use type adapters directly to serialize
// and deserialize JSON. Here is an example for deserialization: <pre> {@code
Expand Down
5 changes: 3 additions & 2 deletions gson/src/main/java/com/google/gson/TypeAdapterFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* Creates type adapters for set of related types. Type adapter factories are
* most useful when several types share similar structure in their JSON form.
*
* <h2>Example: Converting enums to lowercase</h2>
* <h2>Examples</h2>
* <h3>Example: Converting enums to lowercase</h3>
* In this example, we implement a factory that creates type adapters for all
* enums. The type adapters will write enums in lowercase, despite the fact
* that they're defined in {@code CONSTANT_CASE} in the corresponding Java
Expand Down Expand Up @@ -90,7 +91,7 @@
* If multiple factories support the same type, the factory registered earlier
* takes precedence.
*
* <h3>Example: composing other type adapters</h3>
* <h3>Example: Composing other type adapters</h3>
* In this example we implement a factory for Guava's {@code Multiset}
* collection type. The factory can be used to create type adapters for
* multisets of any element type: the type adapter for {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/**
* Adapts maps to either JSON objects or JSON arrays.
*
* <h3>Maps as JSON objects</h3>
* <h2>Maps as JSON objects</h2>
* For primitive keys or when complex map key serialization is not enabled, this
* converts Java {@link Map Maps} to JSON Objects. This requires that map keys
* can be serialized as strings; this is insufficient for some key types. For
Expand All @@ -65,7 +65,7 @@
* at com.google.gson.ObjectNavigator.navigateClassFields
* ...</pre>
*
* <h3>Maps as JSON arrays</h3>
* <h2>Maps as JSON arrays</h2>
* An alternative approach taken by this type adapter when it is required and
* complex map key serialization is enabled is to encode maps as arrays of map
* entries. Each map entry is a two element array containing a key and a value.
Expand Down
6 changes: 3 additions & 3 deletions gson/src/main/java/com/google/gson/stream/JsonReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Null literals can be consumed using either {@link #nextNull()} or {@link
* #skipValue()}.
*
* <h3>Example</h3>
* <h2>Example</h2>
* Suppose we'd like to parse a stream of messages such as the following: <pre> {@code
* [
* {
Expand Down Expand Up @@ -161,7 +161,7 @@
* return new User(username, followersCount);
* }}</pre>
*
* <h3>Number Handling</h3>
* <h2>Number Handling</h2>
* This reader permits numeric values to be read as strings and string values to
* be read as numbers. For example, both elements of the JSON array {@code
* [1, "1"]} may be read using either {@link #nextInt} or {@link #nextString}.
Expand All @@ -171,7 +171,7 @@
* precision loss, extremely large values should be written and read as strings
* in JSON.
*
* <h3 id="nonexecuteprefix">Non-Execute Prefix</h3>
* <h2 id="nonexecuteprefix">Non-Execute Prefix</h2>
* Web servers that serve private data using JSON may be vulnerable to <a
* href="http://en.wikipedia.org/wiki/JSON#Cross-site_request_forgery">Cross-site
* request forgery</a> attacks. In such an attack, a malicious site gains access
Expand Down
2 changes: 1 addition & 1 deletion gson/src/main/java/com/google/gson/stream/JsonWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* Finally close the object using {@link #endObject()}.
* </ul>
*
* <h3>Example</h3>
* <h2>Example</h2>
* Suppose we'd like to encode a stream of messages such as the following: <pre> {@code
* [
* {
Expand Down

0 comments on commit 82c0933

Please sign in to comment.