changes number parsing to use BigDecimal as the backing type

* updated tests to support BigDecimal as the backing type for numbers
* updated some test resource handling to java7 try-with-resources format
* cleaned up some other minor compiler warnings
This commit is contained in:
John J. Aylward
2018-12-10 13:19:31 -05:00
parent 956bdfa5b7
commit 56d33b8061
13 changed files with 248 additions and 255 deletions
@@ -7,8 +7,6 @@ import java.io.Closeable;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import org.json.JSONObject;
/**
* Object for testing the exception handling in {@link JSONObject#populateMap}.
*
@@ -56,7 +54,6 @@ public class ExceptionalBean {
/**
* @return a string
*/
@SuppressWarnings("unused")
public String getString() {
return "Yup, it's closeable";
}
@@ -8,13 +8,13 @@ public class MyEnumClass {
private MyEnumField myEnumField;
public MyEnum getMyEnum() {
return myEnum;
return this.myEnum;
}
public void setMyEnum(MyEnum myEnum) {
this.myEnum = myEnum;
}
public MyEnumField getMyEnumField() {
return myEnumField;
return this.myEnumField;
}
public void setMyEnumField(MyEnumField myEnumField) {
this.myEnumField = myEnumField;
@@ -4,9 +4,9 @@ public class MyLocaleBean {
private final String id = "beanId";
private final String i = "beanI";
public String getId() {
return id;
return this.id;
}
public String getI() {
return i;
return this.i;
}
}
@@ -33,7 +33,7 @@ public final class Singleton {
/** @return someInt */
public int getSomeInt() {
return someInt;
return this.someInt;
}
/**
@@ -48,7 +48,7 @@ public final class Singleton {
/** @return someString */
public String getSomeString() {
return someString;
return this.someString;
}
/**
@@ -65,8 +65,8 @@ public final class Singleton {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + someInt;
result = prime * result + ((someString == null) ? 0 : someString.hashCode());
result = prime * result + this.someInt;
result = prime * result + ((this.someString == null) ? 0 : this.someString.hashCode());
return result;
}
@@ -79,12 +79,12 @@ public final class Singleton {
if (getClass() != obj.getClass())
return false;
Singleton other = (Singleton) obj;
if (someInt != other.someInt)
if (this.someInt != other.someInt)
return false;
if (someString == null) {
if (this.someString == null) {
if (other.someString != null)
return false;
} else if (!someString.equals(other.someString))
} else if (!this.someString.equals(other.someString))
return false;
return true;
}
@@ -19,7 +19,7 @@ public enum SingletonEnum {
/** single instance. */
/**
* @return the singleton instance. I a real application, I'd hope no one did
* @return the singleton instance. In a real application, I'd hope no one did
* this to an enum singleton.
*/
public static final SingletonEnum getInstance() {
@@ -32,7 +32,7 @@ public enum SingletonEnum {
/** @return someInt */
public int getSomeInt() {
return someInt;
return this.someInt;
}
/**
@@ -47,7 +47,7 @@ public enum SingletonEnum {
/** @return someString */
public String getSomeString() {
return someString;
return this.someString;
}
/**
@@ -53,6 +53,7 @@ public class WeirdList {
* index to get
* @return the value at the index
*/
@SuppressWarnings("boxing")
public int getInt(int i) {
return this.list.get(i);
}