JAL-4152 Remove redundant casts from getInstance usages. JAL-4152-typed-singleton-provider
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 24 Mar 2023 15:44:38 +0000 (16:44 +0100)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 24 Mar 2023 15:44:38 +0000 (16:44 +0100)
24 files changed:
src/jalview/analysis/AlignmentSorter.java
src/jalview/analysis/scoremodels/ScoreModels.java
src/jalview/bin/Cache.java
src/jalview/bin/Jalview.java
src/jalview/datamodel/features/FeatureAttributes.java
src/jalview/datamodel/features/FeatureSources.java
src/jalview/fts/service/pdb/PDBFTSRestClient.java
src/jalview/fts/service/uniprot/UniProtFTSRestClient.java
src/jalview/gui/Desktop.java
src/jalview/httpserver/HttpServer.java
src/jalview/io/FileFormats.java
src/jalview/io/cache/AppCache.java
src/jalview/io/gff/SequenceOntologyFactory.java
src/jalview/rest/RestHandler.java
src/jalview/schemes/ColourSchemes.java
src/jalview/structure/StructureImportSettings.java
src/jalview/structure/StructureSelectionManager.java
src/jalview/urls/IdOrgSettings.java
src/jalview/ws/SequenceFetcher.java
src/jalview/ws/jws1/Discoverer.java
src/jalview/ws/jws2/Jws2Discoverer.java
src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java
src/jalview/ws/rest/RestClient.java
src/jalview/ws/sifts/SiftsSettings.java

