From 2591ede59bf7e4cef496a01e82282c88e256cec8 Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Sun, 25 Sep 2022 02:02:11 +0200 Subject: [PATCH] Fix incorrect HTML headings in Javadoc (#2200) --- .../gson/typeadapters/RuntimeTypeAdapterFactory.java | 8 ++++---- gson/src/main/java/com/google/gson/TypeAdapter.java | 2 +- .../src/main/java/com/google/gson/TypeAdapterFactory.java | 5 +++-- .../google/gson/internal/bind/MapTypeAdapterFactory.java | 4 ++-- gson/src/main/java/com/google/gson/stream/JsonReader.java | 6 +++--- gson/src/main/java/com/google/gson/stream/JsonWriter.java | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java b/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java index 109fc384..87b522f0 100644 --- a/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java +++ b/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java @@ -119,7 +119,7 @@ import java.util.Map; * .registerSubtype(Diamond.class); * } * - *

Serialization and deserialization

+ *

Serialization and deserialization

* In order to serialize and deserialize a polymorphic object, * you must specify the base type explicitly. *
   {@code
@@ -158,7 +158,7 @@ public final class RuntimeTypeAdapterFactory implements TypeAdapterFactory {
   public static  RuntimeTypeAdapterFactory of(Class 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.
@@ -244,7 +244,7 @@ public final class RuntimeTypeAdapterFactory implements TypeAdapterFactory {
         } else {
             labelJsonElement = jsonElement.getAsJsonObject().remove(typeFieldName);
         }
-        
+
         if (labelJsonElement == null) {
           throw new JsonParseException("cannot deserialize " + baseType
               + " because it does not define a field named " + typeFieldName);
@@ -282,7 +282,7 @@ public final class RuntimeTypeAdapterFactory implements TypeAdapterFactory {
               + " because it already defines a field named " + typeFieldName);
         }
         clone.add(typeFieldName, new JsonPrimitive(label));
-        
+
         for (Map.Entry e : jsonObject.entrySet()) {
           clone.add(e.getKey(), e.getValue());
         }
diff --git a/gson/src/main/java/com/google/gson/TypeAdapter.java b/gson/src/main/java/com/google/gson/TypeAdapter.java
index 0c10e222..5685cadb 100644
--- a/gson/src/main/java/com/google/gson/TypeAdapter.java
+++ b/gson/src/main/java/com/google/gson/TypeAdapter.java
@@ -96,7 +96,7 @@ import java.io.Writer;
  */
 // non-Javadoc:
 //
-// 

JSON Conversion

+//

JSON Conversion

//

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:

   {@code
diff --git a/gson/src/main/java/com/google/gson/TypeAdapterFactory.java b/gson/src/main/java/com/google/gson/TypeAdapterFactory.java
index 60f7b7e2..75fdddbf 100644
--- a/gson/src/main/java/com/google/gson/TypeAdapterFactory.java
+++ b/gson/src/main/java/com/google/gson/TypeAdapterFactory.java
@@ -22,7 +22,8 @@ import com.google.gson.reflect.TypeToken;
  * Creates type adapters for set of related types. Type adapter factories are
  * most useful when several types share similar structure in their JSON form.
  *
- * 

Example: Converting enums to lowercase

+ *

Examples

+ *

Example: Converting enums to lowercase

* 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 @@ -90,7 +91,7 @@ import com.google.gson.reflect.TypeToken; * If multiple factories support the same type, the factory registered earlier * takes precedence. * - *

Example: composing other type adapters

+ *

Example: Composing other type adapters

* 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 diff --git a/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java b/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java index f7c5a554..68ecffb9 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java +++ b/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java @@ -40,7 +40,7 @@ import java.util.Map; /** * Adapts maps to either JSON objects or JSON arrays. * - *

Maps as JSON objects

+ *

Maps as JSON objects

* 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 @@ -65,7 +65,7 @@ import java.util.Map; * at com.google.gson.ObjectNavigator.navigateClassFields * ...
* - *

Maps as JSON arrays

+ *

Maps as JSON arrays

* 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. diff --git a/gson/src/main/java/com/google/gson/stream/JsonReader.java b/gson/src/main/java/com/google/gson/stream/JsonReader.java index 06fd3baf..925c50f7 100644 --- a/gson/src/main/java/com/google/gson/stream/JsonReader.java +++ b/gson/src/main/java/com/google/gson/stream/JsonReader.java @@ -62,7 +62,7 @@ import java.util.Objects; * Null literals can be consumed using either {@link #nextNull()} or {@link * #skipValue()}. * - *

Example

+ *

Example

* Suppose we'd like to parse a stream of messages such as the following:
 {@code
  * [
  *   {
@@ -161,7 +161,7 @@ import java.util.Objects;
  *     return new User(username, followersCount);
  *   }}
* - *

Number Handling

+ *

Number Handling

* 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}. @@ -171,7 +171,7 @@ import java.util.Objects; * precision loss, extremely large values should be written and read as strings * in JSON. * - *

Non-Execute Prefix

+ *

Non-Execute Prefix

* Web servers that serve private data using JSON may be vulnerable to Cross-site * request forgery attacks. In such an attack, a malicious site gains access diff --git a/gson/src/main/java/com/google/gson/stream/JsonWriter.java b/gson/src/main/java/com/google/gson/stream/JsonWriter.java index 7f1ab0ea..d828d468 100644 --- a/gson/src/main/java/com/google/gson/stream/JsonWriter.java +++ b/gson/src/main/java/com/google/gson/stream/JsonWriter.java @@ -58,7 +58,7 @@ import java.util.regex.Pattern; * Finally close the object using {@link #endObject()}. * * - *

Example

+ *

Example

* Suppose we'd like to encode a stream of messages such as the following:
 {@code
  * [
  *   {