diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/pom.xml b/pom.xml index 927a989..d01283c 100644 --- a/pom.xml +++ b/pom.xml @@ -104,6 +104,9 @@ 1.8 1.8 + + -Xlint:unchecked + diff --git a/src/main/java/org/json/JSONArray.java b/src/main/java/org/json/JSONArray.java index 50146a8..38b0b31 100644 --- a/src/main/java/org/json/JSONArray.java +++ b/src/main/java/org/json/JSONArray.java @@ -1359,7 +1359,8 @@ public class JSONArray implements Iterable { * The subscript. * @param value * The Map value. - * @return this. + * @return + * reference to self * @throws JSONException * If the index is negative or if the value is an invalid * number. @@ -1381,7 +1382,7 @@ public class JSONArray implements Iterable { * The Map value. * @param jsonParserConfiguration * Configuration object for the JSON parser - * @return + * @return reference to self * @throws JSONException * If the index is negative or if the value is an invalid * number. diff --git a/src/main/java/org/json/JSONMLParserConfiguration.java b/src/main/java/org/json/JSONMLParserConfiguration.java index b2514ab..43ba0db 100644 --- a/src/main/java/org/json/JSONMLParserConfiguration.java +++ b/src/main/java/org/json/JSONMLParserConfiguration.java @@ -55,11 +55,13 @@ public class JSONMLParserConfiguration extends ParserConfiguration { ); } + @SuppressWarnings("unchecked") @Override public JSONMLParserConfiguration withKeepStrings(final boolean newVal) { return super.withKeepStrings(newVal); } + @SuppressWarnings("unchecked") @Override public JSONMLParserConfiguration withMaxNestingDepth(int maxNestingDepth) { return super.withMaxNestingDepth(maxNestingDepth); diff --git a/src/main/java/org/json/JSONParserConfiguration.java b/src/main/java/org/json/JSONParserConfiguration.java index 1ec1710..f95e244 100644 --- a/src/main/java/org/json/JSONParserConfiguration.java +++ b/src/main/java/org/json/JSONParserConfiguration.java @@ -17,6 +17,7 @@ public class JSONParserConfiguration extends ParserConfiguration { return new JSONParserConfiguration(); } + @SuppressWarnings("unchecked") @Override public JSONParserConfiguration withMaxNestingDepth(final int maxNestingDepth) { return super.withMaxNestingDepth(maxNestingDepth); diff --git a/src/main/java/org/json/ParserConfiguration.java b/src/main/java/org/json/ParserConfiguration.java index 36fa508..ede2fc5 100644 --- a/src/main/java/org/json/ParserConfiguration.java +++ b/src/main/java/org/json/ParserConfiguration.java @@ -75,6 +75,7 @@ public class ParserConfiguration { * * @return The existing configuration will not be modified. A new configuration is returned. */ + @SuppressWarnings("unchecked") public T withKeepStrings(final boolean newVal) { T newConfig = (T)this.clone(); newConfig.keepStrings = newVal; @@ -101,6 +102,7 @@ public class ParserConfiguration { * * @return The existing configuration will not be modified. A new configuration is returned. */ + @SuppressWarnings("unchecked") public T withMaxNestingDepth(int maxNestingDepth) { T newConfig = (T)this.clone(); diff --git a/src/main/java/org/json/XMLParserConfiguration.java b/src/main/java/org/json/XMLParserConfiguration.java index 2e4907f..0ac7834 100644 --- a/src/main/java/org/json/XMLParserConfiguration.java +++ b/src/main/java/org/json/XMLParserConfiguration.java @@ -192,6 +192,7 @@ public class XMLParserConfiguration extends ParserConfiguration { * * @return The existing configuration will not be modified. A new configuration is returned. */ + @SuppressWarnings("unchecked") @Override public XMLParserConfiguration withKeepStrings(final boolean newVal) { return super.withKeepStrings(newVal); @@ -309,6 +310,7 @@ public class XMLParserConfiguration extends ParserConfiguration { * @param maxNestingDepth the maximum nesting depth allowed to the XML parser * @return The existing configuration will not be modified. A new configuration is returned. */ + @SuppressWarnings("unchecked") @Override public XMLParserConfiguration withMaxNestingDepth(int maxNestingDepth) { return super.withMaxNestingDepth(maxNestingDepth); @@ -316,7 +318,7 @@ public class XMLParserConfiguration extends ParserConfiguration { /** * To enable explicit end tag with empty value. - * @param closeEmptyTag + * @param closeEmptyTag new value for the closeEmptyTag property * @return same instance of configuration with empty tag config updated */ public XMLParserConfiguration withCloseEmptyTag(boolean closeEmptyTag){ diff --git a/src/test/java/org/json/junit/data/WeirdList.java b/src/test/java/org/json/junit/data/WeirdList.java index 834b81e..3560586 100644 --- a/src/test/java/org/json/junit/data/WeirdList.java +++ b/src/test/java/org/json/junit/data/WeirdList.java @@ -12,7 +12,7 @@ import java.util.List; */ public class WeirdList { /** */ - private final List list = new ArrayList(); + private final List list = new ArrayList<>(); /** * @param vals @@ -25,14 +25,14 @@ public class WeirdList { * @return a copy of the list */ public List get() { - return new ArrayList(this.list); + return new ArrayList<>(this.list); } /** * @return a copy of the list */ public List getALL() { - return new ArrayList(this.list); + return new ArrayList<>(this.list); } /**