diff --git a/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterProvider.java b/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterProvider.java index 6e8b783ca7..d991fad09d 100644 --- a/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterProvider.java +++ b/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterProvider.java @@ -397,11 +397,6 @@ private ObjectWriter getObjectWriterInternal(Type objectType, Class objectClass, if (objectWriter != null) { return objectWriter; } - } else { - objectWriter = cache.get(objectType); - if (objectWriter != null) { - return objectWriter; - } } } diff --git a/core/src/test/java/com/alibaba/fastjson2/write/ObjectWriterProviderTest.java b/core/src/test/java/com/alibaba/fastjson2/write/ObjectWriterProviderTest.java index 82eb3a6acd..c1507626ca 100644 --- a/core/src/test/java/com/alibaba/fastjson2/write/ObjectWriterProviderTest.java +++ b/core/src/test/java/com/alibaba/fastjson2/write/ObjectWriterProviderTest.java @@ -6,13 +6,8 @@ import com.alibaba.fastjson2.writer.ObjectWriter; import com.alibaba.fastjson2.writer.ObjectWriterProvider; import org.junit.jupiter.api.Test; -import org.springframework.cglib.proxy.Enhancer; -import org.springframework.cglib.proxy.MethodInterceptor; -import org.springframework.cglib.proxy.MethodProxy; -import java.lang.reflect.Method; import java.lang.reflect.Type; -import java.util.concurrent.TimeUnit; import static org.junit.jupiter.api.Assertions.*; @@ -136,28 +131,9 @@ public void testWriter2() { assertSame(writer1, JSON.registerIfAbsent(Bean.class, writer, false)); } - @Test - public void testWriterProxy() throws InterruptedException { - Enhancer enhancer = new Enhancer(); - enhancer.setSuperclass(Bean.class); - enhancer.setCallback(new BeanMethodInterceptor()); - Object proxy1 = enhancer.create(); - JSON.toJSONString(proxy1); - JSON.toJSONString(proxy1); - TimeUnit.MINUTES.sleep(60); - } - public static class Bean { } - public static class BeanMethodInterceptor implements MethodInterceptor { - - @Override - public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { - return methodProxy.invokeSuper(o, objects); - } - } - public static class BeanWriter implements ObjectWriter { @Override