From cf04d0714f5d7686f47201d42d63df80b4ebf10d Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Fri, 24 Mar 2023 16:44:38 +0100 Subject: [PATCH] JAL-4152 Remove redundant casts from getInstance usages. --- src/jalview/analysis/AlignmentSorter.java | 3 +-- src/jalview/analysis/scoremodels/ScoreModels.java | 2 +- src/jalview/bin/Cache.java | 2 +- src/jalview/bin/Jalview.java | 3 +-- src/jalview/datamodel/features/FeatureAttributes.java | 3 +-- src/jalview/datamodel/features/FeatureSources.java | 3 +-- src/jalview/fts/service/pdb/PDBFTSRestClient.java | 3 +-- src/jalview/fts/service/uniprot/UniProtFTSRestClient.java | 2 +- src/jalview/gui/Desktop.java | 3 +-- src/jalview/httpserver/HttpServer.java | 2 +- src/jalview/io/FileFormats.java | 2 +- src/jalview/io/cache/AppCache.java | 2 +- src/jalview/io/gff/SequenceOntologyFactory.java | 2 +- src/jalview/rest/RestHandler.java | 2 +- src/jalview/schemes/ColourSchemes.java | 3 +-- src/jalview/structure/StructureImportSettings.java | 2 +- src/jalview/structure/StructureSelectionManager.java | 2 +- src/jalview/urls/IdOrgSettings.java | 3 +-- src/jalview/ws/SequenceFetcher.java | 3 +-- src/jalview/ws/jws1/Discoverer.java | 2 +- src/jalview/ws/jws2/Jws2Discoverer.java | 3 +-- src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java | 3 +-- src/jalview/ws/rest/RestClient.java | 2 +- src/jalview/ws/sifts/SiftsSettings.java | 3 +-- 24 files changed, 24 insertions(+), 36 deletions(-) diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index f2b2222..2aca5f3 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -64,8 +64,7 @@ public class AlignmentSorter implements ApplicationSingletonI public static AlignmentSorter getInstance() { - return (AlignmentSorter) ApplicationSingletonProvider - .getInstance(AlignmentSorter.class); + return ApplicationSingletonProvider.getInstance(AlignmentSorter.class); } /** diff --git a/src/jalview/analysis/scoremodels/ScoreModels.java b/src/jalview/analysis/scoremodels/ScoreModels.java index 8700ec0..39aa242 100644 --- a/src/jalview/analysis/scoremodels/ScoreModels.java +++ b/src/jalview/analysis/scoremodels/ScoreModels.java @@ -45,7 +45,7 @@ public class ScoreModels implements ApplicationSingletonI */ public static ScoreModels getInstance() { - return (ScoreModels) ApplicationSingletonProvider.getInstance(ScoreModels.class); + return ApplicationSingletonProvider.getInstance(ScoreModels.class); } /** diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 8a06b7b..ac04bf7 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -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 diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 7a8c786..e1fd572 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -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() diff --git a/src/jalview/datamodel/features/FeatureAttributes.java b/src/jalview/datamodel/features/FeatureAttributes.java index a57fd55..cc32757 100644 --- a/src/jalview/datamodel/features/FeatureAttributes.java +++ b/src/jalview/datamodel/features/FeatureAttributes.java @@ -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() diff --git a/src/jalview/datamodel/features/FeatureSources.java b/src/jalview/datamodel/features/FeatureSources.java index 4a87349..56a3e99 100644 --- a/src/jalview/datamodel/features/FeatureSources.java +++ b/src/jalview/datamodel/features/FeatureSources.java @@ -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 sources; diff --git a/src/jalview/fts/service/pdb/PDBFTSRestClient.java b/src/jalview/fts/service/pdb/PDBFTSRestClient.java index 6e352d4..186ed31 100644 --- a/src/jalview/fts/service/pdb/PDBFTSRestClient.java +++ b/src/jalview/fts/service/pdb/PDBFTSRestClient.java @@ -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() { diff --git a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java index f2a9265..d2d8690f 100644 --- a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java +++ b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java @@ -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"; diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index b125cc2..3931a64 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -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() diff --git a/src/jalview/httpserver/HttpServer.java b/src/jalview/httpserver/HttpServer.java index 7021fae..70e9fc5 100644 --- a/src/jalview/httpserver/HttpServer.java +++ b/src/jalview/httpserver/HttpServer.java @@ -63,7 +63,7 @@ public class HttpServer implements ApplicationSingletonI { synchronized (HttpServer.class) { - return (HttpServer) ApplicationSingletonProvider.getInstance(HttpServer.class); + return ApplicationSingletonProvider.getInstance(HttpServer.class); } } diff --git a/src/jalview/io/FileFormats.java b/src/jalview/io/FileFormats.java index b0d5d17..d4369bd 100644 --- a/src/jalview/io/FileFormats.java +++ b/src/jalview/io/FileFormats.java @@ -45,7 +45,7 @@ public class FileFormats implements ApplicationSingletonI { public static FileFormats getInstance() { - return (FileFormats) ApplicationSingletonProvider.getInstance(FileFormats.class); + return ApplicationSingletonProvider.getInstance(FileFormats.class); } /** diff --git a/src/jalview/io/cache/AppCache.java b/src/jalview/io/cache/AppCache.java index fdcad08..65acd9c 100644 --- a/src/jalview/io/cache/AppCache.java +++ b/src/jalview/io/cache/AppCache.java @@ -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() diff --git a/src/jalview/io/gff/SequenceOntologyFactory.java b/src/jalview/io/gff/SequenceOntologyFactory.java index 08a2c6a..70c63ec 100644 --- a/src/jalview/io/gff/SequenceOntologyFactory.java +++ b/src/jalview/io/gff/SequenceOntologyFactory.java @@ -44,7 +44,7 @@ public class SequenceOntologyFactory implements ApplicationSingletonI */ private static synchronized SequenceOntologyFactory getInstance() { - return (SequenceOntologyFactory) ApplicationSingletonProvider + return ApplicationSingletonProvider .getInstance(SequenceOntologyFactory.class); } diff --git a/src/jalview/rest/RestHandler.java b/src/jalview/rest/RestHandler.java index 7c8c9a6..987ffee 100644 --- a/src/jalview/rest/RestHandler.java +++ b/src/jalview/rest/RestHandler.java @@ -51,7 +51,7 @@ public class RestHandler extends AbstractRequestHandler { synchronized (RestHandler.class) { - return (RestHandler) ApplicationSingletonProvider.getInstance(RestHandler.class); + return ApplicationSingletonProvider.getInstance(RestHandler.class); } } diff --git a/src/jalview/schemes/ColourSchemes.java b/src/jalview/schemes/ColourSchemes.java index 18f24fb..9e64e33 100644 --- a/src/jalview/schemes/ColourSchemes.java +++ b/src/jalview/schemes/ColourSchemes.java @@ -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() diff --git a/src/jalview/structure/StructureImportSettings.java b/src/jalview/structure/StructureImportSettings.java index 0489e1f..9edcda0 100644 --- a/src/jalview/structure/StructureImportSettings.java +++ b/src/jalview/structure/StructureImportSettings.java @@ -46,7 +46,7 @@ public class StructureImportSettings implements ApplicationSingletonI private static StructureImportSettings getInstance() { - return (StructureImportSettings) ApplicationSingletonProvider + return ApplicationSingletonProvider .getInstance(StructureImportSettings.class); } /** diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index ae5431b..7d936ef 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -100,7 +100,7 @@ public class StructureSelectionManager implements ApplicationSingletonI */ private static StructureSelectionManager getInstance() { - return (StructureSelectionManager) ApplicationSingletonProvider + return ApplicationSingletonProvider .getInstance(StructureSelectionManager.class); } diff --git a/src/jalview/urls/IdOrgSettings.java b/src/jalview/urls/IdOrgSettings.java index 7c38ab6..f7577e1 100644 --- a/src/jalview/urls/IdOrgSettings.java +++ b/src/jalview/urls/IdOrgSettings.java @@ -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() diff --git a/src/jalview/ws/SequenceFetcher.java b/src/jalview/ws/SequenceFetcher.java index 35a237e..977c53a 100644 --- a/src/jalview/ws/SequenceFetcher.java +++ b/src/jalview/ws/SequenceFetcher.java @@ -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); } /** diff --git a/src/jalview/ws/jws1/Discoverer.java b/src/jalview/ws/jws1/Discoverer.java index a5b73da..37fe109 100644 --- a/src/jalview/ws/jws1/Discoverer.java +++ b/src/jalview/ws/jws1/Discoverer.java @@ -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() diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index 56a4b77..0aa4881 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -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"; diff --git a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java index 8eeef4d..2db7ac5 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java @@ -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 aaConGUI; diff --git a/src/jalview/ws/rest/RestClient.java b/src/jalview/ws/rest/RestClient.java index 0394fea..13cbd94 100644 --- a/src/jalview/ws/rest/RestClient.java +++ b/src/jalview/ws/rest/RestClient.java @@ -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"; diff --git a/src/jalview/ws/sifts/SiftsSettings.java b/src/jalview/ws/sifts/SiftsSettings.java index 1c25a34..7836adc 100644 --- a/src/jalview/ws/sifts/SiftsSettings.java +++ b/src/jalview/ws/sifts/SiftsSettings.java @@ -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() -- 1.7.10.2