HHH-3832 Upgrade to cglib-2.2 (asm 3.1)

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16253 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Scott Marlow 2009-04-02 16:29:06 +00:00
parent 5cbb8cc77f
commit bffe7ec6e9
20 changed files with 93 additions and 61 deletions

View File

@ -66,6 +66,12 @@
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
@ -90,6 +96,12 @@
<artifactId>javassist</artifactId>
<version>3.4.GA</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -39,6 +39,12 @@
<version>1.8.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>

View File

@ -112,13 +112,13 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_3</version>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
<version>1.5.3</version>
<artifactId>asm</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -42,6 +42,12 @@
<scope>test</scope>
</dependency>
<!-- this is optional on core :( and needed for testing -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>

View File

@ -63,9 +63,9 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-cglib-repack</artifactId>
<version>2.1_3</version>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
<optional>true</optional>
</dependency>
</dependencies>

View File

@ -30,9 +30,9 @@ import org.hibernate.bytecode.util.ClassDescriptor;
import org.hibernate.bytecode.util.BasicClassFilter;
import org.hibernate.bytecode.ClassTransformer;
import org.hibernate.bytecode.cglib.BytecodeProviderImpl;
import org.hibernate.repackage.cglib.asm.ClassReader;
import org.hibernate.repackage.cglib.core.ClassNameReader;
import org.hibernate.repackage.cglib.transform.impl.InterceptFieldEnabled;
import org.objectweb.asm.ClassReader;
import net.sf.cglib.core.ClassNameReader;
import net.sf.cglib.transform.impl.InterceptFieldEnabled;
/**
* Strategy for performing build-time instrumentation of persistent classes in order to enable

View File

@ -26,8 +26,8 @@ package org.hibernate.bytecode.cglib;
import org.hibernate.bytecode.ReflectionOptimizer;
import org.hibernate.PropertyAccessException;
import org.hibernate.repackage.cglib.beans.BulkBean;
import org.hibernate.repackage.cglib.beans.BulkBeanException;
import net.sf.cglib.beans.BulkBean;
import net.sf.cglib.beans.BulkBeanException;
import java.io.Serializable;
import java.io.ObjectOutputStream;

View File

@ -26,9 +26,9 @@ package org.hibernate.bytecode.cglib;
import java.lang.reflect.Modifier;
import org.hibernate.repackage.cglib.beans.BulkBean;
import org.hibernate.repackage.cglib.beans.BulkBeanException;
import org.hibernate.repackage.cglib.reflect.FastClass;
import net.sf.cglib.beans.BulkBean;
import net.sf.cglib.beans.BulkBeanException;
import net.sf.cglib.reflect.FastClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.bytecode.BytecodeProvider;

View File

@ -29,25 +29,23 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import org.hibernate.repackage.cglib.transform.ClassTransformer;
import org.hibernate.repackage.cglib.transform.TransformingClassGenerator;
import org.hibernate.repackage.cglib.transform.ClassReaderGenerator;
import org.hibernate.repackage.cglib.transform.impl.InterceptFieldEnabled;
import org.hibernate.repackage.cglib.transform.impl.InterceptFieldFilter;
import org.hibernate.repackage.cglib.transform.impl.InterceptFieldTransformer;
import org.hibernate.repackage.cglib.core.ClassNameReader;
import org.hibernate.repackage.cglib.core.DebuggingClassWriter;
import net.sf.cglib.transform.ClassTransformer;
import net.sf.cglib.transform.TransformingClassGenerator;
import net.sf.cglib.transform.ClassReaderGenerator;
import net.sf.cglib.transform.impl.InterceptFieldEnabled;
import net.sf.cglib.transform.impl.InterceptFieldFilter;
import net.sf.cglib.transform.impl.InterceptFieldTransformer;
import net.sf.cglib.core.ClassNameReader;
import net.sf.cglib.core.DebuggingClassWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.bytecode.AbstractClassTransformerImpl;
import org.hibernate.bytecode.util.FieldFilter;
import org.hibernate.bytecode.util.ClassFilter;
import org.hibernate.HibernateException;
import org.hibernate.repackage.cglib.asm.Attribute;
import org.hibernate.repackage.cglib.asm.Type;
import org.hibernate.repackage.cglib.asm.ClassReader;
import org.hibernate.repackage.cglib.asm.ClassWriter;
import org.hibernate.repackage.cglib.asm.attrs.Attributes;
import org.objectweb.asm.Type;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
/**
* Enhance the classes allowing them to implements InterceptFieldEnabled
@ -79,7 +77,7 @@ public class CglibClassTransformer extends AbstractClassTransformerImpl {
}
String[] names = ClassNameReader.getClassInfo( reader );
ClassWriter w = new DebuggingClassWriter( true );
ClassWriter w = new DebuggingClassWriter( ClassWriter.COMPUTE_MAXS );
ClassTransformer t = getClassTransformer( names );
if ( t != null ) {
if ( log.isDebugEnabled() ) {
@ -90,7 +88,7 @@ public class CglibClassTransformer extends AbstractClassTransformerImpl {
try {
reader = new ClassReader( new ByteArrayInputStream( classfileBuffer ) );
new TransformingClassGenerator(
new ClassReaderGenerator( reader, attributes(), skipDebug() ), t
new ClassReaderGenerator( reader, skipDebug() ), t
).generateClass( w );
out = new ByteArrayOutputStream();
out.write( w.toByteArray() );
@ -106,13 +104,8 @@ public class CglibClassTransformer extends AbstractClassTransformerImpl {
return classfileBuffer;
}
private Attribute[] attributes() {
return Attributes.getDefaultAttributes();
}
private boolean skipDebug() {
return false;
private int skipDebug() {
return ClassReader.SKIP_DEBUG;
}
private ClassTransformer getClassTransformer(final String[] classInfo) {

View File

@ -25,7 +25,7 @@
package org.hibernate.bytecode.cglib;
import org.hibernate.bytecode.ReflectionOptimizer;
import org.hibernate.repackage.cglib.reflect.FastClass;
import net.sf.cglib.reflect.FastClass;
import org.hibernate.InstantiationException;
import java.io.Serializable;

View File

@ -30,13 +30,13 @@ import org.hibernate.proxy.ProxyFactory;
import org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory;
import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
import org.hibernate.repackage.cglib.proxy.Enhancer;
import org.hibernate.repackage.cglib.proxy.CallbackFilter;
import org.hibernate.repackage.cglib.proxy.MethodInterceptor;
import org.hibernate.repackage.cglib.proxy.MethodProxy;
import org.hibernate.repackage.cglib.proxy.NoOp;
import org.hibernate.repackage.cglib.proxy.Callback;
import org.hibernate.repackage.cglib.proxy.Factory;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.CallbackFilter;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import net.sf.cglib.proxy.NoOp;
import net.sf.cglib.proxy.Callback;
import net.sf.cglib.proxy.Factory;
import java.lang.reflect.Method;
import java.util.HashMap;

View File

@ -50,7 +50,7 @@ public class FieldInterceptionHelper {
public static boolean isInstrumented(Class entityClass) {
Class[] definedInterfaces = entityClass.getInterfaces();
for ( int i = 0; i < definedInterfaces.length; i++ ) {
if ( "org.hibernate.repackage.cglib.transform.impl.InterceptFieldEnabled".equals( definedInterfaces[i].getName() )
if ( "net.sf.cglib.transform.impl.InterceptFieldEnabled".equals( definedInterfaces[i].getName() )
|| "org.hibernate.bytecode.javassist.FieldHandled".equals( definedInterfaces[i].getName() ) ) {
return true;
}
@ -68,7 +68,7 @@ public class FieldInterceptionHelper {
}
Class[] definedInterfaces = entity.getClass().getInterfaces();
for ( int i = 0; i < definedInterfaces.length; i++ ) {
if ( "org.hibernate.repackage.cglib.transform.impl.InterceptFieldEnabled".equals( definedInterfaces[i].getName() ) ) {
if ( "net.sf.cglib.transform.impl.InterceptFieldEnabled".equals( definedInterfaces[i].getName() ) ) {
// we have a CGLIB enhanced entity
return CGLIBHelper.extractFieldInterceptor( entity );
}
@ -88,7 +88,7 @@ public class FieldInterceptionHelper {
if ( entity != null ) {
Class[] definedInterfaces = entity.getClass().getInterfaces();
for ( int i = 0; i < definedInterfaces.length; i++ ) {
if ( "org.hibernate.repackage.cglib.transform.impl.InterceptFieldEnabled".equals( definedInterfaces[i].getName() ) ) {
if ( "net.sf.cglib.transform.impl.InterceptFieldEnabled".equals( definedInterfaces[i].getName() ) ) {
// we have a CGLIB enhanced entity
return CGLIBHelper.injectFieldInterceptor( entity, entityName, uninitializedFieldNames, session );
}

View File

@ -26,7 +26,7 @@ package org.hibernate.intercept.cglib;
import org.hibernate.intercept.FieldInterceptor;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.repackage.cglib.transform.impl.InterceptFieldEnabled;
import net.sf.cglib.transform.impl.InterceptFieldEnabled;
import java.util.Set;

View File

@ -27,7 +27,7 @@ package org.hibernate.intercept.cglib;
import java.io.Serializable;
import java.util.Set;
import org.hibernate.repackage.cglib.transform.impl.InterceptFieldCallback;
import net.sf.cglib.transform.impl.InterceptFieldCallback;
import org.hibernate.intercept.AbstractFieldInterceptor;
import org.hibernate.engine.SessionImplementor;

View File

@ -28,11 +28,11 @@ import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.hibernate.repackage.cglib.proxy.Callback;
import org.hibernate.repackage.cglib.proxy.CallbackFilter;
import org.hibernate.repackage.cglib.proxy.Enhancer;
import org.hibernate.repackage.cglib.proxy.InvocationHandler;
import org.hibernate.repackage.cglib.proxy.NoOp;
import net.sf.cglib.proxy.Callback;
import net.sf.cglib.proxy.CallbackFilter;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.InvocationHandler;
import net.sf.cglib.proxy.NoOp;
import org.hibernate.HibernateException;
import org.hibernate.LazyInitializationException;

View File

@ -123,13 +123,13 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_3</version>
<version>2.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
<version>1.5.3</version>
<artifactId>asm</artifactId>
<version>3.1</version>
<optional>true</optional>
</dependency>
</dependencies>

View File

@ -139,7 +139,7 @@
<dependencySet>
<outputDirectory>lib/bytecode/cglib</outputDirectory>
<includes>
<include>org.hibernate:hibernate-cglib-repack</include>
<include>cglib:cglib</include>
</includes>
</dependencySet>

View File

@ -61,6 +61,10 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
@ -84,6 +88,11 @@
<artifactId>hibernate-annotations</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>

View File

@ -107,6 +107,12 @@
<version>1.0.79</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>

View File

@ -34,9 +34,9 @@
<version>3.4.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-cglib-repack</artifactId>
<version>2.1_3</version>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<!-- optional dom4j dependency; needed here for dom4j (de)serialization -->
<dependency>