From a61a738b27fd69120c88163ea218f17f99b6cb3c Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 21 Dec 2024 11:31:42 +0100 Subject: [PATCH] get rid of a raw type --- .../event/service/internal/EventListenerRegistryImpl.java | 5 +++-- .../src/main/java/org/hibernate/event/spi/EventType.java | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/event/service/internal/EventListenerRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/event/service/internal/EventListenerRegistryImpl.java index 570b37df2364..95111991da73 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/service/internal/EventListenerRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/event/service/internal/EventListenerRegistryImpl.java @@ -121,8 +121,9 @@ public final void setListeners(EventType type, Class... list setListeners( type, resolveListenerInstances( type, listenerClasses ) ); } - @SuppressWarnings( {"unchecked"}) + @SafeVarargs private T[] resolveListenerInstances(EventType type, Class... listenerClasses) { + @SuppressWarnings("unchecked") T[] listeners = (T[]) Array.newInstance( type.baseListenerInterface(), listenerClasses.length ); for ( int i = 0; i < listenerClasses.length; i++ ) { listeners[i] = resolveListenerInstance( listenerClasses[i] ); @@ -130,8 +131,8 @@ private T[] resolveListenerInstances(EventType type, Class.. return listeners; } - @SuppressWarnings( {"unchecked"}) private T resolveListenerInstance(Class listenerClass) { + @SuppressWarnings("unchecked") T listenerInstance = (T) listenerClassToInstanceMap.get( listenerClass ); if ( listenerInstance == null ) { listenerInstance = instantiateListener( listenerClass ); diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/EventType.java b/hibernate-core/src/main/java/org/hibernate/event/spi/EventType.java index c60e97cd7f0f..9dea91db93be 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/EventType.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/EventType.java @@ -155,8 +155,7 @@ public String eventName() { return eventName; } - @SuppressWarnings("rawtypes") - public Class baseListenerInterface() { + public Class baseListenerInterface() { return baseListenerInterface; }