fill in type parameters of raw type in Type interface

This commit is contained in:
Gavin King 2022-01-30 18:09:44 +01:00
parent 1b0862babd
commit 5b5c76abfd
12 changed files with 39 additions and 27 deletions

View File

@ -172,7 +172,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
}
@Override
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache)
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map<Object, Object> copyCache)
throws HibernateException {
return original;
}

View File

@ -254,7 +254,7 @@ public abstract class AbstractStandardBasicType<T>
@Override
@SuppressWarnings({ "unchecked" })
public final Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache) {
public final Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map<Object, Object> copyCache) {
if ( original == null && target == null ) {
return null;
}
@ -269,7 +269,7 @@ public abstract class AbstractStandardBasicType<T>
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache,
Map<Object, Object> copyCache,
ForeignKeyDirection foreignKeyDirection) {
return ForeignKeyDirection.FROM_PARENT == foreignKeyDirection
? javaType.getReplacement( (T) original, (T) target, session )

View File

@ -119,7 +119,7 @@ public abstract class AbstractType implements Type {
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache,
Map<Object, Object> copyCache,
ForeignKeyDirection foreignKeyDirection)
throws HibernateException {
boolean include;

View File

@ -301,7 +301,7 @@ public class AnyType extends AbstractType implements CompositeType, AssociationT
}
@Override
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache)
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map<Object, Object> copyCache)
throws HibernateException {
if ( original == null ) {
return null;

View File

@ -651,7 +651,7 @@ public abstract class CollectionType extends AbstractType implements Association
final Object target,
final SharedSessionContractImplementor session,
final Object owner,
final Map copyCache) throws HibernateException {
final Map<Object, Object> copyCache) throws HibernateException {
if ( original == null ) {
return null;
}

View File

@ -12,7 +12,6 @@ import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.hibernate.FetchMode;
@ -483,7 +482,7 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache) {
Map<Object, Object> copyCache) {
if ( original == null ) {
return null;
@ -527,7 +526,7 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache,
Map<Object, Object> copyCache,
ForeignKeyDirection foreignKeyDirection) {
if ( original == null ) {

View File

@ -158,7 +158,7 @@ public class CustomType<J>
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache) throws HibernateException {
Map<Object, Object> copyCache) throws HibernateException {
return getUserType().replace( original, target, owner );
}

View File

@ -269,7 +269,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache) throws HibernateException {
Map<Object, Object> copyCache) throws HibernateException {
if ( original == null ) {
return null;
}
@ -404,7 +404,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
* @param overridingEager can override eager from the mapping.
*
* @return If {@code overridingEager} is null, then it does not override.
* If true or false then it overrides the mapping value.
* If true or false then it overrides the mapping value.
*/
public boolean isEager(Boolean overridingEager) {
return overridingEager != null ? overridingEager : this.eager;

View File

@ -109,11 +109,11 @@ public class MetaType extends AbstractType {
@Override
public Object replace(
Object original,
Object original,
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache) {
Object owner,
Map<Object, Object> copyCache) {
return original;
}

View File

@ -308,7 +308,7 @@ public class SerializableToBlobType<T extends Serializable> implements BasicType
@Override
@SuppressWarnings("unchecked")
public final Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache) {
public final Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map<Object, Object> copyCache) {
if ( original == null && target == null ) {
return null;
}
@ -317,13 +317,13 @@ public class SerializableToBlobType<T extends Serializable> implements BasicType
}
@Override
@SuppressWarnings({ "unchecked" })
// @SuppressWarnings({ "unchecked" })
public Object replace(
Object original,
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache,
Map<Object, Object> copyCache,
ForeignKeyDirection foreignKeyDirection) {
return ForeignKeyDirection.FROM_PARENT == foreignKeyDirection
? javaType.getReplacement( (T) original, (T) target, session )

View File

@ -392,7 +392,7 @@ public interface Type extends Serializable {
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache) throws HibernateException;
Map<Object, Object> copyCache) throws HibernateException;
/**
* During merge, replace the existing (target) value in the entity we are merging to
@ -417,7 +417,7 @@ public interface Type extends Serializable {
Object target,
SharedSessionContractImplementor session,
Object owner,
Map copyCache,
Map<Object, Object> copyCache,
ForeignKeyDirection foreignKeyDirection) throws HibernateException;
/**

View File

@ -73,10 +73,11 @@ public class TypeHelper {
final Type[] types,
final SharedSessionContractImplementor session,
final Object owner,
final Map copyCache) {
final Map<Object, Object> copyCache) {
Object[] copied = new Object[original.length];
for ( int i = 0; i < types.length; i++ ) {
if ( original[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY || original[i] == PropertyAccessStrategyBackRefImpl.UNKNOWN ) {
if ( original[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY
|| original[i] == PropertyAccessStrategyBackRefImpl.UNKNOWN ) {
copied[i] = target[i];
}
else if ( target[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
@ -108,7 +109,7 @@ public class TypeHelper {
final Type[] types,
final SharedSessionContractImplementor session,
final Object owner,
final Map copyCache,
final Map<Object, Object> copyCache,
final ForeignKeyDirection foreignKeyDirection) {
Object[] copied = new Object[original.length];
for ( int i = 0; i < types.length; i++ ) {
@ -149,7 +150,7 @@ public class TypeHelper {
final Type[] types,
final SharedSessionContractImplementor session,
final Object owner,
final Map copyCache,
final Map<Object, Object> copyCache,
final ForeignKeyDirection foreignKeyDirection) {
Object[] copied = new Object[original.length];
for ( int i = 0; i < types.length; i++ ) {
@ -161,9 +162,21 @@ public class TypeHelper {
// need to extract the component values and check for subtype replacements...
CompositeType componentType = ( CompositeType ) types[i];
Type[] subtypes = componentType.getSubtypes();
Object[] origComponentValues = original[i] == null ? new Object[subtypes.length] : componentType.getPropertyValues( original[i], session );
Object[] targetComponentValues = target[i] == null ? new Object[subtypes.length] : componentType.getPropertyValues( target[i], session );
replaceAssociations( origComponentValues, targetComponentValues, subtypes, session, null, copyCache, foreignKeyDirection );
Object[] origComponentValues = original[i] == null
? new Object[subtypes.length]
: componentType.getPropertyValues( original[i], session );
Object[] targetComponentValues = target[i] == null
? new Object[subtypes.length]
: componentType.getPropertyValues( target[i], session );
replaceAssociations(
origComponentValues,
targetComponentValues,
subtypes,
session,
null,
copyCache,
foreignKeyDirection
);
copied[i] = target[i];
}
else if ( !types[i].isAssociationType() ) {