From a4e7b7e482503c21dc9a5a50a20e77b31267e28f Mon Sep 17 00:00:00 2001 From: Gavin Date: Tue, 23 May 2023 18:53:14 +0200 Subject: [PATCH] clean up some warnings --- .../org/hibernate/tool/hbm2ddl/SchemaValidator.java | 3 +-- .../hibernate/tool/hbm2ddl/SchemaValidatorTask.java | 12 +++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidator.java b/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidator.java index 8b5393e1f0..bd3fd089a8 100644 --- a/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidator.java +++ b/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidator.java @@ -49,11 +49,10 @@ public class SchemaValidator { validate( metadata, ( (MetadataImplementor) metadata ).getMetadataBuildingOptions().getServiceRegistry() ); } - @SuppressWarnings("unchecked") public void validate(Metadata metadata, ServiceRegistry serviceRegistry) { LOG.runningSchemaValidator(); - Map config = new HashMap( serviceRegistry.getService( ConfigurationService.class ).getSettings() ); + Map config = new HashMap<>( serviceRegistry.getService( ConfigurationService.class ).getSettings() ); final SchemaManagementTool tool = serviceRegistry.getService( SchemaManagementTool.class ); diff --git a/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidatorTask.java b/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidatorTask.java index de87ae0e99..5cefd93ac5 100644 --- a/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidatorTask.java +++ b/tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/SchemaValidatorTask.java @@ -53,7 +53,7 @@ import org.apache.tools.ant.types.FileSet; * @author Gavin King */ public class SchemaValidatorTask extends MatchingTask { - private List fileSets = new LinkedList<>(); + private final List fileSets = new LinkedList<>(); private File propertiesFile; private File configurationFile; @@ -62,7 +62,6 @@ public class SchemaValidatorTask extends MatchingTask { private String physicalNamingStrategy = null; - @SuppressWarnings("UnusedDeclaration") public void addFileset(FileSet fileSet) { fileSets.add( fileSet ); } @@ -93,17 +92,14 @@ public class SchemaValidatorTask extends MatchingTask { this.configurationFile = configurationFile; } - @SuppressWarnings("UnusedDeclaration") public void setNamingStrategy(String namingStrategy) { DeprecationLogger.DEPRECATION_LOGGER.logDeprecatedNamingStrategyAntArgument(); } - @SuppressWarnings("UnusedDeclaration") public void setImplicitNamingStrategy(String implicitNamingStrategy) { this.implicitNamingStrategy = implicitNamingStrategy; } - @SuppressWarnings("UnusedDeclaration") public void setPhysicalNamingStrategy(String physicalNamingStrategy) { this.physicalNamingStrategy = physicalNamingStrategy; } @@ -182,9 +178,8 @@ public class SchemaValidatorTask extends MatchingTask { private String[] collectFiles() { List files = new ArrayList<>(); - for ( Object fileSet : fileSets ) { - final FileSet fs = (FileSet) fileSet; - final DirectoryScanner ds = fs.getDirectoryScanner( getProject() ); + for ( FileSet fileSet : fileSets ) { + final DirectoryScanner ds = fileSet.getDirectoryScanner( getProject() ); for ( String dsFile : ds.getIncludedFiles() ) { File f = new File( dsFile ); @@ -198,7 +193,6 @@ public class SchemaValidatorTask extends MatchingTask { return ArrayHelper.toStringArray( files ); } - @SuppressWarnings("deprecation") private void configure(MetadataBuilder metadataBuilder, StandardServiceRegistry serviceRegistry) { final StrategySelector strategySelector = serviceRegistry.getService( StrategySelector.class ); if ( implicitNamingStrategy != null ) {