From 113e2cef76ce10992b45f6009c12a5643f7226a9 Mon Sep 17 00:00:00 2001 From: BradWalker Date: Sat, 6 Jul 2024 20:52:05 -0600 Subject: [PATCH] Reduce redundant cast warnings. These happen as a side result of code cleanup.. Reduce warnings that look like this: [repeat] /home/bwalker/src/netbeans/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/LogManager.java:271: warning: [cast] redundant cast to LogViewer [repeat] contextLog = (LogViewer)contextLogViewers.get(moduleID); [repeat] ^Cleanup redundant casts. These are a side effect of work done doing code cleanup. --- .../web/beans/completion/CCPaintComponent.java | 2 +- .../modules/payara/eecommon/api/DomainEditor.java | 2 +- .../modules/tomcat5/optional/StartTomcat.java | 2 +- .../netbeans/modules/tomcat5/util/LogManager.java | 2 +- .../graph/actions/SystemFileSystemSupport.java | 2 +- .../netbeans/modules/web/monitor/client/Util.java | 4 ++-- .../modules/web/project/WebActionProvider.java | 2 +- .../modules/web/project/WebJPAModuleInfo.java | 2 +- .../web/project/api/WebProjectUtilities.java | 2 +- .../web/project/jaxws/WebProjectJAXWSSupport.java | 2 +- .../web/project/ui/ConfFilesNodeFactory.java | 13 ++++++------- .../project/ui/customizer/WebProjectProperties.java | 12 ++++++------ .../websvc/api/client/WebServicesClientView.java | 2 +- .../websvc/api/jaxws/client/JAXWSClientView.java | 2 +- .../modules/websvc/rest/MiscPrivateUtilities.java | 3 +-- .../antproject/base/AbstractGroovyExtender.java | 2 +- .../querybuilder/QueryBuilderMetaData.java | 10 +++++----- .../querybuilder/QueryBuilderResultTable.java | 2 +- .../modules/db/explorer/dlg/AddDriverDialog.java | 2 +- .../modules/xml/dtd/grammar/ContentModel.java | 2 +- .../xml/multiview/XmlMultiViewDataObject.java | 2 +- .../xml/multiview/XmlMultiViewEditorSupport.java | 2 +- .../xml/tax/cookies/TreeEditorCookieImpl.java | 2 +- .../modules/xsl/grammar/XSLGrammarQuery.java | 10 +++++----- .../ant/grammar/AntGrammarQueryProvider.java | 2 +- .../modules/dbschema/jdbcimpl/TableElementImpl.java | 2 +- .../jdbcimpl/wizard/DBSchemaTablesPanel.java | 2 +- .../dbschema/jdbcimpl/wizard/RecaptureSchema.java | 2 +- .../common/project/ui/customizer/SourceRootsUi.java | 2 +- .../java/editor/base/semantic/UnusedDetector.java | 2 +- .../lib/nbjavac/services/NBParserFactory.java | 2 +- .../netbeans/modules/maven/ModuleInfoSupport.java | 2 +- .../modules/php/editor/parser/astnodes/Block.java | 2 +- .../editor/parser/astnodes/FunctionDeclaration.java | 2 +- .../core/multitabs/impl/ButtonPopupSwitcher.java | 2 +- 35 files changed, 54 insertions(+), 56 deletions(-) diff --git a/enterprise/jakarta.web.beans/src/org/netbeans/modules/jakarta/web/beans/completion/CCPaintComponent.java b/enterprise/jakarta.web.beans/src/org/netbeans/modules/jakarta/web/beans/completion/CCPaintComponent.java index 70e764a25f15..dfc68ff5f57b 100644 --- a/enterprise/jakarta.web.beans/src/org/netbeans/modules/jakarta/web/beans/completion/CCPaintComponent.java +++ b/enterprise/jakarta.web.beans/src/org/netbeans/modules/jakarta/web/beans/completion/CCPaintComponent.java @@ -215,7 +215,7 @@ protected void drawStringToGraphics(Graphics g, String s, Font font, boolean str } protected int getWidth(String s) { - Integer i = (Integer)widths.get(s); + Integer i = widths.get(s); if (i != null) { return i; } else { diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/DomainEditor.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/DomainEditor.java index 04b5e9715266..8bb0a9a5daa4 100644 --- a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/DomainEditor.java +++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/DomainEditor.java @@ -481,7 +481,7 @@ public HashMap getSunDatasourcesFromXml(){ private Map getPoolValues(Map cpMap, String poolName) { Map pValues = new HashMap<>(); - Node cpNode = (Node) cpMap.get(poolName); + Node cpNode = cpMap.get(poolName); NamedNodeMap cpAttrMap = cpNode.getAttributes(); Node dsClassName = cpAttrMap.getNamedItem(CONST_DS_CLASS); Node resType = cpAttrMap.getNamedItem(CONST_RES_TYPE); diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java index 1b18039d85a0..442ebc06f239 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java @@ -772,7 +772,7 @@ private static NbProcessDescriptor defaultDebugStartDesc(String command, String } private String getJavaHome(JavaPlatform platform) { - FileObject fo = (FileObject)platform.getInstallFolders().iterator().next(); + FileObject fo = platform.getInstallFolders().iterator().next(); return FileUtil.toFile(fo).getAbsolutePath(); } diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/LogManager.java b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/LogManager.java index 7965d70b7cd8..0200212ad727 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/LogManager.java +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/LogManager.java @@ -268,7 +268,7 @@ public void openContextLog(TomcatModule module) { if (!moduleConfig.hasLogger()) { return; } - contextLog = (LogViewer)contextLogViewers.get(moduleID); + contextLog = contextLogViewers.get(moduleID); LogViewer newContextLog = null; try { newContextLog = new LogViewer( diff --git a/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/graph/actions/SystemFileSystemSupport.java b/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/graph/actions/SystemFileSystemSupport.java index 067637774ee7..0d16d09718c6 100644 --- a/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/graph/actions/SystemFileSystemSupport.java +++ b/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/graph/actions/SystemFileSystemSupport.java @@ -88,7 +88,7 @@ private static ActionsProvider getActionProvider(String folderPath) { } synchronized (dataFolder2actionsProvider) { - ActionsProvider actionsProvider = (ActionsProvider)dataFolder2actionsProvider.get(dataFolder); + ActionsProvider actionsProvider = dataFolder2actionsProvider.get(dataFolder); if (actionsProvider == null) { actionsProvider = new DefaultActionsProvider(dataFolder); dataFolder2actionsProvider.put(dataFolder, actionsProvider); diff --git a/enterprise/web.monitor/src/org/netbeans/modules/web/monitor/client/Util.java b/enterprise/web.monitor/src/org/netbeans/modules/web/monitor/client/Util.java index ea499ad77ca3..46157c50fc64 100644 --- a/enterprise/web.monitor/src/org/netbeans/modules/web/monitor/client/Util.java +++ b/enterprise/web.monitor/src/org/netbeans/modules/web/monitor/client/Util.java @@ -112,7 +112,7 @@ static boolean removeParametersFromQuery(RequestData rd) { Enumeration e = ht.keys(); while(e.hasMoreElements()) { - String name = (String)e.nextElement(); + String name = e.nextElement(); try { String[] value = (String[])(ht.get(name)); for(int i=0; i 0) { Enumeration e = ht.keys(); while(e.hasMoreElements()) { - String name = (String)e.nextElement(); + String name = e.nextElement(); String[] value = (String[])(ht.get(name)); for(int i=0; i 0) { diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/WebJPAModuleInfo.java b/enterprise/web.project/src/org/netbeans/modules/web/project/WebJPAModuleInfo.java index 0ed936156ba7..c17368708536 100644 --- a/enterprise/web.project/src/org/netbeans/modules/web/project/WebJPAModuleInfo.java +++ b/enterprise/web.project/src/org/netbeans/modules/web/project/WebJPAModuleInfo.java @@ -55,7 +55,7 @@ public String getVersion() { @Override public Boolean isJPAVersionSupported(String version) { - J2eeModuleProvider j2eeModuleProvider = (J2eeModuleProvider) project.getLookup().lookup(J2eeModuleProvider.class); + J2eeModuleProvider j2eeModuleProvider = project.getLookup().lookup(J2eeModuleProvider.class); J2eePlatform platform = Deployment.getDefault().getJ2eePlatform(j2eeModuleProvider.getServerInstanceID()); if (platform == null) { diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java b/enterprise/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java index a82de138649b..d9af055c0200 100644 --- a/enterprise/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java +++ b/enterprise/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java @@ -621,7 +621,7 @@ public Void run() throws Exception { ep.setProperty(WebProjectProperties.JAVA_SOURCE_BASED,javaSourceBased+""); - UpdateHelper updateHelper = ((WebProject) p).getUpdateHelper(); + UpdateHelper updateHelper = p.getUpdateHelper(); // this enforcement is valid only for Web project for EE 6; non-EE6 containers may support JDK 7 // // #181215: JDK 6 should be the default source/binary format for Java EE 6 projects diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java b/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java index 8513b5da041e..7381e034a39c 100644 --- a/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java +++ b/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java @@ -103,7 +103,7 @@ else if (create) { @Override public String getWsdlLocation(String serviceName) { String localWsdl = serviceName+".wsdl"; //NOI18N - JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class); + JaxWsModel jaxWsModel = project.getLookup().lookup(JaxWsModel.class); if (jaxWsModel!=null) { Service service = jaxWsModel.findServiceByName(serviceName); if (service!=null) { diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/ui/ConfFilesNodeFactory.java b/enterprise/web.project/src/org/netbeans/modules/web/project/ui/ConfFilesNodeFactory.java index da3c43e59b3c..2771bb89aad9 100644 --- a/enterprise/web.project/src/org/netbeans/modules/web/project/ui/ConfFilesNodeFactory.java +++ b/enterprise/web.project/src/org/netbeans/modules/web/project/ui/ConfFilesNodeFactory.java @@ -98,7 +98,7 @@ public ConfFilesNodeFactory() { } public NodeList createNodes(Project p) { - WebProject project = (WebProject) p.getLookup().lookup(WebProject.class); + WebProject project = p.getLookup().lookup(WebProject.class); assert project != null; return new ConfFilesNodeList(project); } @@ -111,7 +111,7 @@ private static class ConfFilesNodeList implements NodeList, PropertyChan ConfFilesNodeList(WebProject proj) { project = proj; - WebLogicalViewProvider logView = (WebLogicalViewProvider) project.getLookup().lookup(WebLogicalViewProvider.class); + WebLogicalViewProvider logView = project.getLookup().lookup(WebLogicalViewProvider.class); assert logView != null; } @@ -283,7 +283,7 @@ private void setGroups(Collection groups) { Iterator it = groupsListeners.keySet().iterator(); while (it.hasNext()) { SourceGroup group = (SourceGroup) it.next(); - PropertyChangeListener pcl = (PropertyChangeListener) groupsListeners.get(group); + PropertyChangeListener pcl = groupsListeners.get(group); group.removePropertyChangeListener(pcl); } } @@ -306,7 +306,7 @@ protected void setFiles(Set files) { Iterator it = fileSystemListeners.keySet().iterator(); while (it.hasNext()) { FileSystem fs = (FileSystem) it.next(); - FileStatusListener fsl = (FileStatusListener) fileSystemListeners.get(fs); + FileStatusListener fsl = fileSystemListeners.get(fs); fs.removeFileStatusListener(fsl); } } @@ -357,8 +357,7 @@ private ConfFilesChildrenFactory(ProjectWebModule webModule) { } public static ConfFilesChildrenFactory forProject(Project project) { - ProjectWebModule pwm = (ProjectWebModule) project.getLookup().lookup( - ProjectWebModule.class); + ProjectWebModule pwm = project.getLookup().lookup(ProjectWebModule.class); return new ConfFilesChildrenFactory(pwm); } @@ -531,7 +530,7 @@ private boolean addFrameworkFiles( ) { boolean result = false; start : for (int i = 0; i < providers.size(); i++) { - WebFrameworkProvider provider = (WebFrameworkProvider) providers.get(i); + WebFrameworkProvider provider = providers.get(i); FileObject wmBase = getWebModule().getDocumentBase(); File[] files = null; if (wmBase != null) { diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java b/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java index 9e56416f4839..743efa5ba07f 100644 --- a/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java +++ b/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java @@ -364,13 +364,13 @@ private void init() { EditableProperties projectProperties = updateHelper.getProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH ); EditableProperties privateProperties = updateHelper.getProperties( AntProjectHelper.PRIVATE_PROPERTIES_PATH ); - JAVAC_CLASSPATH_MODEL = ClassPathTableModel.createTableModel( cs.itemsIterator( (String)projectProperties.get( ProjectProperties.JAVAC_CLASSPATH ), ClassPathSupportCallbackImpl.TAG_WEB_MODULE_LIBRARIES) ); + JAVAC_CLASSPATH_MODEL = ClassPathTableModel.createTableModel( cs.itemsIterator(projectProperties.get( ProjectProperties.JAVAC_CLASSPATH ), ClassPathSupportCallbackImpl.TAG_WEB_MODULE_LIBRARIES) ); String processorPath = projectProperties.get(ProjectProperties.JAVAC_PROCESSORPATH); processorPath = processorPath == null ? "${javac.classpath}" : processorPath; JAVAC_PROCESSORPATH_MODEL = ClassPathUiSupport.createListModel(cs.itemsIterator(processorPath)); - JAVAC_TEST_CLASSPATH_MODEL = ClassPathUiSupport.createListModel( cs.itemsIterator( (String)projectProperties.get( ProjectProperties.JAVAC_TEST_CLASSPATH ), null ) ); - RUN_TEST_CLASSPATH_MODEL = ClassPathUiSupport.createListModel( cs.itemsIterator( (String)projectProperties.get( ProjectProperties.RUN_TEST_CLASSPATH ), null ) ); - ENDORSED_CLASSPATH_MODEL = ClassPathUiSupport.createListModel( cs.itemsIterator( (String)projectProperties.get( ProjectProperties.ENDORSED_CLASSPATH ), null ) ); + JAVAC_TEST_CLASSPATH_MODEL = ClassPathUiSupport.createListModel( cs.itemsIterator(projectProperties.get( ProjectProperties.JAVAC_TEST_CLASSPATH ), null ) ); + RUN_TEST_CLASSPATH_MODEL = ClassPathUiSupport.createListModel( cs.itemsIterator(projectProperties.get( ProjectProperties.RUN_TEST_CLASSPATH ), null ) ); + ENDORSED_CLASSPATH_MODEL = ClassPathUiSupport.createListModel( cs.itemsIterator(projectProperties.get( ProjectProperties.ENDORSED_CLASSPATH ), null ) ); PLATFORM_MODEL = PlatformUiSupport.createPlatformComboBoxModel (evaluator.getProperty(JAVA_PLATFORM)); PLATFORM_LIST_RENDERER = PlatformUiSupport.createPlatformListCellRenderer(); SpecificationVersion minimalSourceLevel = null; @@ -427,7 +427,7 @@ private void init() { WAR_NAME_MODEL = projectGroup.createStringDocument( evaluator, WAR_NAME ); BUILD_CLASSES_EXCLUDES_MODEL = projectGroup.createStringDocument( evaluator, BUILD_CLASSES_EXCLUDES ); WAR_COMPRESS_MODEL = projectGroup.createToggleButtonModel( evaluator, WAR_COMPRESS ); - WAR_CONTENT_ADDITIONAL_MODEL = WarIncludesTableModel.createTableModel( cs.itemsIterator( (String)projectProperties.get( WAR_CONTENT_ADDITIONAL ), ClassPathSupportCallbackImpl.TAG_WEB_MODULE__ADDITIONAL_LIBRARIES)); + WAR_CONTENT_ADDITIONAL_MODEL = WarIncludesTableModel.createTableModel( cs.itemsIterator(projectProperties.get( WAR_CONTENT_ADDITIONAL ), ClassPathSupportCallbackImpl.TAG_WEB_MODULE__ADDITIONAL_LIBRARIES)); // CustomizerJavadoc JAVADOC_PRIVATE_MODEL = projectGroup.createToggleButtonModel( evaluator, JAVADOC_PRIVATE ); @@ -483,7 +483,7 @@ public void actionPerformed(ActionEvent e) { try { CONTEXT_PATH_MODEL = new PlainDocument(); CONTEXT_PATH_MODEL.remove(0, CONTEXT_PATH_MODEL.getLength()); - ProjectWebModule wm = (ProjectWebModule) project.getLookup().lookup(ProjectWebModule.class); + ProjectWebModule wm = project.getLookup().lookup(ProjectWebModule.class); String contextPath = wm.getContextPath(); if (contextPath != null) { CONTEXT_PATH_MODEL.insertString(0, contextPath, null); diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java index 0543c6e2f297..48dd2dc3de69 100644 --- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java +++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java @@ -78,7 +78,7 @@ public static WebServicesClientView getWebServicesClientView(FileObject f) { } } - WebServicesClientViewProvider impl = (WebServicesClientViewProvider) Lookup.getDefault().lookup(WebServicesClientViewProvider.class); + WebServicesClientViewProvider impl = Lookup.getDefault().lookup(WebServicesClientViewProvider.class); if(impl != null) { WebServicesClientView wsv = impl.findWebServicesClientView(f); return wsv; diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java index 2cb4cd51e3c7..6053c25f3fbb 100644 --- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java +++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java @@ -72,7 +72,7 @@ public static JAXWSClientView getJAXWSClientView() { } } - JAXWSClientViewProvider impl = (JAXWSClientViewProvider) Lookup.getDefault().lookup(JAXWSClientViewProvider.class); + JAXWSClientViewProvider impl = Lookup.getDefault().lookup(JAXWSClientViewProvider.class); if(impl != null) { JAXWSClientView wsv = impl.findJAXWSClientView(); return wsv; diff --git a/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/MiscPrivateUtilities.java b/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/MiscPrivateUtilities.java index 0c23d0effd35..762bf6766745 100644 --- a/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/MiscPrivateUtilities.java +++ b/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/MiscPrivateUtilities.java @@ -289,8 +289,7 @@ static JavaSource getJavaSourceFromClassName(Project p, String qualifiedClassNam } public static boolean supportsTargetProfile(Project project, Profile profile){ - J2eeModuleProvider provider = (J2eeModuleProvider) project.getLookup(). - lookup(J2eeModuleProvider.class); + J2eeModuleProvider provider = project.getLookup().lookup(J2eeModuleProvider.class); String serverInstanceID = provider.getServerInstanceID(); if ( serverInstanceID == null ){ return false; diff --git a/groovy/groovy.antproject/src/org/netbeans/modules/groovy/antproject/base/AbstractGroovyExtender.java b/groovy/groovy.antproject/src/org/netbeans/modules/groovy/antproject/base/AbstractGroovyExtender.java index 4073c0c84804..48ecda85ea0f 100644 --- a/groovy/groovy.antproject/src/org/netbeans/modules/groovy/antproject/base/AbstractGroovyExtender.java +++ b/groovy/groovy.antproject/src/org/netbeans/modules/groovy/antproject/base/AbstractGroovyExtender.java @@ -208,7 +208,7 @@ private boolean containsClass(Collection classpath, String className) thro try { Enumeration entries = jf.entries(); while (entries.hasMoreElements()) { - JarEntry entry = (JarEntry) entries.nextElement(); + JarEntry entry = entries.nextElement(); if (classFilePath.equals(entry.getName())) { return true; } diff --git a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderMetaData.java b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderMetaData.java index 0092d39fb19a..4b841639a73f 100644 --- a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderMetaData.java +++ b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderMetaData.java @@ -280,9 +280,9 @@ boolean checkColumnNameForTable(Column col, String tableName) { } } else { for (int icnt = 0; icnt < cols.size(); icnt++) { - if (columnName.equalsIgnoreCase((String) cols.get(icnt))) { - col.setColumnName(col.getColumnName(), (String) cols.get(icnt)); - Log.getLogger().finest(" adjust colname to " + (String) cols.get(icnt)); + if (columnName.equalsIgnoreCase(cols.get(icnt))) { + col.setColumnName(col.getColumnName(), cols.get(icnt)); + Log.getLogger().finest(" adjust colname to " + cols.get(icnt)); if (col.getTableSpec() == null) { col.setTableSpec(col.getTableSpec(), checkedTable); Log.getLogger().finest(" adjust table to " + checkedTable); @@ -435,8 +435,8 @@ List getAllTables() throws SQLException { // Convert from List to "table.schema", expected by query editor List result = new ArrayList<>(); for (List fullTable : tables) { - String schema = (String) fullTable.get(0); - String table = (String) fullTable.get(1); + String schema = fullTable.get(0); + String table = fullTable.get(1); result.add(((schema == null) || (schema.equals(""))) ? table : schema + "." + table); } return result; diff --git a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderResultTable.java b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderResultTable.java index 3544822aa7b2..e41a13ec2899 100644 --- a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderResultTable.java +++ b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderResultTable.java @@ -299,7 +299,7 @@ else if (source.getText().equals(NbBundle.getMessage(QueryBuilderInputTable.clas } private void setClipboard(String contents) { - ExClipboard clipboard = (ExClipboard) Lookup.getDefault().lookup(ExClipboard.class); + ExClipboard clipboard = Lookup.getDefault().lookup(ExClipboard.class); StringSelection strSel = new StringSelection(contents); clipboard.setContents(strSel, strSel); } diff --git a/ide/db/src/org/netbeans/modules/db/explorer/dlg/AddDriverDialog.java b/ide/db/src/org/netbeans/modules/db/explorer/dlg/AddDriverDialog.java index 3a2042bf2780..1de1fbdb1214 100644 --- a/ide/db/src/org/netbeans/modules/db/explorer/dlg/AddDriverDialog.java +++ b/ide/db/src/org/netbeans/modules/db/explorer/dlg/AddDriverDialog.java @@ -574,7 +574,7 @@ public void run() { try (JarFile jf = new JarFile(file)) { Enumeration entries = jf.entries(); while (entries.hasMoreElements()) { - JarEntry entry = (JarEntry) entries.nextElement(); + JarEntry entry = entries.nextElement(); String className = entry.getName(); if (className.endsWith(".class")) { // NOI18N className = className.replace('/', '.'); diff --git a/ide/xml.core/src/org/netbeans/modules/xml/dtd/grammar/ContentModel.java b/ide/xml.core/src/org/netbeans/modules/xml/dtd/grammar/ContentModel.java index 18fb3228ff5a..9f33bc194cf2 100644 --- a/ide/xml.core/src/org/netbeans/modules/xml/dtd/grammar/ContentModel.java +++ b/ide/xml.core/src/org/netbeans/modules/xml/dtd/grammar/ContentModel.java @@ -598,7 +598,7 @@ public String next() { public boolean hasNext() { if (list.size() > current) return true; if (en.hasMoreElements()) { - String next = (String) en.nextElement(); + String next = en.nextElement(); return list.add(next); } else { return false; diff --git a/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewDataObject.java b/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewDataObject.java index 764071c1af6e..1bb1e7892fb6 100644 --- a/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewDataObject.java +++ b/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewDataObject.java @@ -504,7 +504,7 @@ public FileLock lock() throws IOException { private synchronized FileLock getLock() { // How this week reference can be useful ? - FileLock l = lockReference == null ? null : (FileLock) lockReference.get(); + FileLock l = lockReference == null ? null : lockReference.get(); if (l != null && !l.isValid()) { l = null; } diff --git a/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewEditorSupport.java b/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewEditorSupport.java index f4ef073a3db8..7db3e8ad4f7b 100644 --- a/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewEditorSupport.java +++ b/ide/xml.multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewEditorSupport.java @@ -801,7 +801,7 @@ public void propertyChange(PropertyChangeEvent evt) { if (mvtc == topComponent) { if (en.hasMoreElements()) { // Remember next cloned top component - mvtc = (CloneableTopComponent) en.nextElement(); + mvtc = en.nextElement(); } else { // All cloned top components are closed notifyClosed(); diff --git a/ide/xml.tax/src/org/netbeans/modules/xml/tax/cookies/TreeEditorCookieImpl.java b/ide/xml.tax/src/org/netbeans/modules/xml/tax/cookies/TreeEditorCookieImpl.java index 9ec7fa6e2818..8354e8ee8af4 100644 --- a/ide/xml.tax/src/org/netbeans/modules/xml/tax/cookies/TreeEditorCookieImpl.java +++ b/ide/xml.tax/src/org/netbeans/modules/xml/tax/cookies/TreeEditorCookieImpl.java @@ -591,7 +591,7 @@ private synchronized TreeEditorCookieImpl createEditor() { // atomic test and se if (editor == null) { return prepareEditor(); } else { - TreeEditorCookieImpl cached = (TreeEditorCookieImpl) editor.get(); + TreeEditorCookieImpl cached = editor.get(); if (cached == null) { return prepareEditor(); } else { diff --git a/ide/xsl/src/org/netbeans/modules/xsl/grammar/XSLGrammarQuery.java b/ide/xsl/src/org/netbeans/modules/xsl/grammar/XSLGrammarQuery.java index 1deab5362d7f..3b002a0f97b0 100644 --- a/ide/xsl/src/org/netbeans/modules/xsl/grammar/XSLGrammarQuery.java +++ b/ide/xsl/src/org/netbeans/modules/xsl/grammar/XSLGrammarQuery.java @@ -450,7 +450,7 @@ public Enumeration queryElements(HintContext ctx) { // Finally we add xsl namespace elements with other prefixes than the first one for (int prefixInd = 1; prefixInd < prefixList.size(); prefixInd++) { - String curPrefix = (String)prefixList.get(prefixInd) + ":"; // NOI18N + String curPrefix = prefixList.get(prefixInd) + ":"; // NOI18N Node curNode = el; String curName = null; while(curNode != null && null != (curName = curNode.getNodeName()) && !curName.startsWith(curPrefix)) { @@ -496,8 +496,8 @@ public Enumeration queryAttributes(HintContext ctx) { String curXslPrefix = null; for (int ind = 0; ind < prefixList.size(); ind++) { - if (elTagName.startsWith((String)prefixList.get(ind) + ":")){ // NOI18N - curXslPrefix = (String)prefixList.get(ind) + ":"; // NOI18N + if (elTagName.startsWith(prefixList.get(ind) + ":")){ // NOI18N + curXslPrefix = prefixList.get(ind) + ":"; // NOI18N break; } } @@ -512,7 +512,7 @@ public Enumeration queryAttributes(HintContext ctx) { if (prefixList.size() > 0) { Iterator it = getResultElementAttr().iterator(); while ( it.hasNext()) { - possibleAttributes.add((String)prefixList.get(0) + ":" + (String) it.next()); // NOI18N + possibleAttributes.add(prefixList.get(0) + ":" + (String) it.next()); // NOI18N } } } @@ -874,7 +874,7 @@ private void updateProperties(Node curNode) { boolean outputFound = false; if (prefixList.size() > 0) { - String outputElName = (String)prefixList.get(0) + ":output"; // NOI18N + String outputElName = prefixList.get(0) + ":output"; // NOI18N Node childOfRoot = rootNode.getFirstChild(); while (childOfRoot != null) { String childNodeName = childOfRoot.getNodeName(); diff --git a/java/ant.grammar/src/org/netbeans/modules/ant/grammar/AntGrammarQueryProvider.java b/java/ant.grammar/src/org/netbeans/modules/ant/grammar/AntGrammarQueryProvider.java index b1e0024e67c9..5b86015376cc 100644 --- a/java/ant.grammar/src/org/netbeans/modules/ant/grammar/AntGrammarQueryProvider.java +++ b/java/ant.grammar/src/org/netbeans/modules/ant/grammar/AntGrammarQueryProvider.java @@ -45,7 +45,7 @@ public Enumeration enabled(GrammarEnvironment ctx) { } Enumeration en = ctx.getDocumentChildren(); while (en.hasMoreElements()) { - Node next = (Node) en.nextElement(); + Node next = en.nextElement(); if (next.getNodeType() == Node.ELEMENT_NODE) { Element root = (Element) next; if ("project".equals(root.getNodeName())) { // NOI18N diff --git a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/TableElementImpl.java b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/TableElementImpl.java index ec3f0aaa05e2..5ecf63b48122 100644 --- a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/TableElementImpl.java +++ b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/TableElementImpl.java @@ -564,7 +564,7 @@ private void initPK(ConnectionProvider cp, DDLBridge bridge, String shortTableNa if (bridge != null) { rset = bridge.getDriverSpecification().getRow(); keySeq = rset.get(new Integer(5)); - colName = (String) rset.get(new Integer(4)); + colName = rset.get(new Integer(4)); rset.clear(); } else { keySeq = rs.getObject("KEY_SEQ"); //NOI18N diff --git a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/DBSchemaTablesPanel.java b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/DBSchemaTablesPanel.java index 4c5f11ff26f7..a2ee763d18d2 100644 --- a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/DBSchemaTablesPanel.java +++ b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/DBSchemaTablesPanel.java @@ -344,7 +344,7 @@ private int invokeHandlers(List handlers, int start, Parameters params, int i; for (i = start; i < handlers.size(); i++) { - Handler h = (Handler)handlers.get(i); + Handler h = handlers.get(i); if (!h.isRunnable()) { if (LOG) { LOGGER.log(Level.FINE, "Skipping " + h); diff --git a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/RecaptureSchema.java b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/RecaptureSchema.java index 1bdc028c9d66..717cf621ecb0 100644 --- a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/RecaptureSchema.java +++ b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/wizard/RecaptureSchema.java @@ -62,7 +62,7 @@ public RecaptureSchema(Node dbSchemaNode) { } public void start() throws ClassNotFoundException, SQLException { - final DBschemaDataObject dobj = (DBschemaDataObject)dbSchemaNode.getCookie(DBschemaDataObject.class); + final DBschemaDataObject dobj = dbSchemaNode.getCookie(DBschemaDataObject.class); final SchemaElement elem = dobj.getSchema(); //elem. //ConnectionProvider cp = new ConnectionProvider(elem.getDriver(), elem.getUrl(), elem.getUsername(), null); diff --git a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/SourceRootsUi.java b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/SourceRootsUi.java index 474eafa9b830..84db38363203 100644 --- a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/SourceRootsUi.java +++ b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/SourceRootsUi.java @@ -461,7 +461,7 @@ private void moveDown() { ListSelectionModel selectionModel = this.rootsList.getSelectionModel(); selectionModel.clearSelection(); for( int i = si.length -1 ; i >= 0 ; i-- ) { - Vector item = (Vector)rootsModel.getDataVector().elementAt(si[i]); + Vector item = rootsModel.getDataVector().elementAt(si[i]); int newIndex = si[i] + 1; rootsModel.removeRow( si[i] ); rootsModel.insertRow( newIndex, item ); diff --git a/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java b/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java index e129842e4538..f5bb63be8782 100644 --- a/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java +++ b/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java @@ -653,7 +653,7 @@ private void handleDeclaration(TreePath path) { @Override public Void visitLiteral(LiteralTree node, Void p) { if (node.getKind() == Kind.STRING_LITERAL) { - allStringLiterals.add((String) ((LiteralTree) node).getValue()); + allStringLiterals.add((String)node.getValue()); } return super.visitLiteral(node, p); } diff --git a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java index 4af392a707cc..73a578d9062b 100644 --- a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java +++ b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java @@ -157,7 +157,7 @@ public JCStatement parseSimpleStatement() { if (result instanceof JCEnhancedForLoop) { JCEnhancedForLoop tree = (JCEnhancedForLoop) result; if (getEndPos(tree.var) == Position.NOPOS) { - endPosTable.storeEnd(tree.var, getEndPos(((JCVariableDecl) tree.var).vartype)); + endPosTable.storeEnd(tree.var, getEndPos(tree.var.vartype)); } } return result; diff --git a/java/maven/src/org/netbeans/modules/maven/ModuleInfoSupport.java b/java/maven/src/org/netbeans/modules/maven/ModuleInfoSupport.java index 0917e6ea525a..53f101878a10 100644 --- a/java/maven/src/org/netbeans/modules/maven/ModuleInfoSupport.java +++ b/java/maven/src/org/netbeans/modules/maven/ModuleInfoSupport.java @@ -235,7 +235,7 @@ static void addRequires(FileObject moduleInfo, List newModules) { src.runModificationTask((WorkingCopy copy) -> { copy.toPhase(JavaSource.Phase.RESOLVED); TreeMaker tm = copy.getTreeMaker(); - ModuleTree modle = (ModuleTree) copy.getCompilationUnit().getModule(); + ModuleTree modle = copy.getCompilationUnit().getModule(); ModuleTree newModle = modle; for (String mName : mNames) { newModle = tm.addModuleDirective(newModle, tm.Requires(false, false, tm.QualIdent(mName))); diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/Block.java b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/Block.java index b0624a186f2a..5bcbe6cc14e6 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/Block.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/Block.java @@ -46,7 +46,7 @@ private Block(int start, int end, Statement[] statements, boolean isCurly) { } public Block(int start, int end, List statements, boolean isCurly) { - this(start, end, statements == null ? new Statement[0] : (Statement[]) statements.toArray(new Statement[0]), isCurly); + this(start, end, statements == null ? new Statement[0] : statements.toArray(new Statement[0]), isCurly); } public Block(int start, int end, List statements) { diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/FunctionDeclaration.java b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/FunctionDeclaration.java index 855958318733..bb5cec4a9b69 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/FunctionDeclaration.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/FunctionDeclaration.java @@ -61,7 +61,7 @@ private FunctionDeclaration(int start, int end, Identifier functionName, FormalP } private FunctionDeclaration(int start, int end, Identifier functionName, List formalParameters, Expression returnType, Block body, boolean isReference, List attributes) { - this(start, end, functionName, (FormalParameter[]) formalParameters.toArray(new FormalParameter[0]), returnType, body, isReference, attributes); + this(start, end, functionName, formalParameters.toArray(new FormalParameter[0]), returnType, body, isReference, attributes); } public FunctionDeclaration(int start, int end, Identifier functionName, List formalParameters, Expression returnType, Block body, boolean isReference) { diff --git a/platform/core.multitabs/src/org/netbeans/core/multitabs/impl/ButtonPopupSwitcher.java b/platform/core.multitabs/src/org/netbeans/core/multitabs/impl/ButtonPopupSwitcher.java index c24c95e74d61..f23920e6943e 100644 --- a/platform/core.multitabs/src/org/netbeans/core/multitabs/impl/ButtonPopupSwitcher.java +++ b/platform/core.multitabs/src/org/netbeans/core/multitabs/impl/ButtonPopupSwitcher.java @@ -341,7 +341,7 @@ private boolean changeSelection( KeyEvent event ) { } break; case KeyEvent.VK_DELETE: { - final Item item = ( Item ) pTable.getSelectedItem(); + final Item item = pTable.getSelectedItem(); if (item != null) { TabData tab = item.getTabData(); int tabIndex = controller.getTabModel().indexOf( tab );