index f2b2222..2aca5f3 100755 (executable)
@@ -64,8 +64,7 @@ public class AlignmentSorter implements ApplicationSingletonI
 
   public static AlignmentSorter getInstance()
   {
-    return (AlignmentSorter) ApplicationSingletonProvider
-            .getInstance(AlignmentSorter.class);
+    return ApplicationSingletonProvider.getInstance(AlignmentSorter.class);
   }
 
   /**
index 8700ec0..39aa242 100644 (file)
@@ -45,7 +45,7 @@ public class ScoreModels implements ApplicationSingletonI
    */
   public static ScoreModels getInstance()
   {
-    return (ScoreModels) ApplicationSingletonProvider.getInstance(ScoreModels.class);
+    return ApplicationSingletonProvider.getInstance(ScoreModels.class);
   }
 
   /**
index 8a06b7b..ac04bf7 100755 (executable)
@@ -241,7 +241,7 @@ public class Cache implements ApplicationSingletonI
    */
   public static Cache getInstance()
   {
-    return (Cache) ApplicationSingletonProvider.getInstance(Cache.class);
+    return ApplicationSingletonProvider.getInstance(Cache.class);
   }
   /**
    * property giving log4j level for CASTOR loggers
index 7a8c786..e1fd572 100755 (executable)
@@ -125,8 +125,7 @@ public class Jalview implements ApplicationSingletonI
   // }
   public static Jalview getInstance()
   {
-    return (Jalview) ApplicationSingletonProvider
-            .getInstance(Jalview.class);
+    return ApplicationSingletonProvider.getInstance(Jalview.class);
   }
 
   private Jalview()
index a57fd55..cc32757 100644 (file)
@@ -44,8 +44,7 @@ public class FeatureAttributes implements ApplicationSingletonI
 
   public static FeatureAttributes getInstance()
   {
-    return (FeatureAttributes) ApplicationSingletonProvider
-            .getInstance(FeatureAttributes.class);
+    return ApplicationSingletonProvider.getInstance(FeatureAttributes.class);
   }
 
   private FeatureAttributes()
index 4a87349..56a3e99 100644 (file)
@@ -38,8 +38,7 @@ public class FeatureSources implements ApplicationSingletonI
 
   public static FeatureSources getInstance()
   {
-    return (FeatureSources) ApplicationSingletonProvider
-            .getInstance(FeatureSources.class);
+    return ApplicationSingletonProvider.getInstance(FeatureSources.class);
   }
 
   private Map<String, FeatureSourceI> sources;
index 6e352d4..186ed31 100644 (file)
@@ -73,8 +73,7 @@ public class PDBFTSRestClient extends FTSRestClient
 
   public static FTSRestClientI getInstance()
   {
-    return (FTSRestClientI) ApplicationSingletonProvider
-            .getInstance(PDBFTSRestClient.class);
+    return ApplicationSingletonProvider.getInstance(PDBFTSRestClient.class);
   }
   protected PDBFTSRestClient()
   {
index f2a9265..d2d8690 100644 (file)
@@ -81,7 +81,7 @@ public class UniProtFTSRestClient extends FTSRestClient
 {
 public static UniProtFTSRestClient getInstance()
 {
-return (UniProtFTSRestClient) ApplicationSingletonProvider
+return ApplicationSingletonProvider
     .getInstance(UniProtFTSRestClient.class);
 }
   private static final String DEFAULT_UNIPROT_DOMAIN = "https://rest.uniprot.org";
index b125cc2..3931a64 100644 (file)
@@ -259,8 +259,7 @@ public class Desktop extends GDesktop
   public static Desktop getInstance()
   {
     return Jalview.isHeadlessMode() ? null
-            : (Desktop) ApplicationSingletonProvider
-                    .getInstance(Desktop.class);
+            : ApplicationSingletonProvider.getInstance(Desktop.class);
   }
 
   public static StructureSelectionManager getStructureSelectionManager()
index 7021fae..70e9fc5 100644 (file)
@@ -63,7 +63,7 @@ public class HttpServer implements ApplicationSingletonI
   {
     synchronized (HttpServer.class)
     {
-      return (HttpServer) ApplicationSingletonProvider.getInstance(HttpServer.class);
+      return ApplicationSingletonProvider.getInstance(HttpServer.class);
     }
   }
   
index b0d5d17..d4369bd 100644 (file)
@@ -45,7 +45,7 @@ public class FileFormats implements ApplicationSingletonI
 {
   public static FileFormats getInstance()
   {
-    return (FileFormats) ApplicationSingletonProvider.getInstance(FileFormats.class);
+    return ApplicationSingletonProvider.getInstance(FileFormats.class);
   }
 
   /**
index fdcad08..65acd9c 100644 (file)
@@ -38,7 +38,7 @@ public class AppCache implements ApplicationSingletonI
 
   public static AppCache getInstance()
   {
-    return (AppCache) ApplicationSingletonProvider.getInstance(AppCache.class);
+    return ApplicationSingletonProvider.getInstance(AppCache.class);
   }
 
   private AppCache()
index 08a2c6a..70c63ec 100644 (file)
@@ -44,7 +44,7 @@ public class SequenceOntologyFactory implements ApplicationSingletonI
    */
   private static synchronized SequenceOntologyFactory getInstance()
   {
-    return (SequenceOntologyFactory) ApplicationSingletonProvider
+    return ApplicationSingletonProvider
             .getInstance(SequenceOntologyFactory.class);
   }
 
index 7c8c9a6..987ffee 100644 (file)
@@ -51,7 +51,7 @@ public class RestHandler extends AbstractRequestHandler
   {
     synchronized (RestHandler.class)
     {
-      return (RestHandler) ApplicationSingletonProvider.getInstance(RestHandler.class);
+      return ApplicationSingletonProvider.getInstance(RestHandler.class);
     }
   }
 
index 18f24fb..9e64e33 100644 (file)
@@ -44,8 +44,7 @@ public class ColourSchemes implements ApplicationSingletonI
    */
   public static ColourSchemes getInstance()
   {
-    return (ColourSchemes) ApplicationSingletonProvider
-            .getInstance(ColourSchemes.class);
+    return ApplicationSingletonProvider.getInstance(ColourSchemes.class);
   }
 
   private ColourSchemes()
