fix some generics warnings

This commit is contained in:
Gavin King 2022-01-22 11:59:06 +01:00
parent ec64ce7321
commit 8a2c000b78
2 changed files with 24 additions and 20 deletions

View File

@ -450,12 +450,12 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
}
@Override
public MutationQuery createMutationQuery(CriteriaUpdate updateQuery) {
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaUpdate updateQuery) {
return delegate().createMutationQuery( updateQuery );
}
@Override
public MutationQuery createMutationQuery(CriteriaDelete deleteQuery) {
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaDelete deleteQuery) {
return delegate().createMutationQuery( deleteQuery );
}
@ -464,12 +464,12 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
return queryDelegate().createQuery( criteriaQuery );
}
@Override
@Override @SuppressWarnings("rawtypes")
public QueryImplementor createQuery(CriteriaUpdate updateQuery) {
return queryDelegate().createQuery( updateQuery );
}
@Override
@Override @SuppressWarnings("rawtypes")
public QueryImplementor createQuery(CriteriaDelete deleteQuery) {
return queryDelegate().createQuery( deleteQuery );
}
@ -520,12 +520,14 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
}
@Override @SuppressWarnings({"rawtypes", "unchecked"})
//note: we're doing something a bit funny here to work around
// the clashing signatures declared by the supertypes
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass) {
return queryDelegate().createNativeQuery( sqlString, resultClass );
}
@Override @SuppressWarnings({"rawtypes", "unchecked"})
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass, String tableAlias) {
@Override
public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, Class<T> resultClass, String tableAlias) {
return queryDelegate().createNativeQuery( sqlString, resultClass, tableAlias );
}
@ -534,8 +536,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
return queryDelegate().createNativeQuery( sqlString, resultSetMappingName );
}
@Override @SuppressWarnings({"rawtypes", "unchecked"})
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName, Class resultClass) {
@Override
public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, String resultSetMappingName, Class<T> resultClass) {
return queryDelegate().createNativeQuery( sqlString, resultSetMappingName, resultClass );
}

View File

@ -792,9 +792,10 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
return query;
}
@Override @SuppressWarnings({"rawtypes", "unchecked"})
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass, String tableAlias) {
NativeQueryImplementor query = createNativeQuery( sqlString );
@Override
public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, Class<T> resultClass, String tableAlias) {
@SuppressWarnings("unchecked")
NativeQueryImplementor<T> query = createNativeQuery( sqlString );
if ( getFactory().getMetamodel().isEntityClass(resultClass) ) {
query.addEntity( tableAlias, resultClass.getName(), LockMode.READ );
}
@ -804,9 +805,10 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
return query;
}
@Override @SuppressWarnings({"rawtypes", "unchecked"})
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName, Class resultClass) {
final NativeQueryImplementor query = createNativeQuery( sqlString, resultSetMappingName );
@Override
public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, String resultSetMappingName, Class<T> resultClass) {
@SuppressWarnings("unchecked")
final NativeQueryImplementor<T> query = createNativeQuery( sqlString, resultSetMappingName );
if ( Tuple.class.equals( resultClass ) ) {
query.setTupleTransformer( new NativeQueryTupleTransformer() );
}
@ -1035,11 +1037,11 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
}
@Override
public MutationQuery createMutationQuery(CriteriaUpdate updateQuery) {
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaUpdate updateQuery) {
checkOpen();
try {
return new QuerySqmImpl<>(
(SqmUpdateStatement) updateQuery,
(SqmUpdateStatement<?>) updateQuery,
null,
this
);
@ -1050,10 +1052,10 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
}
@Override
public MutationQuery createMutationQuery(CriteriaDelete deleteQuery) {
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaDelete deleteQuery) {
checkOpen();
try {
return new QuerySqmImpl( (SqmDeleteStatement) deleteQuery, null, this );
return new QuerySqmImpl<>( (SqmDeleteStatement<?>) deleteQuery, null, this );
}
catch ( RuntimeException e ) {
throw getExceptionConverter().convert( e );
@ -1186,7 +1188,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
}
}
@Override @SuppressWarnings("unchecked")
@Override @SuppressWarnings({"unchecked", "rawtypes"})
public QueryImplementor createQuery(@SuppressWarnings("rawtypes") CriteriaUpdate criteriaUpdate) {
checkOpen();
try {
@ -1201,7 +1203,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
}
}
@Override @SuppressWarnings("unchecked")
@Override @SuppressWarnings({"unchecked", "rawtypes"})
public QueryImplementor createQuery(@SuppressWarnings("rawtypes") CriteriaDelete criteriaDelete) {
checkOpen();
try {