Skip to content

Commit 5ddb8c3

Browse files
Sean LearySean Leary
Sean Leary
authored and
Sean Leary
committed
cleanup-and-merge-tests: fix warnings, set gradlew permissions, enable unchecked warnings in maven
1 parent d7819a4 commit 5ddb8c3

File tree

8 files changed

+17
-6
lines changed

8 files changed

+17
-6
lines changed

Diff for: gradlew

100644100755
File mode changed.

Diff for: pom.xml

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@
104104
<configuration>
105105
<source>1.8</source>
106106
<target>1.8</target>
107+
<compilerArgs>
108+
<arg>-Xlint:unchecked</arg>
109+
</compilerArgs>
107110
</configuration>
108111
</plugin>
109112
<plugin>

Diff for: src/main/java/org/json/JSONArray.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,8 @@ public JSONArray put(int index, long value) throws JSONException {
13591359
* The subscript.
13601360
* @param value
13611361
* The Map value.
1362-
* @return this.
1362+
* @return
1363+
* reference to self
13631364
* @throws JSONException
13641365
* If the index is negative or if the value is an invalid
13651366
* number.
@@ -1381,7 +1382,7 @@ public JSONArray put(int index, Map<?, ?> value) throws JSONException {
13811382
* The Map value.
13821383
* @param jsonParserConfiguration
13831384
* Configuration object for the JSON parser
1384-
* @return
1385+
* @return reference to self
13851386
* @throws JSONException
13861387
* If the index is negative or if the value is an invalid
13871388
* number.

Diff for: src/main/java/org/json/JSONMLParserConfiguration.java

+2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ protected JSONMLParserConfiguration clone() {
5555
);
5656
}
5757

58+
@SuppressWarnings("unchecked")
5859
@Override
5960
public JSONMLParserConfiguration withKeepStrings(final boolean newVal) {
6061
return super.withKeepStrings(newVal);
6162
}
6263

64+
@SuppressWarnings("unchecked")
6365
@Override
6466
public JSONMLParserConfiguration withMaxNestingDepth(int maxNestingDepth) {
6567
return super.withMaxNestingDepth(maxNestingDepth);

Diff for: src/main/java/org/json/JSONParserConfiguration.java

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ protected JSONParserConfiguration clone() {
1717
return new JSONParserConfiguration();
1818
}
1919

20+
@SuppressWarnings("unchecked")
2021
@Override
2122
public JSONParserConfiguration withMaxNestingDepth(final int maxNestingDepth) {
2223
return super.withMaxNestingDepth(maxNestingDepth);

Diff for: src/main/java/org/json/ParserConfiguration.java

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public boolean isKeepStrings() {
7575
*
7676
* @return The existing configuration will not be modified. A new configuration is returned.
7777
*/
78+
@SuppressWarnings("unchecked")
7879
public <T extends ParserConfiguration> T withKeepStrings(final boolean newVal) {
7980
T newConfig = (T)this.clone();
8081
newConfig.keepStrings = newVal;
@@ -101,6 +102,7 @@ public int getMaxNestingDepth() {
101102
*
102103
* @return The existing configuration will not be modified. A new configuration is returned.
103104
*/
105+
@SuppressWarnings("unchecked")
104106
public <T extends ParserConfiguration> T withMaxNestingDepth(int maxNestingDepth) {
105107
T newConfig = (T)this.clone();
106108

Diff for: src/main/java/org/json/XMLParserConfiguration.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ protected XMLParserConfiguration clone() {
192192
*
193193
* @return The existing configuration will not be modified. A new configuration is returned.
194194
*/
195+
@SuppressWarnings("unchecked")
195196
@Override
196197
public XMLParserConfiguration withKeepStrings(final boolean newVal) {
197198
return super.withKeepStrings(newVal);
@@ -309,14 +310,15 @@ public XMLParserConfiguration withForceList(final Set<String> forceList) {
309310
* @param maxNestingDepth the maximum nesting depth allowed to the XML parser
310311
* @return The existing configuration will not be modified. A new configuration is returned.
311312
*/
313+
@SuppressWarnings("unchecked")
312314
@Override
313315
public XMLParserConfiguration withMaxNestingDepth(int maxNestingDepth) {
314316
return super.withMaxNestingDepth(maxNestingDepth);
315317
}
316318

317319
/**
318320
* To enable explicit end tag with empty value.
319-
* @param closeEmptyTag
321+
* @param closeEmptyTag new value for the closeEmptyTag property
320322
* @return same instance of configuration with empty tag config updated
321323
*/
322324
public XMLParserConfiguration withCloseEmptyTag(boolean closeEmptyTag){

Diff for: src/test/java/org/json/junit/data/WeirdList.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
public class WeirdList {
1414
/** */
15-
private final List<Integer> list = new ArrayList();
15+
private final List<Integer> list = new ArrayList<>();
1616

1717
/**
1818
* @param vals
@@ -25,14 +25,14 @@ public WeirdList(Integer... vals) {
2525
* @return a copy of the list
2626
*/
2727
public List<Integer> get() {
28-
return new ArrayList(this.list);
28+
return new ArrayList<>(this.list);
2929
}
3030

3131
/**
3232
* @return a copy of the list
3333
*/
3434
public List<Integer> getALL() {
35-
return new ArrayList(this.list);
35+
return new ArrayList<>(this.list);
3636
}
3737

3838
/**

0 commit comments

Comments
 (0)