Skip to content

Commit eed7ec0

Browse files
committed
fix a couple of warnings in Configuration
1 parent 2a904a4 commit eed7ec0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import jakarta.persistence.AttributeConverter;
6565
import jakarta.persistence.SharedCacheMode;
6666

67-
import static java.util.Collections.emptyList;
6867

6968
/**
7069
* A convenience API making it easier to bootstrap an instance of Hibernate.
@@ -199,11 +198,10 @@ public Configuration(MetadataSources metadataSources) {
199198
}
200199

201200
private static BootstrapServiceRegistry getBootstrapRegistry(ServiceRegistry serviceRegistry) {
202-
if ( serviceRegistry instanceof BootstrapServiceRegistry ) {
203-
return (BootstrapServiceRegistry) serviceRegistry;
201+
if ( serviceRegistry instanceof BootstrapServiceRegistry bootstrapServiceRegistry ) {
202+
return bootstrapServiceRegistry;
204203
}
205-
else if ( serviceRegistry instanceof StandardServiceRegistry ) {
206-
final StandardServiceRegistry ssr = (StandardServiceRegistry) serviceRegistry;
204+
else if ( serviceRegistry instanceof StandardServiceRegistry ssr ) {
207205
return (BootstrapServiceRegistry) ssr.getParentServiceRegistry();
208206
}
209207

@@ -669,7 +667,7 @@ public Configuration addResource(String resourceName) throws MappingException {
669667
* @throws MappingException Indicates problems locating the resource or
670668
* processing the contained mapping document.
671669
*/
672-
public Configuration addClass(Class entityClass) throws MappingException {
670+
public Configuration addClass(Class<?> entityClass) throws MappingException {
673671
if ( entityClass == null ) {
674672
throw new IllegalArgumentException( "The specified class cannot be null" );
675673
}
@@ -688,7 +686,7 @@ public Configuration addClass(Class entityClass) throws MappingException {
688686
*
689687
* @return {@code this} for method chaining
690688
*/
691-
public Configuration addAnnotatedClass(Class annotatedClass) {
689+
public Configuration addAnnotatedClass(Class<?> annotatedClass) {
692690
metadataSources.addAnnotatedClass( annotatedClass );
693691
return this;
694692
}
@@ -1153,7 +1151,7 @@ public Map<String, NamedResultSetMappingDescriptor> getSqlResultSetMappings() {
11531151
}
11541152

11551153
public java.util.Collection<NamedEntityGraphDefinition> getNamedEntityGraphs() {
1156-
return namedEntityGraphMap == null ? emptyList() : namedEntityGraphMap.values();
1154+
return namedEntityGraphMap.values();
11571155
}
11581156

11591157

0 commit comments

Comments
 (0)