HHH-16073 Remove deprecated cfg property 'hibernate.bytecode.use_reflection_optimizer'
This commit is contained in:
parent
d876efb860
commit
4e16d00a26
|
@ -474,9 +474,6 @@ Enable association management feature in runtime bytecode enhancement which auto
|
||||||
`*hibernate.bytecode.provider*` (e.g. `bytebuddy` (default value))::
|
`*hibernate.bytecode.provider*` (e.g. `bytebuddy` (default value))::
|
||||||
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` is a valid value, as older deprecated options have been removed.
|
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` is a valid value, as older deprecated options have been removed.
|
||||||
|
|
||||||
`*hibernate.bytecode.use_reflection_optimizer*` (e.g. `true` (default value) or `false`)::
|
|
||||||
Should we use reflection optimization? The reflection optimizer implements the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/ReflectionOptimizer.html[`ReflectionOptimizer`] interface and improves entity instantiation and property getter/setter calls. This setting is deprecated for removal without a replacement.
|
|
||||||
|
|
||||||
[[configurations-query]]
|
[[configurations-query]]
|
||||||
=== Query settings
|
=== Query settings
|
||||||
|
|
||||||
|
|
|
@ -345,11 +345,6 @@ hibernate.max_fetch_depth 1
|
||||||
#hibernate.use_identifier_rollback true
|
#hibernate.use_identifier_rollback true
|
||||||
|
|
||||||
|
|
||||||
## disable bytecode reflection optimizer (enabled by default)
|
|
||||||
|
|
||||||
#hibernate.bytecode.use_reflection_optimizer false
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
### JDBC Settings ###
|
### JDBC Settings ###
|
||||||
|
|
|
@ -314,11 +314,6 @@ hibernate.default_batch_fetch_size 8
|
||||||
#hibernate.use_identifier_rollback true
|
#hibernate.use_identifier_rollback true
|
||||||
|
|
||||||
|
|
||||||
## disable bytecode reflection optimizer (enabled by default)
|
|
||||||
|
|
||||||
#hibernate.bytecode.use_reflection_optimizer false
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
### JDBC Settings ###
|
### JDBC Settings ###
|
||||||
|
|
|
@ -24,8 +24,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
* as an optimisation when not needing any byte code optimisation applied,
|
* as an optimisation when not needing any byte code optimisation applied,
|
||||||
* for example when the entities have been enhanced at compile time.
|
* for example when the entities have been enhanced at compile time.
|
||||||
* Choosing this BytecodeProvider allows to exclude the bytecode enhancement
|
* Choosing this BytecodeProvider allows to exclude the bytecode enhancement
|
||||||
* libraries from the runtime classpath, but is not compatible
|
* libraries from the runtime classpath.
|
||||||
* with the option AvailableSettings#USE_REFLECTION_OPTIMIZER .
|
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
|
@ -42,12 +41,12 @@ public final class BytecodeProviderImpl implements BytecodeProvider {
|
||||||
String[] getterNames,
|
String[] getterNames,
|
||||||
String[] setterNames,
|
String[] setterNames,
|
||||||
Class[] types) {
|
Class[] types) {
|
||||||
throw new HibernateException( "Using the ReflectionOptimizer is not possible when the configured BytecodeProvider is 'none'. Disable " + AvailableSettings.USE_REFLECTION_OPTIMIZER + " or use a different BytecodeProvider");
|
throw new HibernateException( "Using the ReflectionOptimizer is not possible when the configured BytecodeProvider is 'none'. Use a different BytecodeProvider" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable ReflectionOptimizer getReflectionOptimizer(Class<?> clazz, Map<String, PropertyAccess> propertyAccessMap) {
|
public @Nullable ReflectionOptimizer getReflectionOptimizer(Class<?> clazz, Map<String, PropertyAccess> propertyAccessMap) {
|
||||||
throw new HibernateException( "Using the ReflectionOptimizer is not possible when the configured BytecodeProvider is 'none'. Disable " + AvailableSettings.USE_REFLECTION_OPTIMIZER + " or use a different BytecodeProvider");
|
throw new HibernateException( "Using the ReflectionOptimizer is not possible when the configured BytecodeProvider is 'none'. Use a different BytecodeProvider" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1198,16 +1198,6 @@ public interface AvailableSettings {
|
||||||
*/
|
*/
|
||||||
String USE_IDENTIFIER_ROLLBACK = "hibernate.use_identifier_rollback";
|
String USE_IDENTIFIER_ROLLBACK = "hibernate.use_identifier_rollback";
|
||||||
|
|
||||||
/**
|
|
||||||
* When enabled, specifies that property access should be optimized via the use
|
|
||||||
* of generated bytecode.
|
|
||||||
*
|
|
||||||
* @deprecated Will be removed without replacement. See HHH-15631
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
|
||||||
String USE_REFLECTION_OPTIMIZER = "hibernate.bytecode.use_reflection_optimizer";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When enabled, specifies that Hibernate should attempt to map parameter names
|
* When enabled, specifies that Hibernate should attempt to map parameter names
|
||||||
* given in a {@link org.hibernate.procedure.ProcedureCall} or
|
* given in a {@link org.hibernate.procedure.ProcedureCall} or
|
||||||
|
|
|
@ -21,9 +21,6 @@ import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to configuration properties passed in {@link Properties} objects.
|
* Provides access to configuration properties passed in {@link Properties} objects.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -36,9 +33,6 @@ import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
|
||||||
* always determined by the {@code Environment} properties in {@link #getProperties()}.
|
* always determined by the {@code Environment} properties in {@link #getProperties()}.
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p>
|
* <p>
|
||||||
* The only system-level property is {@value #USE_REFLECTION_OPTIMIZER},
|
|
||||||
* and it's deprecated.
|
|
||||||
* <p>
|
|
||||||
* {@code Environment} properties are populated by calling {@link System#getProperties()}
|
* {@code Environment} properties are populated by calling {@link System#getProperties()}
|
||||||
* and then from a resource named {@code /hibernate.properties}, if it exists. System
|
* and then from a resource named {@code /hibernate.properties}, if it exists. System
|
||||||
* properties override properties specified in {@code hibernate.properties}.
|
* properties override properties specified in {@code hibernate.properties}.
|
||||||
|
@ -142,15 +136,12 @@ import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
|
||||||
public final class Environment implements AvailableSettings {
|
public final class Environment implements AvailableSettings {
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, Environment.class.getName());
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, Environment.class.getName());
|
||||||
|
|
||||||
private static final boolean ENABLE_REFLECTION_OPTIMIZER;
|
|
||||||
|
|
||||||
private static final Properties GLOBAL_PROPERTIES;
|
private static final Properties GLOBAL_PROPERTIES;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Version.logVersion();
|
Version.logVersion();
|
||||||
|
|
||||||
GLOBAL_PROPERTIES = new Properties();
|
GLOBAL_PROPERTIES = new Properties();
|
||||||
GLOBAL_PROPERTIES.setProperty( USE_REFLECTION_OPTIMIZER, Boolean.TRUE.toString() );
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" );
|
InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" );
|
||||||
|
@ -185,33 +176,6 @@ public final class Environment implements AvailableSettings {
|
||||||
catch (SecurityException se) {
|
catch (SecurityException se) {
|
||||||
LOG.unableToCopySystemProperties();
|
LOG.unableToCopySystemProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
ENABLE_REFLECTION_OPTIMIZER = ConfigurationHelper.getBoolean(USE_REFLECTION_OPTIMIZER, GLOBAL_PROPERTIES);
|
|
||||||
if ( ENABLE_REFLECTION_OPTIMIZER ) {
|
|
||||||
LOG.usingReflectionOptimizer();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
DEPRECATION_LOGGER.deprecatedSettingForRemoval( USE_REFLECTION_OPTIMIZER, "true" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should we use reflection optimization?
|
|
||||||
*
|
|
||||||
* @return True if reflection optimization should be used; false otherwise.
|
|
||||||
*
|
|
||||||
* @see #USE_REFLECTION_OPTIMIZER
|
|
||||||
* @see BytecodeProvider#getReflectionOptimizer
|
|
||||||
*
|
|
||||||
* @deprecated Deprecated to indicate that the method will be moved to
|
|
||||||
* {@link org.hibernate.boot.spi.SessionFactoryOptions} /
|
|
||||||
* {@link org.hibernate.boot.SessionFactoryBuilder}.
|
|
||||||
* See <a href="https://hibernate.atlassian.net/browse/HHH-12194">HHH-12194</a> and
|
|
||||||
* <a href="https://hibernate.atlassian.net/browse/HHH-12193">HHH-12193</a> for details
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static boolean useReflectionOptimizer() {
|
|
||||||
return ENABLE_REFLECTION_OPTIMIZER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1380,10 +1380,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
||||||
@Message(value = "Don't use old DTDs, read the Hibernate 3.x Migration Guide", id = 404)
|
@Message(value = "Don't use old DTDs, read the Hibernate 3.x Migration Guide", id = 404)
|
||||||
void usingOldDtd();
|
void usingOldDtd();
|
||||||
|
|
||||||
@LogMessage(level = INFO)
|
|
||||||
@Message(value = "Using bytecode reflection optimizer", id = 406)
|
|
||||||
void usingReflectionOptimizer();
|
|
||||||
|
|
||||||
// @LogMessage(level = INFO)
|
// @LogMessage(level = INFO)
|
||||||
// @Message(value = "Using java.io streams to persist binary types", id = 407)
|
// @Message(value = "Using java.io streams to persist binary types", id = 407)
|
||||||
// void usingStreams();
|
// void usingStreams();
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.hibernate.boot.registry.selector.spi.StrategySelector;
|
||||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||||
import org.hibernate.bytecode.spi.ProxyFactoryFactory;
|
import org.hibernate.bytecode.spi.ProxyFactoryFactory;
|
||||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.mapping.Backref;
|
import org.hibernate.mapping.Backref;
|
||||||
|
@ -171,10 +170,6 @@ public class EmbeddableRepresentationStrategyPojo extends AbstractEmbeddableRepr
|
||||||
Component bootDescriptor,
|
Component bootDescriptor,
|
||||||
RuntimeModelCreationContext creationContext) {
|
RuntimeModelCreationContext creationContext) {
|
||||||
|
|
||||||
if ( !Environment.useReflectionOptimizer() ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( hasCustomAccessors() || bootDescriptor.getCustomInstantiator() != null || bootDescriptor.getInstantiator() != null ) {
|
if ( hasCustomAccessors() || bootDescriptor.getCustomInstantiator() != null || bootDescriptor.getInstantiator() != null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.hibernate.boot.registry.selector.spi.StrategySelector;
|
||||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||||
import org.hibernate.bytecode.spi.ReflectionOptimizer.InstantiationOptimizer;
|
import org.hibernate.bytecode.spi.ReflectionOptimizer.InstantiationOptimizer;
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
import org.hibernate.classic.Lifecycle;
|
import org.hibernate.classic.Lifecycle;
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
@ -287,9 +286,6 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReflectionOptimizer resolveReflectionOptimizer(BytecodeProvider bytecodeProvider) {
|
private ReflectionOptimizer resolveReflectionOptimizer(BytecodeProvider bytecodeProvider) {
|
||||||
if ( ! Environment.useReflectionOptimizer() ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return bytecodeProvider.getReflectionOptimizer(
|
return bytecodeProvider.getReflectionOptimizer(
|
||||||
mappedJtd.getJavaTypeClass(),
|
mappedJtd.getJavaTypeClass(),
|
||||||
propertyAccessMap
|
propertyAccessMap
|
||||||
|
|
Loading…
Reference in New Issue