JAL-3135 Fixed remaining 'new *Type*()' -> '*Type*.valueOf()' deprecated methods
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 27 Nov 2024 09:10:43 +0000 (09:10 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Wed, 27 Nov 2024 09:10:43 +0000 (09:10 +0000)
src/jalview/gui/FeatureEditor.java
src/mc_view/Atom.java
src/org/json/simple/parser/JSONParser.java
src/org/json/simple/parser/Yylex.java

index 880a1b2..b292c06 100644 (file)
@@ -310,8 +310,8 @@ public class FeatureEditor
             name.setText(sf.getType());
             description.setText(sf.getDescription());
             group.setText(sf.getFeatureGroup());
-            start.setValue(new Integer(sf.getBegin()));
-            end.setValue(new Integer(sf.getEnd()));
+            start.setValue(Integer.valueOf(sf.getBegin()));
+            end.setValue(Integer.valueOf(sf.getEnd()));
             ((SpinnerNumberModel) start.getModel()).setMaximum(sf.getEnd());
             ((SpinnerNumberModel) end.getModel()).setMinimum(sf.getBegin());
 
@@ -399,8 +399,8 @@ public class FeatureEditor
     name.setText(featureType);
     group.setText(featureGroup);
 
-    start.setValue(new Integer(firstFeature.getBegin()));
-    end.setValue(new Integer(firstFeature.getEnd()));
+    start.setValue(Integer.valueOf(firstFeature.getBegin()));
+    end.setValue(Integer.valueOf(firstFeature.getEnd()));
     ((SpinnerNumberModel) start.getModel())
             .setMaximum(firstFeature.getEnd());
     ((SpinnerNumberModel) end.getModel())
index 3b4f409..181c32b 100755 (executable)
@@ -83,14 +83,14 @@ public class Atom
     resNumber = Integer.parseInt(str.substring(22, 26).trim());
     resNumIns = str.substring(22, 27).trim();
     insCode = str.substring(26, 27).charAt(0);
-    this.x = (new Float(str.substring(30, 38).trim()).floatValue());
-    this.y = (new Float(str.substring(38, 46).trim()).floatValue());
-    this.z = (new Float(str.substring(47, 55).trim()).floatValue());
+    this.x = (Float.valueOf(str.substring(30, 38).trim()).floatValue());
+    this.y = (Float.valueOf(str.substring(38, 46).trim()).floatValue());
+    this.z = (Float.valueOf(str.substring(47, 55).trim()).floatValue());
     // optional entries - see JAL-730
     String tm = str.substring(54, 60).trim();
     if (tm.length() > 0)
     {
-      occupancy = (new Float(tm)).floatValue();
+      occupancy = (Float.valueOf(tm)).floatValue();
     }
     else
     {
@@ -100,7 +100,7 @@ public class Atom
     tm = str.substring(60, 66).trim();
     if (tm.length() > 0)
     {
-      tfactor = (new Float(tm).floatValue());
+      tfactor = (Float.valueOf(tm).floatValue());
     }
     else
     {
index 70e04cc..a7ee2cd 100644 (file)
@@ -147,17 +147,17 @@ public class JSONParser
           {
           case Yytoken.TYPE_VALUE:
             status = S_IN_FINISHED_VALUE;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             valueStack.addFirst(token.value);
             break;
           case Yytoken.TYPE_LEFT_BRACE:
             status = S_IN_OBJECT;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             valueStack.addFirst(createObjectContainer(containerFactory));
             break;
           case Yytoken.TYPE_LEFT_SQUARE:
             status = S_IN_ARRAY;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             valueStack.addFirst(createArrayContainer(containerFactory));
             break;
           default:
@@ -183,7 +183,7 @@ public class JSONParser
               String key = (String) token.value;
               valueStack.addFirst(key);
               status = S_PASSED_PAIR_KEY;
-              statusStack.addFirst(new Integer(status));
+              statusStack.addFirst(Integer.valueOf(status));
             }
             else
             {
@@ -227,7 +227,7 @@ public class JSONParser
             List newArray = createArrayContainer(containerFactory);
             parent.put(key, newArray);
             status = S_IN_ARRAY;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             valueStack.addFirst(newArray);
             break;
           case Yytoken.TYPE_LEFT_BRACE:
@@ -237,7 +237,7 @@ public class JSONParser
             Map newObject = createObjectContainer(containerFactory);
             parent.put(key, newObject);
             status = S_IN_OBJECT;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             valueStack.addFirst(newObject);
             break;
           default:
@@ -271,7 +271,7 @@ public class JSONParser
             Map newObject = createObjectContainer(containerFactory);
             val.add(newObject);
             status = S_IN_OBJECT;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             valueStack.addFirst(newObject);
             break;
           case Yytoken.TYPE_LEFT_SQUARE:
@@ -279,7 +279,7 @@ public class JSONParser
             List newArray = createArrayContainer(containerFactory);
             val.add(newArray);
             status = S_IN_ARRAY;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             valueStack.addFirst(newArray);
             break;
           default:
@@ -412,19 +412,19 @@ public class JSONParser
           {
           case Yytoken.TYPE_VALUE:
             status = S_IN_FINISHED_VALUE;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             if (!contentHandler.primitive(token.value))
               return;
             break;
           case Yytoken.TYPE_LEFT_BRACE:
             status = S_IN_OBJECT;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             if (!contentHandler.startObject())
               return;
             break;
           case Yytoken.TYPE_LEFT_SQUARE:
             status = S_IN_ARRAY;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             if (!contentHandler.startArray())
               return;
             break;
@@ -459,7 +459,7 @@ public class JSONParser
             {
               String key = (String) token.value;
               status = S_PASSED_PAIR_KEY;
-              statusStack.addFirst(new Integer(status));
+              statusStack.addFirst(Integer.valueOf(status));
               if (!contentHandler.startObjectEntry(key))
                 return;
             }
@@ -503,17 +503,17 @@ public class JSONParser
             break;
           case Yytoken.TYPE_LEFT_SQUARE:
             statusStack.removeFirst();
-            statusStack.addFirst(new Integer(S_IN_PAIR_VALUE));
+            statusStack.addFirst(Integer.valueOf(S_IN_PAIR_VALUE));
             status = S_IN_ARRAY;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             if (!contentHandler.startArray())
               return;
             break;
           case Yytoken.TYPE_LEFT_BRACE:
             statusStack.removeFirst();
-            statusStack.addFirst(new Integer(S_IN_PAIR_VALUE));
+            statusStack.addFirst(Integer.valueOf(S_IN_PAIR_VALUE));
             status = S_IN_OBJECT;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             if (!contentHandler.startObject())
               return;
             break;
@@ -558,13 +558,13 @@ public class JSONParser
             break;
           case Yytoken.TYPE_LEFT_BRACE:
             status = S_IN_OBJECT;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             if (!contentHandler.startObject())
               return;
             break;
           case Yytoken.TYPE_LEFT_SQUARE:
             status = S_IN_ARRAY;
-            statusStack.addFirst(new Integer(status));
+            statusStack.addFirst(Integer.valueOf(status));
             if (!contentHandler.startArray())
               return;
             break;
index 7998faf..a4af571 100644 (file)
@@ -2,6 +2,8 @@
 
 package org.json.simple.parser;
 
+import java.io.InputStreamReader;
+
 class Yylex
 {
 
@@ -244,7 +246,7 @@ class Yylex
   private boolean zzAtEOF;
 
   /* user code: */
-  private StringBuffer sb = new StringBuffer();
+  private StringBuilder sb = new StringBuilder();
 
   int getPosition()
   {
@@ -272,7 +274,7 @@ class Yylex
    */
   Yylex(java.io.InputStream in)
   {
-    this(new java.io.InputStreamReader(in));
+    this(new InputStreamReader(in));
   }
 
   /**
@@ -588,7 +590,7 @@ class Yylex
       case 4:
       {
         sb = null;
-        sb = new StringBuffer();
+        sb = new StringBuilder();
         yybegin(STRING_BEGIN);
       }
       case 26:
@@ -642,7 +644,7 @@ class Yylex
       {
         throw new ParseException(yychar,
                 ParseException.ERROR_UNEXPECTED_CHAR,
-                new Character(yycharat(0)));
+                Character.valueOf(yycharat(0)));
       }
       case 34:
         break;