diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java index 196bd256fa..d53887e479 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java @@ -208,5 +208,14 @@ public interface DeprecationLogger extends BasicLogger { ) void logDeprecatedBytecodeEnhancement(); + @LogMessage(level = WARN) + @Message( + id = 90000020, + value = "You are using the deprecated legacy bytecode enhancement Ant-task. This task is left in place for a short-time to " + + "aid migrations to 5.1 and the new (vastly improved) bytecode enhancement support. This task (%s) now delegates to the" + + "new Ant-task (%s) leveraging that new bytecode enhancement. You should update your build to use the new task explicitly." + ) + void logDeprecatedInstrumentTask(Class taskClass, Class newTaskClass); + } diff --git a/hibernate-core/src/main/java/org/hibernate/tool/instrument/javassist/InstrumentTask.java b/hibernate-core/src/main/java/org/hibernate/tool/instrument/javassist/InstrumentTask.java index 2f082bfbb8..f617a39700 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/instrument/javassist/InstrumentTask.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/instrument/javassist/InstrumentTask.java @@ -6,49 +6,29 @@ */ package org.hibernate.tool.instrument.javassist; -import org.hibernate.bytecode.buildtime.internal.JavassistInstrumenter; -import org.hibernate.bytecode.buildtime.spi.Instrumenter; -import org.hibernate.bytecode.buildtime.spi.Logger; -import org.hibernate.tool.instrument.BasicInstrumentationTask; +import org.hibernate.internal.log.DeprecationLogger; +import org.hibernate.tool.enhance.EnhancementTask; /** - * An Ant task for instrumenting persistent classes in order to enable - * field-level interception using Javassist. - *
- * In order to use this task, typically you would define a a taskdef - * similiar to:- *- * where lib.class.path is an ANT path reference containing all the - * required Hibernate and Javassist libraries. - * - * And then use it like:- * - *- *
- *- * where the nested ANT fileset includes the class you would like to have - * instrumented. - * - * Optionally you can chose to enable "Extended Instrumentation" if desired - * by specifying the extended attriubute on the task:- * - *- * - *- * ... - *
- *- * See the Hibernate manual regarding this option. + * This is the legacy Ant-task Hibernate provided historically to + * perform its old-school bytecode instrumentation. That has been replaced wholesale + * with a new approach to bytecode manipulation offering 3 build-time variations for Ant, + * Maven and Gradle. * * @author Muga Nishizawa * @author Steve Ebersole + * + * @deprecated This is the legacy Ant-task Hibernate provided historically to + * perform its old-school bytecode instrumentation. That has been replaced wholesale + * with a new approach to bytecode manipulation offering 3 build-time variations for Ant, + * Maven and Gradle. + * + * @see EnhancementTask */ -public class InstrumentTask extends BasicInstrumentationTask { - @Override - protected Instrumenter buildInstrumenter(Logger logger, Instrumenter.Options options) { - return new JavassistInstrumenter( logger, options ); +@Deprecated +@SuppressWarnings("unused") +public class InstrumentTask extends EnhancementTask { + public InstrumentTask() { + DeprecationLogger.DEPRECATION_LOGGER.logDeprecatedInstrumentTask( InstrumentTask.class, EnhancementTask.class ); } -} +} \ No newline at end of file- * ... - * - *