From 6d801232f3413c211305945c7785a4ce94d62eee Mon Sep 17 00:00:00 2001 From: yangtu222 Date: Fri, 22 Sep 2017 14:41:26 +0800 Subject: [PATCH] little improve --- .../com/tuyang/beanutils/internal/cache/BeanCopyCache.java | 6 ------ .../internal/javassist/JavassistBeanCopyFactory.java | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/tuyang/beanutils/internal/cache/BeanCopyCache.java b/src/main/java/com/tuyang/beanutils/internal/cache/BeanCopyCache.java index 7e9b063..62b69d7 100644 --- a/src/main/java/com/tuyang/beanutils/internal/cache/BeanCopyCache.java +++ b/src/main/java/com/tuyang/beanutils/internal/cache/BeanCopyCache.java @@ -75,12 +75,6 @@ public static void setBeanCopyConfig(BeanCopyConfig beanCopyConfig) { public static BeanCopier getBeanCopy(Class sourceClass, Class targetClass, Class optionClass) { - if( sourceClass.getSimpleName().contains("$$") ) { - if(sourceClass.getSuperclass() != null && sourceClass.getName().startsWith( sourceClass.getSuperclass().getName() ) ){ - sourceClass = sourceClass.getSuperclass(); - } - } - long cacheKey = (((long)sourceClass.hashCode() ) << 16 )+ (long) targetClass.hashCode(); if( optionClass != null ) { cacheKey = (cacheKey <<16) + (long)optionClass.hashCode(); diff --git a/src/main/java/com/tuyang/beanutils/internal/javassist/JavassistBeanCopyFactory.java b/src/main/java/com/tuyang/beanutils/internal/javassist/JavassistBeanCopyFactory.java index fcee9a7..449d1f6 100644 --- a/src/main/java/com/tuyang/beanutils/internal/javassist/JavassistBeanCopyFactory.java +++ b/src/main/java/com/tuyang/beanutils/internal/javassist/JavassistBeanCopyFactory.java @@ -66,6 +66,12 @@ public BeanCopier createBeanCopier(Class sourceClass, Class targetClass, L String className = "com.tuyang.beanutils.internal.javassist.impl.BeanCopier$$javassist" + thisCount; + if( sourceClass.getSimpleName().contains("$$") ) { + if(sourceClass.getSuperclass() != null && sourceClass.getName().startsWith( sourceClass.getSuperclass().getName() ) ){ + sourceClass = sourceClass.getSuperclass(); + } + } + try { int converterCount = 0;