From a4cb390552244c1f4923ef4acf5b3838a7995111 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 23 Jan 2022 00:10:24 +0100 Subject: [PATCH] squash some warnings mainly by just adding wildcards --- .../BeforeTransactionCompletionProcess.java | 2 +- .../internal/none/DisallowedProxyFactory.java | 7 +- .../internal/SessionFactoryImpl.java | 10 +- ...ityRepresentationStrategyPojoStandard.java | 25 +- .../org/hibernate/pretty/MessageHelper.java | 6 +- ...rtyAccessStrategyResolverStandardImpl.java | 2 +- .../access/spi/EnhancedSetterImpl.java | 4 +- .../property/access/spi/GetterFieldImpl.java | 20 +- .../property/access/spi/GetterMethodImpl.java | 11 +- .../spi/PropertyAccessStrategyResolver.java | 2 +- .../property/access/spi/SetterFieldImpl.java | 11 +- .../property/access/spi/SetterMethodImpl.java | 15 +- .../org/hibernate/proxy/HibernateProxy.java | 4 +- .../org/hibernate/proxy/LazyInitializer.java | 2 +- .../org/hibernate/proxy/ProxyFactory.java | 4 +- .../proxy/map/MapLazyInitializer.java | 3 +- .../org/hibernate/proxy/map/MapProxy.java | 13 +- .../hibernate/proxy/map/MapProxyFactory.java | 7 +- .../proxy/pojo/BasicLazyInitializer.java | 6 +- .../proxy/pojo/ProxyFactoryHelper.java | 38 +-- .../pojo/bytebuddy/ByteBuddyInterceptor.java | 6 +- .../pojo/bytebuddy/ByteBuddyProxyFactory.java | 12 +- .../pojo/bytebuddy/ByteBuddyProxyHelper.java | 7 +- .../pojo/bytebuddy/SerializableProxy.java | 34 +-- .../java/org/hibernate/tuple/Attribute.java | 4 +- .../tuple/DynamicMapInstantiator.java | 2 +- .../InMemoryValueGenerationStrategy.java | 4 +- .../org/hibernate/tuple/PojoInstantiator.java | 8 +- .../java/org/hibernate/tuple/Property.java | 2 +- .../java/org/hibernate/tuple/Tuplizer.java | 6 +- .../org/hibernate/tuple/ValueGenerator.java | 4 +- .../AbstractCompositionAttribute.java | 277 +++++++++--------- .../CompositionBasedCompositionAttribute.java | 6 +- .../BytecodeEnhancementMetadataPojoImpl.java | 13 +- .../entity/DynamicMapEntityTuplizer.java | 10 +- .../tuple/entity/EntityMetamodel.java | 36 +-- .../tuple/entity/EntityTuplizerFactory.java | 12 +- .../tuple/entity/PojoEntityTuplizer.java | 20 +- 38 files changed, 315 insertions(+), 340 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/action/spi/BeforeTransactionCompletionProcess.java b/hibernate-core/src/main/java/org/hibernate/action/spi/BeforeTransactionCompletionProcess.java index 6e7d5f564a..ec45a510d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/spi/BeforeTransactionCompletionProcess.java +++ b/hibernate-core/src/main/java/org/hibernate/action/spi/BeforeTransactionCompletionProcess.java @@ -19,5 +19,5 @@ public interface BeforeTransactionCompletionProcess { * * @param session The session on which the transaction is preparing to complete. */ - public void doBeforeTransactionCompletion(SessionImplementor session); + void doBeforeTransactionCompletion(SessionImplementor session); } diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/internal/none/DisallowedProxyFactory.java b/hibernate-core/src/main/java/org/hibernate/bytecode/internal/none/DisallowedProxyFactory.java index ccc1697e39..0ca4d82ab1 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/internal/none/DisallowedProxyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/internal/none/DisallowedProxyFactory.java @@ -22,12 +22,11 @@ final class DisallowedProxyFactory implements ProxyFactory { @Override public void postInstantiate( String entityName, - Class persistentClass, - Set interfaces, + Class persistentClass, + Set> interfaces, Method getIdentifierMethod, Method setIdentifierMethod, - CompositeType componentIdType) throws HibernateException { - + CompositeType componentIdType) { } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 28e83c221a..b88abd2c9c 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -1083,24 +1083,26 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { return fetchProfiles.get( name ); } - @Override @SuppressWarnings("unchecked") + @Override public BindableType resolveParameterBindType(T bindValue) { if ( bindValue == null ) { // we can't guess return null; } - Class clazz; + Class clazz; if (bindValue instanceof HibernateProxy) { HibernateProxy proxy = (HibernateProxy) bindValue; LazyInitializer li = proxy.getHibernateLazyInitializer(); clazz = li.getPersistentClass(); } else { - clazz = (Class) bindValue.getClass(); + clazz = bindValue.getClass(); } - return resolveParameterBindType( clazz ); + @SuppressWarnings("unchecked") + Class c = (Class) clazz; + return resolveParameterBindType( c ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java index 71b6d87bfa..1e9314acf8 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java @@ -182,10 +182,10 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent BytecodeProvider bytecodeProvider, RuntimeModelCreationContext creationContext) { - final Set proxyInterfaces = new java.util.HashSet<>(); + final Set> proxyInterfaces = new java.util.HashSet<>(); - final Class mappedClass = mappedJtd.getJavaTypeClass(); - Class proxyInterface; + final Class mappedClass = mappedJtd.getJavaTypeClass(); + Class proxyInterface; if ( proxyJtd != null ) { proxyInterface = proxyJtd.getJavaTypeClass(); } @@ -206,12 +206,11 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent proxyInterfaces.add( mappedClass ); } - //noinspection unchecked final Iterator subclasses = bootDescriptor.getSubclassIterator(); while ( subclasses.hasNext() ) { final Subclass subclass = subclasses.next(); - final Class subclassProxy = subclass.getProxyInterface(); - final Class subclassClass = subclass.getMappedClass(); + final Class subclassProxy = subclass.getProxyInterface(); + final Class subclassClass = subclass.getMappedClass(); if ( subclassProxy != null && !subclassClass.equals( subclassProxy ) ) { if ( !subclassProxy.isInterface() ) { throw new MappingException( @@ -224,8 +223,8 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent proxyInterfaces.add( HibernateProxy.class ); - Iterator properties = bootDescriptor.getPropertyIterator(); - Class clazz = bootDescriptor.getMappedClass(); + Iterator properties = bootDescriptor.getPropertyIterator(); + Class clazz = bootDescriptor.getMappedClass(); final Method idGetterMethod; final Method idSetterMethod; @@ -294,8 +293,8 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent private ReflectionOptimizer resolveReflectionOptimizer( PersistentClass bootType, BytecodeProvider bytecodeProvider, - @SuppressWarnings("unused") SessionFactoryImplementor sessionFactory) { - final Class javaTypeToReflect; + SessionFactoryImplementor sessionFactory) { + final Class javaTypeToReflect; if ( proxyFactory != null ) { assert proxyJtd != null; javaTypeToReflect = proxyJtd.getJavaTypeClass(); @@ -306,13 +305,11 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent final List getterNames = new ArrayList<>(); final List setterNames = new ArrayList<>(); - final List getterTypes = new ArrayList<>(); + final List> getterTypes = new ArrayList<>(); boolean foundCustomAccessor = false; - //noinspection unchecked final Iterator itr = bootType.getPropertyClosureIterator(); - int i = 0; while ( itr.hasNext() ) { //TODO: redesign how PropertyAccessors are acquired... final Property property = itr.next(); @@ -328,8 +325,6 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent getterTypes.add( propertyAccess.getGetter().getReturnTypeClass() ); setterNames.add( propertyAccess.getSetter().getMethodName() ); - - i++; } if ( foundCustomAccessor || ! Environment.useReflectionOptimizer() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/pretty/MessageHelper.java b/hibernate-core/src/main/java/org/hibernate/pretty/MessageHelper.java index 1385bf6ace..4e40928ed0 100644 --- a/hibernate-core/src/main/java/org/hibernate/pretty/MessageHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/pretty/MessageHelper.java @@ -40,7 +40,7 @@ public final class MessageHelper { public static String infoString(String entityName, Object id) { StringBuilder s = new StringBuilder(); s.append( '[' ); - if( entityName == null ) { + if ( entityName == null ) { s.append( "" ); } else { @@ -237,7 +237,7 @@ public final class MessageHelper { */ public static String collectionInfoString( CollectionPersister persister, - PersistentCollection collection, + PersistentCollection collection, Object collectionKey, SharedSessionContractImplementor session ) { @@ -360,7 +360,7 @@ public final class MessageHelper { else { // TODO: This is a crappy backup if a property-ref is used. // If the reference is an object w/o toString(), this isn't going to work. - s.append( id.toString() ); + s.append( id ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyResolverStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyResolverStandardImpl.java index c894a9b99c..08b4c2d25e 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyResolverStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyResolverStandardImpl.java @@ -30,7 +30,7 @@ public class PropertyAccessStrategyResolverStandardImpl implements PropertyAcces @Override public PropertyAccessStrategy resolvePropertyAccessStrategy( - Class containerClass, + Class containerClass, String explicitAccessStrategyName, RepresentationMode representationMode) { diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java index e15dd791d5..3aa06775b8 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java @@ -14,7 +14,6 @@ import org.hibernate.engine.spi.CompositeOwner; import org.hibernate.engine.spi.CompositeTracker; import org.hibernate.engine.spi.PersistentAttributeInterceptable; import org.hibernate.engine.spi.PersistentAttributeInterceptor; -import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.property.access.internal.AbstractFieldSerialForm; /** @@ -29,8 +28,7 @@ import org.hibernate.property.access.internal.AbstractFieldSerialForm; public class EnhancedSetterImpl extends SetterFieldImpl { private final String propertyName; - @SuppressWarnings("rawtypes") - public EnhancedSetterImpl(Class containerClass, String propertyName, Field field) { + public EnhancedSetterImpl(Class containerClass, String propertyName, Field field) { super( containerClass, propertyName, field ); this.propertyName = propertyName; } diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterFieldImpl.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterFieldImpl.java index 02dd49f8b4..da0b557be6 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterFieldImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterFieldImpl.java @@ -25,12 +25,12 @@ import org.hibernate.property.access.internal.AbstractFieldSerialForm; * @author Steve Ebersole */ public class GetterFieldImpl implements Getter { - private final Class containerClass; + private final Class containerClass; private final String propertyName; private final Field field; private final Method getterMethod; - public GetterFieldImpl(Class containerClass, String propertyName, Field field) { + public GetterFieldImpl(Class containerClass, String propertyName, Field field) { this.containerClass = containerClass; this.propertyName = propertyName; this.field = field; @@ -51,22 +51,22 @@ public class GetterFieldImpl implements Getter { Class type = field.getType(); if ( type.isPrimitive() ) { if ( type == Boolean.TYPE ) { - return Boolean.valueOf( field.getBoolean( owner ) ); + return field.getBoolean(owner); } else if ( type == Byte.TYPE ) { - return Byte.valueOf( field.getByte( owner ) ); + return field.getByte(owner); } else if ( type == Character.TYPE ) { - return Character.valueOf( field.getChar( owner ) ); + return field.getChar(owner); } else if ( type == Integer.TYPE ) { - return Integer.valueOf( field.getInt( owner ) ); + return field.getInt(owner); } else if ( type == Long.TYPE ) { - return Long.valueOf( field.getLong( owner ) ); + return field.getLong(owner); } else if ( type == Short.TYPE ) { - return Short.valueOf( field.getShort( owner ) ); + return field.getShort(owner); } } return field.get( owner ); @@ -121,10 +121,10 @@ public class GetterFieldImpl implements Getter { } private static class SerialForm extends AbstractFieldSerialForm implements Serializable { - private final Class containerClass; + private final Class containerClass; private final String propertyName; - private SerialForm(Class containerClass, String propertyName, Field field) { + private SerialForm(Class containerClass, String propertyName, Field field) { super( field ); this.containerClass = containerClass; this.propertyName = propertyName; diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterMethodImpl.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterMethodImpl.java index 84f46814d0..7eda3f5fae 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterMethodImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterMethodImpl.java @@ -28,11 +28,11 @@ import static org.hibernate.internal.CoreLogging.messageLogger; public class GetterMethodImpl implements Getter { private static final CoreMessageLogger LOG = messageLogger( GetterMethodImpl.class ); - private final Class containerClass; + private final Class containerClass; private final String propertyName; private final Method getterMethod; - public GetterMethodImpl(Class containerClass, String propertyName, Method getterMethod) { + public GetterMethodImpl(Class containerClass, String propertyName, Method getterMethod) { this.containerClass = containerClass; this.propertyName = propertyName; this.getterMethod = getterMethod; @@ -109,13 +109,13 @@ public class GetterMethodImpl implements Getter { } private static class SerialForm implements Serializable { - private final Class containerClass; + private final Class containerClass; private final String propertyName; - private final Class declaringClass; + private final Class declaringClass; private final String methodName; - private SerialForm(Class containerClass, String propertyName, Method method) { + private SerialForm(Class containerClass, String propertyName, Method method) { this.containerClass = containerClass; this.propertyName = propertyName; this.declaringClass = method.getDeclaringClass(); @@ -126,7 +126,6 @@ public class GetterMethodImpl implements Getter { return new GetterMethodImpl( containerClass, propertyName, resolveMethod() ); } - @SuppressWarnings("unchecked") private Method resolveMethod() { try { final Method method = declaringClass.getDeclaredMethod( methodName ); diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccessStrategyResolver.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccessStrategyResolver.java index 1691471507..91c2f6d0bf 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccessStrategyResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccessStrategyResolver.java @@ -27,7 +27,7 @@ public interface PropertyAccessStrategyResolver extends Service { * @return The resolved PropertyAccessStrategy */ PropertyAccessStrategy resolvePropertyAccessStrategy( - Class containerClass, + Class containerClass, String explicitAccessStrategyName, RepresentationMode representationMode); } diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java index 00a38d1a45..0861b569c5 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java @@ -12,7 +12,6 @@ import java.lang.reflect.Method; import java.util.Locale; import org.hibernate.PropertyAccessException; -import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.property.access.internal.AbstractFieldSerialForm; import org.hibernate.proxy.HibernateProxy; @@ -23,19 +22,19 @@ import org.hibernate.proxy.HibernateProxy; * @author Steve Ebersole */ public class SetterFieldImpl implements Setter { - private final Class containerClass; + private final Class containerClass; private final String propertyName; private final Field field; private final Method setterMethod; - public SetterFieldImpl(Class containerClass, String propertyName, Field field) { + public SetterFieldImpl(Class containerClass, String propertyName, Field field) { this.containerClass = containerClass; this.propertyName = propertyName; this.field = field; this.setterMethod = ReflectHelper.setterMethodOrNull( containerClass, propertyName, field.getType() ); } - public Class getContainerClass() { + public Class getContainerClass() { return containerClass; } @@ -105,11 +104,11 @@ public class SetterFieldImpl implements Setter { } private static class SerialForm extends AbstractFieldSerialForm implements Serializable { - private final Class containerClass; + private final Class containerClass; private final String propertyName; - private SerialForm(Class containerClass, String propertyName, Field field) { + private SerialForm(Class containerClass, String propertyName, Field field) { super( field ); this.containerClass = containerClass; this.propertyName = propertyName; diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterMethodImpl.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterMethodImpl.java index f7ce9f0747..0b4f7f1e13 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterMethodImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterMethodImpl.java @@ -23,13 +23,13 @@ import static org.hibernate.internal.CoreLogging.messageLogger; public class SetterMethodImpl implements Setter { private static final CoreMessageLogger LOG = messageLogger( SetterMethodImpl.class ); - private final Class containerClass; + private final Class containerClass; private final String propertyName; private final Method setterMethod; private final boolean isPrimitive; - public SetterMethodImpl(Class containerClass, String propertyName, Method setterMethod) { + public SetterMethodImpl(Class containerClass, String propertyName, Method setterMethod) { this.containerClass = containerClass; this.propertyName = propertyName; this.setterMethod = setterMethod; @@ -92,7 +92,7 @@ public class SetterMethodImpl implements Setter { ); } else { - final Class expectedType = setterMethod.getParameterTypes()[0]; + final Class expectedType = setterMethod.getParameterTypes()[0]; LOG.illegalPropertySetterArgument( containerClass.getName(), propertyName ); LOG.expectedType( expectedType.getName(), value == null ? null : value.getClass().getName() ); throw new PropertySetterAccessException( @@ -122,14 +122,14 @@ public class SetterMethodImpl implements Setter { } private static class SerialForm implements Serializable { - private final Class containerClass; + private final Class containerClass; private final String propertyName; - private final Class declaringClass; + private final Class declaringClass; private final String methodName; - private final Class argumentType; + private final Class argumentType; - private SerialForm(Class containerClass, String propertyName, Method method) { + private SerialForm(Class containerClass, String propertyName, Method method) { this.containerClass = containerClass; this.propertyName = propertyName; this.declaringClass = method.getDeclaringClass(); @@ -141,7 +141,6 @@ public class SetterMethodImpl implements Setter { return new SetterMethodImpl( containerClass, propertyName, resolveMethod() ); } - @SuppressWarnings("unchecked") private Method resolveMethod() { try { final Method method = declaringClass.getDeclaredMethod( methodName, argumentType ); diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/HibernateProxy.java b/hibernate-core/src/main/java/org/hibernate/proxy/HibernateProxy.java index 6f2bf5299a..b0fd612d73 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/HibernateProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/HibernateProxy.java @@ -18,12 +18,12 @@ public interface HibernateProxy extends Serializable { * * @return The serializable proxy replacement. */ - public Object writeReplace(); + Object writeReplace(); /** * Get the underlying lazy initialization handler. * * @return The lazy initializer. */ - public LazyInitializer getHibernateLazyInitializer(); + LazyInitializer getHibernateLazyInitializer(); } diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java index fdf2d2395b..26fe5fa3ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java @@ -60,7 +60,7 @@ public interface LazyInitializer { * * @return The actual entity class. */ - Class getPersistentClass(); + Class getPersistentClass(); /** * Is the proxy uninitialized? diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/ProxyFactory.java b/hibernate-core/src/main/java/org/hibernate/proxy/ProxyFactory.java index 03653b5abc..305a8fe46b 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/ProxyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/ProxyFactory.java @@ -46,8 +46,8 @@ public interface ProxyFactory { */ void postInstantiate( String entityName, - Class persistentClass, - Set interfaces, + Class persistentClass, + Set> interfaces, Method getIdentifierMethod, Method setIdentifierMethod, CompositeType componentIdType) throws HibernateException; diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/map/MapLazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/map/MapLazyInitializer.java index ad96180b67..0122fcf6d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/map/MapLazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/map/MapLazyInitializer.java @@ -23,11 +23,12 @@ public class MapLazyInitializer extends AbstractLazyInitializer implements Seria super( entityName, id, session ); } + @SuppressWarnings("rawtypes") public Map getMap() { return (Map) getImplementation(); } - public Class getPersistentClass() { + public Class getPersistentClass() { throw new UnsupportedOperationException("dynamic-map entity representation"); } diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxy.java b/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxy.java index 448f5c9b2a..cd763cc75e 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxy.java @@ -5,6 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package org.hibernate.proxy.map; + import java.io.Serializable; import java.util.Collection; import java.util.Map; @@ -20,7 +21,7 @@ import org.hibernate.proxy.LazyInitializer; */ public class MapProxy implements HibernateProxy, Map, Serializable { - private MapLazyInitializer li; + private final MapLazyInitializer li; private Object replacement; @@ -58,22 +59,22 @@ public class MapProxy implements HibernateProxy, Map, Serializable { return li.getMap().containsValue(value); } - @Override + @Override @SuppressWarnings("rawtypes") public Collection values() { return li.getMap().values(); } - @Override + @Override @SuppressWarnings("unchecked") public void putAll(Map t) { li.getMap().putAll(t); } - @Override + @Override @SuppressWarnings("rawtypes") public Set entrySet() { return li.getMap().entrySet(); } - @Override + @Override @SuppressWarnings("rawtypes") public Set keySet() { return li.getMap().keySet(); } @@ -88,7 +89,7 @@ public class MapProxy implements HibernateProxy, Map, Serializable { return li.getMap().remove(key); } - @Override + @Override @SuppressWarnings("unchecked") public Object put(Object key, Object value) { return li.getMap().put(key, value); } diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxyFactory.java b/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxyFactory.java index 0cc9c9f492..bb28e25153 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/map/MapProxyFactory.java @@ -9,7 +9,6 @@ package org.hibernate.proxy.map; import java.lang.reflect.Method; import java.util.Set; -import org.hibernate.HibernateException; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.proxy.HibernateProxy; import org.hibernate.proxy.ProxyFactory; @@ -24,11 +23,11 @@ public class MapProxyFactory implements ProxyFactory { public void postInstantiate( final String entityName, - final Class persistentClass, - final Set interfaces, + final Class persistentClass, + final Set> interfaces, final Method getIdentifierMethod, final Method setIdentifierMethod, - CompositeType componentIdType) throws HibernateException { + CompositeType componentIdType) { this.entityName = entityName; } diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/BasicLazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/BasicLazyInitializer.java index 132e330ab0..f780eb9487 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/BasicLazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/BasicLazyInitializer.java @@ -22,7 +22,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer { protected static final Object INVOKE_IMPLEMENTATION = new MarkerObject( "INVOKE_IMPLEMENTATION" ); - protected final Class persistentClass; + protected final Class persistentClass; protected final Method getIdentifierMethod; protected final Method setIdentifierMethod; protected final boolean overridesEquals; @@ -32,7 +32,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer { protected BasicLazyInitializer( String entityName, - Class persistentClass, + Class persistentClass, Object id, Method getIdentifierMethod, Method setIdentifierMethod, @@ -108,7 +108,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer { } - public final Class getPersistentClass() { + public final Class getPersistentClass() { return persistentClass; } diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/ProxyFactoryHelper.java b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/ProxyFactoryHelper.java index 62d4fd7a67..10f7049d2b 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/ProxyFactoryHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/ProxyFactoryHelper.java @@ -13,8 +13,6 @@ import java.util.Set; import org.hibernate.HibernateException; import org.hibernate.MappingException; -import org.hibernate.internal.CoreLogging; -import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; @@ -31,16 +29,14 @@ import org.hibernate.tuple.entity.PojoEntityTuplizer; */ public final class ProxyFactoryHelper { - private static final CoreMessageLogger LOG = CoreLogging.messageLogger( ProxyFactoryHelper.class ); - private ProxyFactoryHelper() { //not meant to be instantiated } - public static Set extractProxyInterfaces(final PersistentClass persistentClass, final String entityName) { - final Set proxyInterfaces = new java.util.HashSet<>(); - final Class mappedClass = persistentClass.getMappedClass(); - final Class proxyInterface = persistentClass.getProxyInterface(); + public static Set> extractProxyInterfaces(final PersistentClass persistentClass, final String entityName) { + final Set> proxyInterfaces = new java.util.HashSet<>(); + final Class mappedClass = persistentClass.getMappedClass(); + final Class proxyInterface = persistentClass.getProxyInterface(); if ( proxyInterface != null && !mappedClass.equals( proxyInterface ) ) { if ( !proxyInterface.isInterface() ) { @@ -58,8 +54,8 @@ public final class ProxyFactoryHelper { Iterator subclasses = persistentClass.getSubclassIterator(); while ( subclasses.hasNext() ) { final Subclass subclass = subclasses.next(); - final Class subclassProxy = subclass.getProxyInterface(); - final Class subclassClass = subclass.getMappedClass(); + final Class subclassProxy = subclass.getProxyInterface(); + final Class subclassClass = subclass.getMappedClass(); if ( subclassProxy != null && !subclassClass.equals( subclassProxy ) ) { if ( !subclassProxy.isInterface() ) { throw new MappingException( @@ -75,8 +71,8 @@ public final class ProxyFactoryHelper { } public static void validateProxyability(final PersistentClass persistentClass) { - Iterator properties = persistentClass.getPropertyIterator(); - Class clazz = persistentClass.getMappedClass(); + Iterator properties = persistentClass.getPropertyIterator(); + Class clazz = persistentClass.getMappedClass(); while ( properties.hasNext() ) { Property property = (Property) properties.next(); validateGetterSetterMethodProxyability( "Getter", property.getGetter( clazz ).getMethod() ); @@ -97,21 +93,19 @@ public final class ProxyFactoryHelper { } } - public static Method extractProxySetIdentifierMethod(final Setter idSetter, final Class proxyInterface) { + public static Method extractProxySetIdentifierMethod(final Setter idSetter, final Class proxyInterface) { Method idSetterMethod = idSetter == null ? null : idSetter.getMethod(); - Method proxySetIdentifierMethod = idSetterMethod == null || proxyInterface == null ? - null : - ReflectHelper.getMethod( proxyInterface, idSetterMethod ); - return proxySetIdentifierMethod; + return idSetterMethod == null || proxyInterface == null + ? null + : ReflectHelper.getMethod( proxyInterface, idSetterMethod ); } - public static Method extractProxyGetIdentifierMethod(final Getter idGetter, final Class proxyInterface) { + public static Method extractProxyGetIdentifierMethod(final Getter idGetter, final Class proxyInterface) { Method idGetterMethod = idGetter == null ? null : idGetter.getMethod(); - Method proxyGetIdentifierMethod = idGetterMethod == null || proxyInterface == null ? - null : - ReflectHelper.getMethod( proxyInterface, idGetterMethod ); - return proxyGetIdentifierMethod; + return idGetterMethod == null || proxyInterface == null + ? null + : ReflectHelper.getMethod( proxyInterface, idGetterMethod ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyInterceptor.java b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyInterceptor.java index edcbf509d9..8de150ae1e 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyInterceptor.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyInterceptor.java @@ -21,12 +21,12 @@ import static org.hibernate.internal.CoreLogging.messageLogger; public class ByteBuddyInterceptor extends BasicLazyInitializer implements ProxyConfiguration.Interceptor { private static final CoreMessageLogger LOG = messageLogger( ByteBuddyInterceptor.class ); - private final Class[] interfaces; + private final Class[] interfaces; public ByteBuddyInterceptor( String entityName, - Class persistentClass, - Class[] interfaces, + Class persistentClass, + Class[] interfaces, Object id, Method getIdentifierMethod, Method setIdentifierMethod, diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyFactory.java b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyFactory.java index d4995db432..455e9df04f 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyFactory.java @@ -28,15 +28,15 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable { private final ByteBuddyProxyHelper byteBuddyProxyHelper; - private Class persistentClass; + private Class persistentClass; private String entityName; - private Class[] interfaces; + private Class[] interfaces; private Method getIdentifierMethod; private Method setIdentifierMethod; private CompositeType componentIdType; private boolean overridesEquals; - private Class proxyClass; + private Class proxyClass; public ByteBuddyProxyFactory(ByteBuddyProxyHelper byteBuddyProxyHelper) { this.byteBuddyProxyHelper = byteBuddyProxyHelper; @@ -45,8 +45,8 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable { @Override public void postInstantiate( String entityName, - Class persistentClass, - Set interfaces, + Class persistentClass, + Set> interfaces, Method getIdentifierMethod, Method setIdentifierMethod, CompositeType componentIdType) throws HibernateException { @@ -61,7 +61,7 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable { this.proxyClass = byteBuddyProxyHelper.buildProxy( persistentClass, this.interfaces ); } - private Class[] toArray(Set interfaces) { + private Class[] toArray(Set> interfaces) { if ( interfaces == null ) { return ArrayHelper.EMPTY_CLASS_ARRAY; } diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyHelper.java b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyHelper.java index e8cad73af1..a0409efda8 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyHelper.java @@ -58,12 +58,11 @@ public class ByteBuddyProxyHelper implements Serializable { /** * Do not remove: used by Quarkus */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public DynamicType.Unloaded buildUnloadedProxy(final Class persistentClass, final Class[] interfaces) { + public DynamicType.Unloaded buildUnloadedProxy(final Class persistentClass, final Class[] interfaces) { return byteBuddyState.make( proxyBuilder( persistentClass, interfaces ) ); } - private Function> proxyBuilder(Class persistentClass, Class[] interfaces) { + private Function> proxyBuilder(Class persistentClass, Class[] interfaces) { return byteBuddy -> byteBuddy .ignore( byteBuddyState.getProxyDefinitionHelpers().getGroovyGetMetaClassFilter() ) .with( new NamingStrategy.SuffixingRandom( PROXY_NAMING_SUFFIX, new NamingStrategy.SuffixingRandom.BaseNameResolver.ForFixedValue( persistentClass.getName() ) ) ) @@ -93,7 +92,7 @@ public class ByteBuddyProxyHelper implements Serializable { // note: interface is assumed to already contain HibernateProxy.class try { - final Class proxyClass = buildProxy( + final Class proxyClass = buildProxy( serializableProxy.getPersistentClass(), serializableProxy.getInterfaces() ); diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/SerializableProxy.java b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/SerializableProxy.java index b9f7fe23ab..af1c29e6d4 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/SerializableProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/SerializableProxy.java @@ -17,15 +17,15 @@ import org.hibernate.proxy.HibernateProxy; import org.hibernate.type.CompositeType; public final class SerializableProxy extends AbstractSerializableProxy { - private final Class persistentClass; - private final Class[] interfaces; + private final Class persistentClass; + private final Class[] interfaces; private final String identifierGetterMethodName; - private final Class identifierGetterMethodClass; + private final Class identifierGetterMethodClass; private final String identifierSetterMethodName; - private final Class identifierSetterMethodClass; - private final Class[] identifierSetterMethodParams; + private final Class identifierSetterMethodClass; + private final Class[] identifierSetterMethodParams; private final CompositeType componentIdType; @@ -35,8 +35,8 @@ public final class SerializableProxy extends AbstractSerializableProxy { @Deprecated public SerializableProxy( String entityName, - Class persistentClass, - Class[] interfaces, + Class persistentClass, + Class[] interfaces, Serializable id, Boolean readOnly, Method getIdentifierMethod, @@ -50,8 +50,8 @@ public final class SerializableProxy extends AbstractSerializableProxy { public SerializableProxy( String entityName, - Class persistentClass, - Class[] interfaces, + Class persistentClass, + Class[] interfaces, Object id, Boolean readOnly, String sessionFactoryUuid, @@ -95,35 +95,35 @@ public final class SerializableProxy extends AbstractSerializableProxy { return super.getId(); } - protected Class getPersistentClass() { + Class getPersistentClass() { return persistentClass; } - protected Class[] getInterfaces() { + Class[] getInterfaces() { return interfaces; } - protected String getIdentifierGetterMethodName() { + String getIdentifierGetterMethodName() { return identifierGetterMethodName; } - protected Class getIdentifierGetterMethodClass() { + Class getIdentifierGetterMethodClass() { return identifierGetterMethodClass; } - protected String getIdentifierSetterMethodName() { + String getIdentifierSetterMethodName() { return identifierSetterMethodName; } - protected Class getIdentifierSetterMethodClass() { + Class getIdentifierSetterMethodClass() { return identifierSetterMethodClass; } - protected Class[] getIdentifierSetterMethodParams() { + Class[] getIdentifierSetterMethodParams() { return identifierSetterMethodParams; } - protected CompositeType getComponentIdType() { + CompositeType getComponentIdType() { return componentIdType; } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/Attribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/Attribute.java index be0ea3ceab..19b8a5337c 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/Attribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/Attribute.java @@ -14,6 +14,6 @@ import org.hibernate.type.Type; * @author Steve Ebersole */ public interface Attribute { - public String getName(); - public Type getType(); + String getName(); + Type getType(); } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/DynamicMapInstantiator.java b/hibernate-core/src/main/java/org/hibernate/tuple/DynamicMapInstantiator.java index 077dba43a7..25c967b938 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/DynamicMapInstantiator.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/DynamicMapInstantiator.java @@ -18,7 +18,7 @@ public class DynamicMapInstantiator implements Instantiator { public static final String KEY = "$type$"; private final String roleName; - private Set isInstanceEntityNames = new HashSet<>(); + private final Set isInstanceEntityNames = new HashSet<>(); public DynamicMapInstantiator() { this.roleName = null; diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/InMemoryValueGenerationStrategy.java b/hibernate-core/src/main/java/org/hibernate/tuple/InMemoryValueGenerationStrategy.java index 7598e168e4..35a2b3206b 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/InMemoryValueGenerationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/InMemoryValueGenerationStrategy.java @@ -15,7 +15,7 @@ public interface InMemoryValueGenerationStrategy { * * @return When the value is generated. */ - public GenerationTiming getGenerationTiming(); + GenerationTiming getGenerationTiming(); /** * Obtain the in-VM value generator. @@ -25,5 +25,5 @@ public interface InMemoryValueGenerationStrategy { * * @return The strategy for performing in-VM value generation */ - public ValueGenerator getValueGenerator(); + ValueGenerator getValueGenerator(); } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/PojoInstantiator.java b/hibernate-core/src/main/java/org/hibernate/tuple/PojoInstantiator.java index fd4c30a70f..b877268c8e 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/PojoInstantiator.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/PojoInstantiator.java @@ -26,9 +26,9 @@ import org.hibernate.mapping.Component; public class PojoInstantiator implements Instantiator, Serializable { private static final CoreMessageLogger LOG = CoreLogging.messageLogger( PojoInstantiator.class.getName() ); - private transient Constructor constructor; + private transient Constructor constructor; - private final Class mappedClass; + private final Class mappedClass; private final transient ReflectionOptimizer.InstantiationOptimizer optimizer; private final boolean embeddedIdentifier; private final boolean isAbstract; @@ -38,7 +38,7 @@ public class PojoInstantiator implements Instantiator, Serializable { */ @Deprecated public PojoInstantiator( - Class mappedClass, + Class mappedClass, ReflectionOptimizer.InstantiationOptimizer optimizer, boolean embeddedIdentifier) { this.mappedClass = mappedClass; @@ -67,7 +67,7 @@ public class PojoInstantiator implements Instantiator, Serializable { * @deprecated (as of 6.0) See {@link PojoInstantiator} */ @Deprecated - public PojoInstantiator(Class componentClass, ReflectionOptimizer.InstantiationOptimizer optimizer) { + public PojoInstantiator(Class componentClass, ReflectionOptimizer.InstantiationOptimizer optimizer) { this.mappedClass = componentClass; this.isAbstract = ReflectHelper.isAbstractClass( mappedClass ); this.optimizer = optimizer; diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/Property.java b/hibernate-core/src/main/java/org/hibernate/tuple/Property.java index 24e096f8b8..65e8526680 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/Property.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/Property.java @@ -19,5 +19,5 @@ public interface Property extends Attribute { * @deprecated DOM4j entity mode is no longer supported */ @Deprecated - public String getNode(); + String getNode(); } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java index 6fb6f73e76..9c0c04ae1f 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java @@ -44,7 +44,7 @@ public interface Tuplizer { * @param i The index of the property for which to extract the value. * @return The current value of the given property on the given entity. */ - public Object getPropertyValue(Object entity, int i); + Object getPropertyValue(Object entity, int i); /** * Return the pojo class managed by this tuplizer. @@ -56,7 +56,7 @@ public interface Tuplizer { * * @return The persistent class. */ - public Class getMappedClass(); + Class getMappedClass(); /** * Retrieve the getter for the specified property. @@ -64,5 +64,5 @@ public interface Tuplizer { * @param i The property index. * @return The property getter. */ - public Getter getGetter(int i); + Getter getGetter(int i); } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/ValueGenerator.java b/hibernate-core/src/main/java/org/hibernate/tuple/ValueGenerator.java index 95c3439c39..ea4a66acfe 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/ValueGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/ValueGenerator.java @@ -22,7 +22,7 @@ public interface ValueGenerator { * * @return The generated value */ - public T generateValue(Session session, Object owner); + T generateValue(Session session, Object owner); /** * Generate the value. @@ -33,7 +33,7 @@ public interface ValueGenerator { * * @return The generated value */ - public default T generateValue(Session session, Object owner, Object currentValue) { + default T generateValue(Session session, Object owner, Object currentValue) { return generateValue(session, owner); } } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java index f712fa4d6f..1c61298fed 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java @@ -59,158 +59,153 @@ public abstract class AbstractCompositionAttribute @Override public Iterable getAttributes() { - return new Iterable() { + return () -> new Iterator<>() { + private final int numberOfAttributes = getType().getSubtypes().length; + private int currentSubAttributeNumber; + private int currentColumnPosition = columnStartPosition; + @Override - public Iterator iterator() { - return new Iterator() { - private final int numberOfAttributes = getType().getSubtypes().length; - private int currentSubAttributeNumber; - private int currentColumnPosition = columnStartPosition; + public boolean hasNext() { + return currentSubAttributeNumber < numberOfAttributes; + } - @Override - public boolean hasNext() { - return currentSubAttributeNumber < numberOfAttributes; + @Override + public AttributeDefinition next() { + final int subAttributeNumber = currentSubAttributeNumber; + currentSubAttributeNumber++; + + final String name = getType().getPropertyNames()[subAttributeNumber]; + final Type type = getType().getSubtypes()[subAttributeNumber]; + + int columnPosition = currentColumnPosition; + currentColumnPosition += type.getColumnSpan( sessionFactory() ); + + final CompositeType cType = getType(); + final boolean nullable = + cType.getPropertyNullability() == null || + cType.getPropertyNullability()[subAttributeNumber]; + + if ( type.isAssociationType() ) { + // we build the association-key here because of the "goofiness" with 'currentColumnPosition' + final AssociationKey associationKey; + final AssociationType aType = (AssociationType) type; + + if ( aType.isAnyType() ) { + associationKey = new AssociationKey( + JoinHelper.getLHSTableName( + aType, + attributeNumber(), + (OuterJoinLoadable) locateOwningPersister() + ), + JoinHelper.getLHSColumnNames( + aType, + attributeNumber(), + columnPosition, + (OuterJoinLoadable) locateOwningPersister(), + sessionFactory() + ) + ); } + else if ( aType.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) { + final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() ); - @Override - public AttributeDefinition next() { - final int subAttributeNumber = currentSubAttributeNumber; - currentSubAttributeNumber++; + final String lhsTableName; + final String[] lhsColumnNames; - final String name = getType().getPropertyNames()[subAttributeNumber]; - final Type type = getType().getSubtypes()[subAttributeNumber]; - - int columnPosition = currentColumnPosition; - currentColumnPosition += type.getColumnSpan( sessionFactory() ); - - final CompositeType cType = getType(); - final boolean nullable = - cType.getPropertyNullability() == null || - cType.getPropertyNullability()[subAttributeNumber]; - - if ( type.isAssociationType() ) { - // we build the association-key here because of the "goofiness" with 'currentColumnPosition' - final AssociationKey associationKey; - final AssociationType aType = (AssociationType) type; - - if ( aType.isAnyType() ) { - associationKey = new AssociationKey( - JoinHelper.getLHSTableName( - aType, - attributeNumber(), - (OuterJoinLoadable) locateOwningPersister() - ), - JoinHelper.getLHSColumnNames( - aType, - attributeNumber(), - columnPosition, - (OuterJoinLoadable) locateOwningPersister(), - sessionFactory() - ) - ); - } - else if ( aType.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) { - final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() ); - - final String lhsTableName; - final String[] lhsColumnNames; - - if ( joinable.isCollection() ) { - final QueryableCollection collectionPersister = (QueryableCollection) joinable; - lhsTableName = collectionPersister.getTableName(); - lhsColumnNames = collectionPersister.getElementColumnNames(); - } - else { - final OuterJoinLoadable entityPersister = (OuterJoinLoadable) locateOwningPersister(); - lhsTableName = getLHSTableName( aType, attributeNumber(), entityPersister ); - lhsColumnNames = getLHSColumnNames( - aType, - attributeNumber(), - columnPosition, - entityPersister, - sessionFactory() - ); - } - associationKey = new AssociationKey( lhsTableName, lhsColumnNames ); - } - else { - final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() ); - - associationKey = new AssociationKey( - joinable.getTableName(), - getRHSColumnNames( aType, sessionFactory() ) - ); - } - - return new CompositeBasedAssociationAttribute( - AbstractCompositionAttribute.this, - sessionFactory(), - attributeNumber(), - name, - (AssociationType) type, - new BaselineAttributeInformation.Builder() - .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) - .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) - // todo : handle nested ValueGeneration strategies... - // disallow if our strategy != NEVER - .setNullable( nullable ) - .setDirtyCheckable( true ) - .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) - .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) - .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) - .createInformation(), - subAttributeNumber, - associationKey - ); - } - else if ( type.isComponentType() ) { - return new CompositionBasedCompositionAttribute( - AbstractCompositionAttribute.this, - sessionFactory(), - attributeNumber(), - name, - (CompositeType) type, - columnPosition, - new BaselineAttributeInformation.Builder() - .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) - .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) - // todo : handle nested ValueGeneration strategies... - // disallow if our strategy != NEVER - .setNullable( nullable ) - .setDirtyCheckable( true ) - .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) - .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) - .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) - .createInformation() - ); + if ( joinable.isCollection() ) { + final QueryableCollection collectionPersister = (QueryableCollection) joinable; + lhsTableName = collectionPersister.getTableName(); + lhsColumnNames = collectionPersister.getElementColumnNames(); } else { - return new CompositeBasedBasicAttribute( - AbstractCompositionAttribute.this, - sessionFactory(), - subAttributeNumber, - name, - type, - new BaselineAttributeInformation.Builder() - .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) - .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) - // todo : handle nested ValueGeneration strategies... - // disallow if our strategy != NEVER - .setNullable( nullable ) - .setDirtyCheckable( true ) - .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) - .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) - .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) - .createInformation() + final OuterJoinLoadable entityPersister = (OuterJoinLoadable) locateOwningPersister(); + lhsTableName = getLHSTableName( aType, attributeNumber(), entityPersister ); + lhsColumnNames = getLHSColumnNames( + aType, + attributeNumber(), + columnPosition, + entityPersister, + sessionFactory() ); } + associationKey = new AssociationKey( lhsTableName, lhsColumnNames ); + } + else { + final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() ); + + associationKey = new AssociationKey( + joinable.getTableName(), + getRHSColumnNames( aType, sessionFactory() ) + ); } - @Override - public void remove() { - throw new UnsupportedOperationException( "Remove operation not supported here" ); - } - }; + return new CompositeBasedAssociationAttribute( + AbstractCompositionAttribute.this, + sessionFactory(), + attributeNumber(), + name, + (AssociationType) type, + new BaselineAttributeInformation.Builder() + .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) + .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) + // todo : handle nested ValueGeneration strategies... + // disallow if our strategy != NEVER + .setNullable( nullable ) + .setDirtyCheckable( true ) + .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) + .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) + .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) + .createInformation(), + subAttributeNumber, + associationKey + ); + } + else if ( type.isComponentType() ) { + return new CompositionBasedCompositionAttribute( + AbstractCompositionAttribute.this, + sessionFactory(), + attributeNumber(), + name, + (CompositeType) type, + columnPosition, + new BaselineAttributeInformation.Builder() + .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) + .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) + // todo : handle nested ValueGeneration strategies... + // disallow if our strategy != NEVER + .setNullable( nullable ) + .setDirtyCheckable( true ) + .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) + .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) + .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) + .createInformation() + ); + } + else { + return new CompositeBasedBasicAttribute( + AbstractCompositionAttribute.this, + sessionFactory(), + subAttributeNumber, + name, + type, + new BaselineAttributeInformation.Builder() + .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) + .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) + // todo : handle nested ValueGeneration strategies... + // disallow if our strategy != NEVER + .setNullable( nullable ) + .setDirtyCheckable( true ) + .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) + .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) + .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) + .createInformation() + ); + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException( "Remove operation not supported here" ); } }; } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java index 8246384034..b8893303b9 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java @@ -39,11 +39,11 @@ public class CompositionBasedCompositionAttribute extends AbstractCompositionAtt @Override protected EntityPersister locateOwningPersister() { final AbstractCompositionAttribute source = (AbstractCompositionAttribute) getSource(); - if ( EntityDefinition.class.isInstance( source.getSource() ) ) { - return EntityDefinition.class.cast( source.getSource() ).getEntityPersister(); + if (source.getSource() instanceof EntityDefinition) { + return ( (EntityDefinition) source.getSource() ).getEntityPersister(); } else { - return AbstractCompositionAttribute.class.cast( source.getSource() ).locateOwningPersister(); + return ( (AbstractCompositionAttribute) source.getSource() ).locateOwningPersister(); } } } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/BytecodeEnhancementMetadataPojoImpl.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/BytecodeEnhancementMetadataPojoImpl.java index 3127c9e995..d96b09de89 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/BytecodeEnhancementMetadataPojoImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/BytecodeEnhancementMetadataPojoImpl.java @@ -40,7 +40,7 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc CompositeType nonAggregatedCidMapper, boolean collectionsInDefaultFetchGroupEnabled, PersisterCreationContext creationContext) { - final Class mappedClass = persistentClass.getMappedClass(); + final Class mappedClass = persistentClass.getMappedClass(); final boolean enhancedForLazyLoading = PersistentAttributeInterceptable.class.isAssignableFrom( mappedClass ); final LazyAttributesMetadata lazyAttributesMetadata = enhancedForLazyLoading ? LazyAttributesMetadata.from( persistentClass, true, collectionsInDefaultFetchGroupEnabled, creationContext ) @@ -57,16 +57,15 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc } private final String entityName; - private final Class entityClass; + private final Class entityClass; private final Set identifierAttributeNames; private final CompositeType nonAggregatedCidMapper; private final boolean enhancedForLazyLoading; private final LazyAttributesMetadata lazyAttributesMetadata; - @SuppressWarnings("WeakerAccess") - protected BytecodeEnhancementMetadataPojoImpl( + BytecodeEnhancementMetadataPojoImpl( String entityName, - Class entityClass, + Class entityClass, Set identifierAttributeNames, CompositeType nonAggregatedCidMapper, boolean enhancedForLazyLoading, @@ -105,7 +104,7 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc final BytecodeLazyAttributeInterceptor interceptor = extractLazyInterceptor( entity ); if ( interceptor instanceof LazyAttributeLoadingInterceptor ) { - return ( (LazyAttributeLoadingInterceptor) interceptor ).hasAnyUninitializedAttributes(); + return interceptor.hasAnyUninitializedAttributes(); } //noinspection RedundantIfStatement @@ -124,7 +123,7 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc final BytecodeLazyAttributeInterceptor interceptor = extractLazyInterceptor( entity ); if ( interceptor instanceof LazyAttributeLoadingInterceptor ) { - return ( (LazyAttributeLoadingInterceptor) interceptor ).isAttributeLoaded( attributeName ); + return interceptor.isAttributeLoaded( attributeName ); } return true; diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java index b5bc1140d5..5aa2c1da3c 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java @@ -78,7 +78,7 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer { } @Override - public Class getMappedClass() { + public Class getMappedClass() { return Map.class; } @@ -89,10 +89,10 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer { @Override public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) { - return extractEmbeddedEntityName( (Map) entityInstance ); + return extractEmbeddedEntityName( (Map) entityInstance ); } - public static String extractEmbeddedEntityName(Map entity) { + public static String extractEmbeddedEntityName(Map entity) { return (String) entity.get( DynamicMapInstantiator.KEY ); } @@ -101,10 +101,10 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer { @Override public String resolveEntityName(Object entity) { - if ( !Map.class.isInstance( entity ) ) { + if ( !(entity instanceof Map) ) { return null; } - final String entityName = extractEmbeddedEntityName( (Map) entity ); + final String entityName = extractEmbeddedEntityName( (Map) entity ); if ( entityName == null ) { throw new HibernateException( "Could not determine type of dynamic map entity" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java index 9a7af97c18..d9aaba1eb5 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java @@ -124,7 +124,7 @@ public class EntityMetamodel implements Serializable { private final boolean inherited; private final boolean hasSubclasses; private final Set subclassEntityNames; - private final Map entityNameByInheritenceClassMap; + private final Map,String> entityNameByInheritenceClassMap; private final BytecodeEnhancementMetadata bytecodeEnhancementMetadata; @@ -290,7 +290,7 @@ public class EntityMetamodel implements Serializable { if ( pair.getInMemoryStrategy() != null ) { final GenerationTiming timing = pair.getInMemoryStrategy().getGenerationTiming(); if ( timing != GenerationTiming.NEVER ) { - final ValueGenerator generator = pair.getInMemoryStrategy().getValueGenerator(); + final ValueGenerator generator = pair.getInMemoryStrategy().getValueGenerator(); if ( generator != null ) { // we have some level of generation indicated if ( timing == GenerationTiming.INSERT ) { @@ -372,7 +372,7 @@ public class EntityMetamodel implements Serializable { ReflectHelper.isAbstractClass( persistentClass.getMappedClass() ); } else { - isAbstract = persistentClass.isAbstract().booleanValue(); + isAbstract = persistentClass.isAbstract(); if ( !isAbstract && persistentClass.hasPojoRepresentation() && ReflectHelper.isAbstractClass( persistentClass.getMappedClass() ) ) { LOG.entityMappedAsNonAbstract(name); @@ -405,7 +405,7 @@ public class EntityMetamodel implements Serializable { hasCollections = foundCollection; mutablePropertiesIndexes = mutableIndexes; - Iterator iter = persistentClass.getSubclassIterator(); + Iterator iter = persistentClass.getSubclassIterator(); final Set subclassEntityNamesLocal = new HashSet<>(); while ( iter.hasNext() ) { subclassEntityNamesLocal.add( ( (PersistentClass) iter.next() ).getEntityName() ); @@ -413,16 +413,16 @@ public class EntityMetamodel implements Serializable { subclassEntityNamesLocal.add( name ); subclassEntityNames = CollectionHelper.toSmallSet( subclassEntityNamesLocal ); - HashMap entityNameByInheritenceClassMapLocal = new HashMap(); + HashMap, String> entityNameByInheritanceClassMapLocal = new HashMap<>(); if ( persistentClass.hasPojoRepresentation() ) { - entityNameByInheritenceClassMapLocal.put( persistentClass.getMappedClass(), persistentClass.getEntityName() ); + entityNameByInheritanceClassMapLocal.put( persistentClass.getMappedClass(), persistentClass.getEntityName() ); iter = persistentClass.getSubclassIterator(); while ( iter.hasNext() ) { final PersistentClass pc = ( PersistentClass ) iter.next(); - entityNameByInheritenceClassMapLocal.put( pc.getMappedClass(), pc.getEntityName() ); + entityNameByInheritanceClassMapLocal.put( pc.getMappedClass(), pc.getEntityName() ); } } - entityNameByInheritenceClassMap = CollectionHelper.toSmallMap( entityNameByInheritenceClassMapLocal ); + entityNameByInheritenceClassMap = CollectionHelper.toSmallMap( entityNameByInheritanceClassMapLocal ); } private static GenerationStrategyPair buildGenerationStrategyPair( @@ -463,7 +463,7 @@ public class EntityMetamodel implements Serializable { SessionFactoryImplementor sessionFactory, Component composite, CompositeGenerationStrategyPairBuilder builder) { - Iterator subProperties = composite.getPropertyIterator(); + Iterator subProperties = composite.getPropertyIterator(); while ( subProperties.hasNext() ) { final Property subProperty = (Property) subProperties.next(); builder.addPair( buildGenerationStrategyPair( sessionFactory, subProperty ) ); @@ -616,7 +616,7 @@ public class EntityMetamodel implements Serializable { // start building the aggregate values int propertyIndex = -1; int columnIndex = 0; - Iterator subProperties = composite.getPropertyIterator(); + Iterator subProperties = composite.getPropertyIterator(); while ( subProperties.hasNext() ) { propertyIndex++; final Property subProperty = (Property) subProperties.next(); @@ -672,16 +672,16 @@ public class EntityMetamodel implements Serializable { } @Override - public ValueGenerator getValueGenerator() { + public ValueGenerator getValueGenerator() { return null; } } private static class FullInMemoryValueGenerationStrategy implements InMemoryValueGenerationStrategy { private final GenerationTiming timing; - private final ValueGenerator generator; + private final ValueGenerator generator; - private FullInMemoryValueGenerationStrategy(GenerationTiming timing, ValueGenerator generator) { + private FullInMemoryValueGenerationStrategy(GenerationTiming timing, ValueGenerator generator) { this.timing = timing; this.generator = generator; } @@ -699,7 +699,7 @@ public class EntityMetamodel implements Serializable { } @Override - public ValueGenerator getValueGenerator() { + public ValueGenerator getValueGenerator() { return generator; } } @@ -760,7 +760,7 @@ public class EntityMetamodel implements Serializable { private void mapPropertyToIndex(Property prop, int i) { propertyIndexes.put( prop.getName(), i ); if ( prop.getValue() instanceof Component ) { - Iterator iter = ( (Component) prop.getValue() ).getPropertyIterator(); + Iterator iter = ( (Component) prop.getValue() ).getPropertyIterator(); while ( iter.hasNext() ) { Property subprop = (Property) iter.next(); propertyIndexes.put( @@ -962,11 +962,11 @@ public class EntityMetamodel implements Serializable { /** * Return the entity-name mapped to the given class within our inheritance hierarchy, if any. * - * @param inheritenceClass The class for which to resolve the entity-name. + * @param inheritanceClass The class for which to resolve the entity-name. * @return The mapped entity-name, or null if no such mapping was found. */ - public String findEntityNameByEntityClass(Class inheritenceClass) { - return entityNameByInheritenceClassMap.get( inheritenceClass ); + public String findEntityNameByEntityClass(Class inheritanceClass) { + return entityNameByInheritenceClassMap.get( inheritanceClass ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java index 8da48f02e3..9f0b1ab601 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java @@ -22,9 +22,9 @@ import org.hibernate.metamodel.RepresentationMode; * @author Steve Ebersole */ public class EntityTuplizerFactory implements Serializable { - public static final Class[] ENTITY_TUP_CTOR_SIG = new Class[] { EntityMetamodel.class, PersistentClass.class }; + public static final Class[] ENTITY_TUP_CTOR_SIG = new Class[] { EntityMetamodel.class, PersistentClass.class }; - private Map> defaultImplClassByMode = buildBaseMapping(); + private final Map> defaultImplClassByMode = buildBaseMapping(); /** * Method allowing registration of the tuplizer class to use as default for a particular entity-mode. @@ -53,7 +53,7 @@ public class EntityTuplizerFactory implements Serializable { * @throws HibernateException If class name cannot be resolved to a class reference, or if the * {@link Constructor#newInstance} call fails. */ - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public EntityTuplizer constructTuplizer( String tuplizerClassName, EntityMetamodel metamodel, @@ -92,18 +92,18 @@ public class EntityTuplizerFactory implements Serializable { } } - private boolean isEntityTuplizerImplementor(Class tuplizerClass) { + private boolean isEntityTuplizerImplementor(Class tuplizerClass) { return ReflectHelper.implementsInterface( tuplizerClass, EntityTuplizer.class ); } - private boolean hasProperConstructor(Class tuplizerClass, Class[] constructorArgs) { + private boolean hasProperConstructor(Class tuplizerClass, Class[] constructorArgs) { return getProperConstructor( tuplizerClass, constructorArgs ) != null && ! ReflectHelper.isAbstractClass( tuplizerClass ); } private Constructor getProperConstructor( Class clazz, - Class[] constructorArgs) { + Class[] constructorArgs) { Constructor constructor = null; try { constructor = clazz.getDeclaredConstructor( constructorArgs ); diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java index e14c9d23fe..e361f3260b 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java @@ -16,7 +16,6 @@ import org.hibernate.bytecode.spi.BytecodeProvider; import org.hibernate.bytecode.spi.ProxyFactoryFactory; import org.hibernate.bytecode.spi.ReflectionOptimizer; import org.hibernate.cfg.Environment; -import org.hibernate.classic.Lifecycle; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.internal.CoreLogging; @@ -27,7 +26,6 @@ import org.hibernate.property.access.spi.Getter; import org.hibernate.property.access.spi.Setter; import org.hibernate.proxy.ProxyFactory; import org.hibernate.proxy.pojo.ProxyFactoryHelper; -import org.hibernate.tuple.Instantiator; import org.hibernate.type.CompositeType; /** @@ -39,20 +37,18 @@ import org.hibernate.type.CompositeType; public class PojoEntityTuplizer extends AbstractEntityTuplizer { private static final CoreMessageLogger LOG = CoreLogging.messageLogger( PojoEntityTuplizer.class ); - private final Class mappedClass; - private final Class proxyInterface; - private final boolean lifecycleImplementor; + private final Class mappedClass; + private final Class proxyInterface; private final ReflectionOptimizer optimizer; public PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) { super( entityMetamodel, mappedEntity ); this.mappedClass = mappedEntity.getMappedClass(); this.proxyInterface = mappedEntity.getProxyInterface(); - this.lifecycleImplementor = Lifecycle.class.isAssignableFrom( mappedClass ); String[] getterNames = new String[propertySpan]; String[] setterNames = new String[propertySpan]; - Class[] propTypes = new Class[propertySpan]; + Class[] propTypes = new Class[propertySpan]; for ( int i = 0; i < propertySpan; i++ ) { getterNames[i] = getters[i].getMethodName(); setterNames[i] = setters[i].getMethodName(); @@ -78,10 +74,10 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer { // determine the id getter and setter methods from the proxy interface (if any) // determine all interfaces needed by the resulting proxy final String entityName = getEntityName(); - final Class mappedClass = persistentClass.getMappedClass(); - final Class proxyInterface = persistentClass.getProxyInterface(); + final Class mappedClass = persistentClass.getMappedClass(); + final Class proxyInterface = persistentClass.getProxyInterface(); - final Set proxyInterfaces = ProxyFactoryHelper.extractProxyInterfaces( persistentClass, entityName ); + final Set> proxyInterfaces = ProxyFactoryHelper.extractProxyInterfaces( persistentClass, entityName ); Method proxyGetIdentifierMethod = ProxyFactoryHelper.extractProxyGetIdentifierMethod( idGetter, proxyInterface ); Method proxySetIdentifierMethod = ProxyFactoryHelper.extractProxySetIdentifierMethod( idSetter, proxyInterface ); @@ -135,7 +131,7 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer { } @Override - public Class getMappedClass() { + public Class getMappedClass() { return mappedClass; } @@ -157,7 +153,7 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer { return getEntityName(); } - final Class concreteEntityClass = entityInstance.getClass(); + final Class concreteEntityClass = entityInstance.getClass(); if ( concreteEntityClass == getMappedClass() ) { return getEntityName(); }