Skip to content

Add Javadoc @since tags for previously added elements #2211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions gson/src/main/java/com/google/gson/FieldNamingPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
* <li>aStringField ---&gt; A_STRING_FIELD</li>
* <li>aURL ---&gt; A_U_R_L</li>
* </ul>
*
* @since 2.9.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
UPPER_CASE_WITH_UNDERSCORES() {
@Override public String translateName(Field f) {
Expand Down Expand Up @@ -125,7 +127,8 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
* Using dashes in JavaScript is not recommended since dash is also used for a minus sign in
* expressions. This requires that a field named with dashes is always accessed as a quoted
* property like {@code myobject['my-field']}. Accessing it as an object field
* {@code myobject.my-field} will result in an unintended javascript expression.
* {@code myobject.my-field} will result in an unintended JavaScript expression.
*
* @since 1.4
*/
LOWER_CASE_WITH_DASHES() {
Expand All @@ -148,8 +151,9 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
* Using dots in JavaScript is not recommended since dot is also used for a member sign in
* expressions. This requires that a field named with dots is always accessed as a quoted
* property like {@code myobject['my.field']}. Accessing it as an object field
* {@code myobject.my.field} will result in an unintended javascript expression.
* @since 2.8
* {@code myobject.my.field} will result in an unintended JavaScript expression.
*
* @since 2.8.4
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ab35f11

(previous @since value was apparently incorrect)

*/
LOWER_CASE_WITH_DOTS() {
@Override public String translateName(Field f) {
Expand Down
1 change: 1 addition & 0 deletions gson/src/main/java/com/google/gson/Gson.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ public Gson() {
* instance.
*
* @return a GsonBuilder instance.
* @since 2.8.3
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public GsonBuilder newBuilder() {
return new GsonBuilder(this);
Expand Down
4 changes: 4 additions & 0 deletions gson/src/main/java/com/google/gson/GsonBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ public GsonBuilder setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrateg
* @param objectToNumberStrategy the actual object-to-number strategy
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
* @see ToNumberPolicy#DOUBLE The default object-to-number strategy
* @since 2.8.9
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public GsonBuilder setObjectToNumberStrategy(ToNumberStrategy objectToNumberStrategy) {
this.objectToNumberStrategy = Objects.requireNonNull(objectToNumberStrategy);
Expand All @@ -376,6 +377,7 @@ public GsonBuilder setObjectToNumberStrategy(ToNumberStrategy objectToNumberStra
* @param numberToNumberStrategy the actual number-to-number strategy
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
* @see ToNumberPolicy#LAZILY_PARSED_NUMBER The default number-to-number strategy
* @since 2.8.9
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public GsonBuilder setNumberToNumberStrategy(ToNumberStrategy numberToNumberStrategy) {
this.numberToNumberStrategy = Objects.requireNonNull(numberToNumberStrategy);
Expand Down Expand Up @@ -682,6 +684,7 @@ public GsonBuilder serializeSpecialFloatingPointValues() {
* disabling usage of {@code Unsafe}.
*
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
* @since 2.9.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public GsonBuilder disableJdkUnsafe() {
this.useJdkUnsafe = false;
Expand All @@ -702,6 +705,7 @@ public GsonBuilder disableJdkUnsafe() {
*
* @param filter filter to add
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
* @since 2.9.1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public GsonBuilder addReflectionAccessFilter(ReflectionAccessFilter filter) {
Objects.requireNonNull(filter);
Expand Down
6 changes: 6 additions & 0 deletions gson/src/main/java/com/google/gson/JsonArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public JsonArray() {
* @param capacity initial capacity.
* @throws IllegalArgumentException if the {@code capacity} is
* negative
* @since 2.8.1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
@SuppressWarnings("deprecation") // superclass constructor
public JsonArray(int capacity) {
Expand Down Expand Up @@ -75,6 +76,7 @@ public JsonArray deepCopy() {
* Adds the specified boolean to self.
*
* @param bool the boolean that needs to be added to the array.
* @since 2.4
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

6960ebc

(same also for other methods below)

*/
public void add(Boolean bool) {
elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool));
Expand All @@ -84,6 +86,7 @@ public void add(Boolean bool) {
* Adds the specified character to self.
*
* @param character the character that needs to be added to the array.
* @since 2.4
*/
public void add(Character character) {
elements.add(character == null ? JsonNull.INSTANCE : new JsonPrimitive(character));
Expand All @@ -93,6 +96,7 @@ public void add(Character character) {
* Adds the specified number to self.
*
* @param number the number that needs to be added to the array.
* @since 2.4
*/
public void add(Number number) {
elements.add(number == null ? JsonNull.INSTANCE : new JsonPrimitive(number));
Expand All @@ -102,6 +106,7 @@ public void add(Number number) {
* Adds the specified string to self.
*
* @param string the string that needs to be added to the array.
* @since 2.4
*/
public void add(String string) {
elements.add(string == null ? JsonNull.INSTANCE : new JsonPrimitive(string));
Expand Down Expand Up @@ -190,6 +195,7 @@ public int size() {
* Returns true if the array is empty.
*
* @return true if the array is empty.
* @since 2.8.7
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public boolean isEmpty() {
return elements.isEmpty();
Expand Down
1 change: 1 addition & 0 deletions gson/src/main/java/com/google/gson/JsonObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public Set<String> keySet() {
* Returns the number of key/value pairs in the object.
*
* @return the number of key/value pairs in the object.
* @since 2.7
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public int size() {
return members.size();
Expand Down
3 changes: 3 additions & 0 deletions gson/src/main/java/com/google/gson/JsonParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public JsonParser() {}
* @param json JSON text
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
* @throws JsonParseException if the specified text is not valid JSON
* @since 2.8.6
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

c5a3f21

(same also for other methods below)

*/
public static JsonElement parseString(String json) throws JsonSyntaxException {
return parseReader(new StringReader(json));
Expand All @@ -61,6 +62,7 @@ public static JsonElement parseString(String json) throws JsonSyntaxException {
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
* @throws JsonParseException if there is an IOException or if the specified
* text is not valid JSON
* @since 2.8.6
*/
public static JsonElement parseReader(Reader reader) throws JsonIOException, JsonSyntaxException {
try {
Expand Down Expand Up @@ -90,6 +92,7 @@ public static JsonElement parseReader(Reader reader) throws JsonIOException, Jso
*
* @throws JsonParseException if there is an IOException or if the specified
* text is not valid JSON
* @since 2.8.6
*/
public static JsonElement parseReader(JsonReader reader)
throws JsonIOException, JsonSyntaxException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.google.gson;

import java.lang.reflect.AccessibleObject;

import com.google.gson.internal.ReflectionAccessFilterHelper;
import java.lang.reflect.AccessibleObject;

/**
* Filter for determining whether reflection based serialization and
Expand All @@ -28,10 +27,13 @@
* fields and classes.
*
* @see GsonBuilder#addReflectionAccessFilter(ReflectionAccessFilter)
* @since 2.9.1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public interface ReflectionAccessFilter {
/**
* Result of a filter check.
*
* @since 2.9.1
*/
enum FilterResult {
/**
Expand Down
6 changes: 3 additions & 3 deletions gson/src/main/java/com/google/gson/ToNumberPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@

package com.google.gson;

import java.io.IOException;
import java.math.BigDecimal;

import com.google.gson.internal.LazilyParsedNumber;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.MalformedJsonException;
import java.io.IOException;
import java.math.BigDecimal;

/**
* An enumeration that defines two standard number reading strategies and a couple of
* strategies to overcome some historical Gson limitations while deserializing numbers as
* {@link Object} and {@link Number}.
*
* @see ToNumberStrategy
* @since 2.8.9
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public enum ToNumberPolicy implements ToNumberStrategy {

Expand Down
4 changes: 2 additions & 2 deletions gson/src/main/java/com/google/gson/ToNumberStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

package com.google.gson;

import java.io.IOException;

import com.google.gson.stream.JsonReader;
import java.io.IOException;

/**
* A strategy that is used to control how numbers should be deserialized for {@link Object} and {@link Number}
Expand Down Expand Up @@ -56,6 +55,7 @@
* @see ToNumberPolicy
* @see GsonBuilder#setObjectToNumberStrategy(ToNumberStrategy)
* @see GsonBuilder#setNumberToNumberStrategy(ToNumberStrategy)
* @since 2.8.9
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public interface ToNumberStrategy {

Expand Down
3 changes: 3 additions & 0 deletions gson/src/main/java/com/google/gson/stream/JsonWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ public JsonWriter value(String value) throws IOException {
* @return this writer.
* @throws UnsupportedOperationException if this writer does not support
* writing raw JSON values.
* @since 2.4
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public JsonWriter jsonValue(String value) throws IOException {
if (value == null) {
Expand Down Expand Up @@ -475,6 +476,7 @@ public JsonWriter value(boolean value) throws IOException {
* Encodes {@code value}.
*
* @return this writer.
* @since 2.7
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public JsonWriter value(Boolean value) throws IOException {
if (value == null) {
Expand All @@ -495,6 +497,7 @@ public JsonWriter value(Boolean value) throws IOException {
* @return this writer.
* @throws IllegalArgumentException if the value is NaN or Infinity and this writer is not {@link
* #setLenient(boolean) lenient}.
* @since 2.9.1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*/
public JsonWriter value(float value) throws IOException {
writeDeferredName();
Expand Down