Skip to content

Commit 9498f60

Browse files
committed
replace deprecated constructors like new Double(double) with valueOf
1 parent da87539 commit 9498f60

5 files changed

Lines changed: 11 additions & 12 deletions

File tree

jri/RFactor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public RFactor(int[] i, String[] v) {
3939
int j;
4040
if (i!=null && i.length>0)
4141
for(j=0;j<i.length;j++)
42-
id.addElement(new Integer(i[j]-base));
42+
id.addElement(Integer.valueOf(i[j] - base));
4343
if (v!=null && v.length>0)
4444
for(j=0;j<v.length;j++)
4545
val.addElement(v[j]);
@@ -53,7 +53,7 @@ public void add(String v) {
5353
i=val.size();
5454
val.addElement(v);
5555
};
56-
id.addElement(new Integer(i));
56+
id.addElement(Integer.valueOf(i));
5757
}
5858

5959
/** returns name for a specific ID

src/java/RJavaArrayTools.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,23 +738,23 @@ public static Double[] boxDoubles(double[] d) {
738738
if (d == null) return null;
739739
int i = 0, n = d.length;
740740
Double o[] = new Double[i];
741-
for (i = 0; i < n; i++) if (!isNA(d[i])) o[i] = new Double(d[i]);
741+
for (i = 0; i < n; i++) if (!isNA(d[i])) o[i] = Double.valueOf(d[i]);
742742
return o;
743743
}
744744

745745
public static Integer[] boxIntegers(int[] d) {
746746
if (d == null) return null;
747747
int i = 0, n = d.length;
748748
Integer o[] = new Integer[i];
749-
for (i = 0; i < n; i++) if (d[i] != NA_INTEGER) o[i] = new Integer(d[i]);
749+
for (i = 0; i < n; i++) if (d[i] != NA_INTEGER) o[i] = Integer.valueOf(d[i]);
750750
return o;
751751
}
752752

753753
public static Boolean[] boxBooleans(int[] d) {
754754
if (d == null) return null;
755755
int i = 0, n = d.length;
756756
Boolean o[] = new Boolean[i];
757-
for (i = 0; i < n; i++) if (d[i] != NA_INTEGER) o[i] = new Boolean((d[i] == 0) ? false : true);
757+
for (i = 0; i < n; i++) if (d[i] != NA_INTEGER) o[i] = Boolean.valueOf((d[i] == 0) ? false : true);
758758
return o;
759759
}
760760
}

src/java/RJavaArrayTools_Test.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private static void getdimlength() throws TestException{
237237
System.out.print( " new Double('10.2') " ) ;
238238
boolean ok = false;
239239
try{
240-
RJavaArrayTools.getDimensionLength( new Double("10.3") ) ;
240+
RJavaArrayTools.getDimensionLength( Double.valueOf(10.3) ) ;
241241
} catch( NotAnArrayException e){
242242
ok = true ;
243243
}
@@ -505,7 +505,7 @@ private static void getdims() throws TestException{
505505
System.out.print( " new Double('10.2') " ) ;
506506
boolean ok = false;
507507
try{
508-
res = RJavaArrayTools.getDimensions( new Double("10.3") ) ;
508+
res = RJavaArrayTools.getDimensions( Double.valueOf(10.3) ) ;
509509
} catch( NotAnArrayException e){
510510
ok = true ;
511511
}
@@ -736,7 +736,7 @@ private static void gettruelength() throws TestException{
736736
System.out.print( " new Double('10.2') " ) ;
737737
boolean ok = false;
738738
try{
739-
res = RJavaArrayTools.getTrueLength( new Double("10.3") ) ;
739+
res = RJavaArrayTools.getTrueLength( Double.valueOf(10.3) ) ;
740740
} catch( NotAnArrayException e){
741741
ok = true ;
742742
}
@@ -1303,7 +1303,7 @@ private static void gettypename() throws TestException {
13031303
System.out.print( " new Double('10.2') " ) ;
13041304
boolean ok = false;
13051305
try{
1306-
res = RJavaArrayTools.getObjectTypeName( new Double("10.3") ) ;
1306+
res = RJavaArrayTools.getObjectTypeName( Double.valueOf(10.3) ) ;
13071307
} catch( NotAnArrayException e){
13081308
ok = true ;
13091309
}

src/java/RJavaClassLoader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public URL getResource(String name ){
161161
try{
162162
urlPrefix = "jar:" + toURL().toString() + "!" ;
163163
} catch( java.net.MalformedURLException ex){
164-
} catch( java.io.IOException ex){
165164
}
166165
}
167166

src/java/RJavaComparator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public static int compare( Object a, Object b ) throws NotComparableException{
2828

2929
// treat Number s separately
3030
if( a instanceof Number && b instanceof Number && !( a.getClass() == b.getClass() ) ){
31-
Double _a = new Double( ((Number)a).doubleValue() );
32-
Double _b = new Double( ((Number)b).doubleValue() );
31+
Double _a = Double.valueOf( ((Number)a).doubleValue() );
32+
Double _b = Double.valueOf( ((Number)b).doubleValue() );
3333
return _a.compareTo( _b );
3434
}
3535

0 commit comments

Comments
 (0)