Skip to content

Commit b059b50

Browse files
committed
Removed redundant primitive boxing. shannah#29
1 parent 8dff082 commit b059b50

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/ca/weblite/objc/RuntimeUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ public static int msgInt(Pointer receiver, String selector, Object... args){
384384
*/
385385
public static boolean msgBoolean(Pointer receiver, Pointer selector, Object... args){
386386
long res = msg(receiver, selector, args);
387-
return res > 0L ? true : false;
387+
return res > 0L;
388388
}
389389

390390
/**
@@ -821,7 +821,7 @@ public static ByReference getAsReferenceWrapper(Object val, String signature){
821821
if ( Number.class.isInstance(val) ){
822822
val = ((Number)val).intValue();
823823
} else if ( String.class.isInstance(val)){
824-
val = Integer.parseInt((String)val);
824+
val = Integer.valueOf((String) val);
825825
} else {
826826
throw new RuntimeException("Attempt to pass ineligible value to int: "+val);
827827
}
@@ -833,7 +833,7 @@ public static ByReference getAsReferenceWrapper(Object val, String signature){
833833
if ( Number.class.isInstance(val) ){
834834
val = ((Number)val).shortValue();
835835
} else if ( String.class.isInstance(val)){
836-
val = new Integer(Integer.parseInt((String)val)).shortValue();
836+
val = Short.valueOf((String) val);
837837
} else {
838838
throw new RuntimeException("Attempt to pass ineligible value to short: "+val);
839839
}
@@ -848,7 +848,7 @@ public static ByReference getAsReferenceWrapper(Object val, String signature){
848848
if ( Number.class.isInstance(val) ){
849849
val = ((Number)val).longValue();
850850
} else if ( String.class.isInstance(val)){
851-
val = new Long(Long.parseLong((String)val)).longValue();
851+
val = Long.valueOf((String) val);
852852
} else {
853853
throw new RuntimeException("Attempt to pass ineligible value to long: "+val);
854854
}
@@ -860,7 +860,7 @@ public static ByReference getAsReferenceWrapper(Object val, String signature){
860860
if ( Number.class.isInstance(val) ){
861861
val = ((Number)val).floatValue();
862862
} else if ( String.class.isInstance(val)){
863-
val = new Float(Float.parseFloat((String)val)).floatValue();
863+
val = Float.valueOf((String) val);
864864
} else {
865865
throw new RuntimeException("Attempt to pass ineligible value to long: "+val);
866866
}
@@ -872,7 +872,7 @@ public static ByReference getAsReferenceWrapper(Object val, String signature){
872872
if ( Number.class.isInstance(val) ){
873873
val = ((Number)val).doubleValue();
874874
} else if ( String.class.isInstance(val)){
875-
val = new Double(Double.parseDouble((String)val)).doubleValue();
875+
val = Double.valueOf((String) val);
876876
} else {
877877
throw new RuntimeException("Attempt to pass ineligible value to long: "+val);
878878
}
@@ -887,7 +887,7 @@ public static ByReference getAsReferenceWrapper(Object val, String signature){
887887
} else if (Number.class.isInstance(val)) {
888888
val = ((Number) val).byteValue();
889889
} else if (String.class.isInstance(val)) {
890-
val = new Byte(Byte.parseByte((String) val)).byteValue();
890+
val = Byte.valueOf((String) val);
891891
} else {
892892
throw new RuntimeException("Attempt to pass ineligible value to byte: " + val);
893893
}

0 commit comments

Comments
 (0)