diff --git a/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java b/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java index 56eba3c57d11..ce101064b82e 100644 --- a/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java @@ -424,7 +424,8 @@ public Query setOrder(Order order) { // Parameter registrations @Override - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // This suppression is used to suppress unchecked conversion warnings that occur when converting a raw Class to a generic type. + // The underlying call to registerParameter is type-safe, so ignoring this warning is acceptable. public ProcedureCallImplementor registerStoredProcedureParameter(int position, Class type, ParameterMode mode) { getSession().checkOpen( true ); @@ -443,7 +444,8 @@ public ProcedureCallImplementor registerStoredProcedureParameter(int position } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // This suppression is used to suppress unchecked conversion warnings that occur when converting a raw Class to a generic type. + // The underlying call to registerParameter is type-safe, so ignoring this warning is acceptable. public ProcedureCallImplementor registerStoredProcedureParameter( String parameterName, Class type, @@ -990,7 +992,10 @@ protected ScrollableResultsImplementor doScroll(ScrollMode scrollMode) { } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // This suppression is used to suppress unchecked conversion warnings in two cases: + // 1. Returning Collections.EMPTY_LIST, which is a raw type, as a List. + // 2. Casting the result of ResultSetOutput.getResultList() to List. + // Both conversions are considered safe based on the intended usage. public List getResultList() { if ( getMaxResults() == 0 ) { return Collections.EMPTY_LIST; @@ -1060,7 +1065,9 @@ else if ( resultList.size() > 1 ) { } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // This suppression is used to suppress unchecked cast warnings occurring when casting 'this', parameterMetadata, + // paramBindings, queryOptions, getSession(), or getOutputs() to the desired generic type T. + // Each cast is checked using cls.isInstance() or isAssignableFrom(), ensuring that the conversion is safe. public T unwrap(Class cls) { if ( cls.isInstance( this ) ) { return (T) this;