From e0d81b97bbfd472b0dc409b3599f671d2f5110a4 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 19 Jul 2016 19:22:32 +0200 Subject: [PATCH] SerializableTypeWrapper reobtains type accessors from declaring interface Issue: SPR-14487 (cherry picked from commit 8580483) --- .../org/springframework/core/SerializableTypeWrapper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java b/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java index 8f1fd9d9eb3..eaae658a4da 100644 --- a/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java +++ b/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -372,6 +372,8 @@ abstract class SerializableTypeWrapper { private final String methodName; + private final Class declaringClass; + private final int index; private transient Method method; @@ -381,6 +383,7 @@ abstract class SerializableTypeWrapper { public MethodInvokeTypeProvider(TypeProvider provider, Method method, int index) { this.provider = provider; this.methodName = method.getName(); + this.declaringClass = method.getDeclaringClass(); this.index = index; this.method = method; } @@ -404,7 +407,7 @@ abstract class SerializableTypeWrapper { private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException { inputStream.defaultReadObject(); - this.method = ReflectionUtils.findMethod(this.provider.getType().getClass(), this.methodName); + this.method = ReflectionUtils.findMethod(this.declaringClass, this.methodName); Assert.state(Type.class == this.method.getReturnType() || Type[].class == this.method.getReturnType()); } }