index 0489e1f..9edcda0 100644 (file)
@@ -46,7 +46,7 @@ public class StructureImportSettings implements ApplicationSingletonI
 
   private static StructureImportSettings getInstance()
   {
-    return (StructureImportSettings) ApplicationSingletonProvider
+    return ApplicationSingletonProvider
             .getInstance(StructureImportSettings.class);
   }
   /**
index ae5431b..7d936ef 100644 (file)
@@ -100,7 +100,7 @@ public class StructureSelectionManager implements ApplicationSingletonI
    */
   private static StructureSelectionManager getInstance()
   {
-    return (StructureSelectionManager) ApplicationSingletonProvider
+    return ApplicationSingletonProvider
             .getInstance(StructureSelectionManager.class);
   }
 
index 7c38ab6..f7577e1 100644 (file)
@@ -35,8 +35,7 @@ public class IdOrgSettings implements ApplicationSingletonI
 
   private static IdOrgSettings getInstance()
   {
-    return (IdOrgSettings) ApplicationSingletonProvider
-            .getInstance(IdOrgSettings.class);
+    return ApplicationSingletonProvider.getInstance(IdOrgSettings.class);
   }
 
   private IdOrgSettings()
index 35a237e..977c53a 100644 (file)
@@ -71,8 +71,7 @@ public class SequenceFetcher extends ASequenceFetcher implements ApplicationSing
   public static SequenceFetcher getInstance()
   {
     return mockFetcher != null ? mockFetcher
-            : (SequenceFetcher) ApplicationSingletonProvider
-                    .getInstance(SequenceFetcher.class);
+            : ApplicationSingletonProvider.getInstance(SequenceFetcher.class);
   }
 
   /**
index a5b73da..37fe109 100644 (file)
@@ -42,7 +42,7 @@ public class Discoverer implements Runnable, ApplicationSingletonI
 {
   public static Discoverer getInstance()
   {
-    return (Discoverer) ApplicationSingletonProvider.getInstance(Discoverer.class);
+    return ApplicationSingletonProvider.getInstance(Discoverer.class);
   }
 
   private Discoverer()
index 56a4b77..0aa4881 100644 (file)
@@ -70,8 +70,7 @@ public class Jws2Discoverer implements WSDiscovererI, Runnable, ApplicationSingl
    */
   public static Jws2Discoverer getInstance()
   {
-    return (Jws2Discoverer) ApplicationSingletonProvider
-            .getInstance(Jws2Discoverer.class);
+    return ApplicationSingletonProvider.getInstance(Jws2Discoverer.class);
   }
   public static final String COMPBIO_JABAWS = "http://www.compbio.dundee.ac.uk/jabaws";
 
index 8eeef4d..2db7ac5 100644 (file)
@@ -40,8 +40,7 @@ public class Jws2InstanceFactory implements ApplicationSingletonI
 
   private static Jws2InstanceFactory getInstance()
   {
-    return (Jws2InstanceFactory) ApplicationSingletonProvider
-            .getInstance(Jws2InstanceFactory.class);
+    return ApplicationSingletonProvider.getInstance(Jws2InstanceFactory.class);
   }
 
   private HashMap<String, AlignAnalysisUIText> aaConGUI;
index 0394fea..13cbd94 100644 (file)
@@ -61,7 +61,7 @@ implements WSClientI, WSMenuEntryProviderI, ApplicationSingletonI
   
 private static RestClient getInstance()
 {
-return (RestClient) ApplicationSingletonProvider.getInstance(RestClient.class);
+return ApplicationSingletonProvider.getInstance(RestClient.class);
 }
 
 public static final String RSBS_SERVICES = "RSBS_SERVICES";
index 1c25a34..7836adc 100644 (file)
@@ -34,8 +34,7 @@ public class SiftsSettings implements ApplicationSingletonI
    */
   private static SiftsSettings getInstance()
   {
-    return (SiftsSettings) ApplicationSingletonProvider
-            .getInstance(SiftsSettings.class);
+    return ApplicationSingletonProvider.getInstance(SiftsSettings.class);
   }
 
   private SiftsSettings()