HHH-16073 Remove deprecated cfg property 'hibernate.bytecode.use_reflection_optimizer'

This commit is contained in:
Sanne Grinovero 2023-08-16 22:38:29 +02:00 committed by Sanne Grinovero
parent d876efb860
commit 4e16d00a26
9 changed files with 3 additions and 76 deletions

View File

@ -474,9 +474,6 @@ Enable association management feature in runtime bytecode enhancement which auto
`*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.
`*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]]
=== Query settings

View File

@ -345,11 +345,6 @@ hibernate.max_fetch_depth 1
#hibernate.use_identifier_rollback true
## disable bytecode reflection optimizer (enabled by default)
#hibernate.bytecode.use_reflection_optimizer false
#####################
### JDBC Settings ###

View File

@ -314,11 +314,6 @@ hibernate.default_batch_fetch_size 8
#hibernate.use_identifier_rollback true
## disable bytecode reflection optimizer (enabled by default)
#hibernate.bytecode.use_reflection_optimizer false
#####################
### JDBC Settings ###

View File

@ -24,8 +24,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* as an optimisation when not needing any byte code optimisation applied,
* for example when the entities have been enhanced at compile time.
* Choosing this BytecodeProvider allows to exclude the bytecode enhancement
* libraries from the runtime classpath, but is not compatible
* with the option AvailableSettings#USE_REFLECTION_OPTIMIZER .
* libraries from the runtime classpath.
*
* @since 5.4
*/
@ -42,12 +41,12 @@ public final class BytecodeProviderImpl implements BytecodeProvider {
String[] getterNames,
String[] setterNames,
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
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

View File

@ -1198,16 +1198,6 @@ public interface AvailableSettings {
*/
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
* given in a {@link org.hibernate.procedure.ProcedureCall} or

View File

@ -21,9 +21,6 @@ import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.logging.Logger;
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
/**
* Provides access to configuration properties passed in {@link Properties} objects.
* <p>
@ -36,9 +33,6 @@ import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
* always determined by the {@code Environment} properties in {@link #getProperties()}.
* </ul>
* <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()}
* and then from a resource named {@code /hibernate.properties}, if it exists. System
* 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 {
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;
static {
Version.logVersion();
GLOBAL_PROPERTIES = new Properties();
GLOBAL_PROPERTIES.setProperty( USE_REFLECTION_OPTIMIZER, Boolean.TRUE.toString() );
try {
InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" );
@ -185,33 +176,6 @@ public final class Environment implements AvailableSettings {
catch (SecurityException se) {
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;
}
/**

View File

@ -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)
void usingOldDtd();
@LogMessage(level = INFO)
@Message(value = "Using bytecode reflection optimizer", id = 406)
void usingReflectionOptimizer();
// @LogMessage(level = INFO)
// @Message(value = "Using java.io streams to persist binary types", id = 407)
// void usingStreams();

View File

@ -16,7 +16,6 @@ import org.hibernate.boot.registry.selector.spi.StrategySelector;
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.internal.util.ReflectHelper;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.mapping.Backref;
@ -171,10 +170,6 @@ public class EmbeddableRepresentationStrategyPojo extends AbstractEmbeddableRepr
Component bootDescriptor,
RuntimeModelCreationContext creationContext) {
if ( !Environment.useReflectionOptimizer() ) {
return null;
}
if ( hasCustomAccessors() || bootDescriptor.getCustomInstantiator() != null || bootDescriptor.getInstantiator() != null ) {
return null;
}

View File

@ -18,7 +18,6 @@ import org.hibernate.boot.registry.selector.spi.StrategySelector;
import org.hibernate.bytecode.spi.BytecodeProvider;
import org.hibernate.bytecode.spi.ReflectionOptimizer;
import org.hibernate.bytecode.spi.ReflectionOptimizer.InstantiationOptimizer;
import org.hibernate.cfg.Environment;
import org.hibernate.classic.Lifecycle;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
@ -287,9 +286,6 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
}
private ReflectionOptimizer resolveReflectionOptimizer(BytecodeProvider bytecodeProvider) {
if ( ! Environment.useReflectionOptimizer() ) {
return null;
}
return bytecodeProvider.getReflectionOptimizer(
mappedJtd.getJavaTypeClass(),
propertyAccessMap