HHH-14477 Log warnings about the use of Javassist as BytecodeProvider being deprecated

This commit is contained in:
Sanne Grinovero 2021-03-03 10:44:29 +00:00
parent 36ec6cfc90
commit 0f78d9cfec
4 changed files with 11 additions and 1 deletions

View File

@ -434,7 +434,7 @@ Enable lazy loading feature in runtime bytecode enhancement. This way, even basi
Enable association management feature in runtime bytecode enhancement which automatically synchronizes a bidirectional association when only one side is changed. Enable association management feature in runtime bytecode enhancement which automatically synchronizes a bidirectional association when only one side is changed.
`*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` and `javassist` are valid values. The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` and `javassist` are valid values; `bytebuddy` is the default and recommended choice; `javassist` will be removed soon.
`*hibernate.bytecode.use_reflection_optimizer*` (e.g. `true` or `false` (default value)):: `*hibernate.bytecode.use_reflection_optimizer*` (e.g. `true` or `false` (default value))::
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. 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.

View File

@ -21,9 +21,13 @@ import org.jboss.logging.Logger;
/** /**
* Bytecode provider implementation for Javassist. * Bytecode provider implementation for Javassist.
* @deprecated The Javassist based enhancer will be removed soon,
* please use the one based on ByteBuddy (which is the default since
* version 5.3 of Hibernate ORM)
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Deprecated
public class BytecodeProviderImpl implements BytecodeProvider { public class BytecodeProviderImpl implements BytecodeProvider {
private static final CoreMessageLogger LOG = Logger.getMessageLogger( private static final CoreMessageLogger LOG = Logger.getMessageLogger(
CoreMessageLogger.class, CoreMessageLogger.class,

View File

@ -346,6 +346,7 @@ public final class Environment implements AvailableSettings {
} }
if ( BYTECODE_PROVIDER_NAME_JAVASSIST.equals( providerName ) ) { if ( BYTECODE_PROVIDER_NAME_JAVASSIST.equals( providerName ) ) {
LOG.warnUsingJavassistBytecodeProviderIsDeprecated();
return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl(); return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl();
} }

View File

@ -1860,4 +1860,9 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Detaching an uninitialized collection with enabled filters from a session: %s", id = 506) @Message(value = "Detaching an uninitialized collection with enabled filters from a session: %s", id = 506)
void enabledFiltersWhenDetachFromSession(String collectionInfoString); void enabledFiltersWhenDetachFromSession(String collectionInfoString);
@LogMessage(level = WARN)
@Message(value = "The Javassist based BytecodeProvider is deprecated. Please switch to using the ByteBuddy based BytecodeProvider, " +
"which is the default since Hibernate ORM 5.3. The Javassist one will be removed soon.", id = 507)
void warnUsingJavassistBytecodeProviderIsDeprecated();
} }