Skip to content

Commit e0d81b9

Browse files
committed
SerializableTypeWrapper reobtains type accessors from declaring interface
Issue: SPR-14487 (cherry picked from commit 8580483)
1 parent 90752f9 commit e0d81b9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -372,6 +372,8 @@ static class MethodInvokeTypeProvider implements TypeProvider {
372372

373373
private final String methodName;
374374

375+
private final Class<?> declaringClass;
376+
375377
private final int index;
376378

377379
private transient Method method;
@@ -381,6 +383,7 @@ static class MethodInvokeTypeProvider implements TypeProvider {
381383
public MethodInvokeTypeProvider(TypeProvider provider, Method method, int index) {
382384
this.provider = provider;
383385
this.methodName = method.getName();
386+
this.declaringClass = method.getDeclaringClass();
384387
this.index = index;
385388
this.method = method;
386389
}
@@ -404,7 +407,7 @@ public Object getSource() {
404407

405408
private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
406409
inputStream.defaultReadObject();
407-
this.method = ReflectionUtils.findMethod(this.provider.getType().getClass(), this.methodName);
410+
this.method = ReflectionUtils.findMethod(this.declaringClass, this.methodName);
408411
Assert.state(Type.class == this.method.getReturnType() || Type[].class == this.method.getReturnType());
409412
}
410413
}

0 commit comments

Comments
 (0)