LocalVariableTableParameterNameDiscoverer works for bridge methods as well

Issue: SPR-9429
This commit is contained in:
Juergen Hoeller 2013-01-18 14:52:24 +01:00
parent 3dd817585b
commit ed952ccba1
1 changed files with 4 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -65,15 +65,15 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
public String[] getParameterNames(Method method) { public String[] getParameterNames(Method method) {
Class<?> declaringClass = method.getDeclaringClass(); Method originalMethod = BridgeMethodResolver.findBridgedMethod(method);
Class<?> declaringClass = originalMethod.getDeclaringClass();
Map<Member, String[]> map = this.parameterNamesCache.get(declaringClass); Map<Member, String[]> map = this.parameterNamesCache.get(declaringClass);
if (map == null) { if (map == null) {
// initialize cache
map = inspectClass(declaringClass); map = inspectClass(declaringClass);
this.parameterNamesCache.put(declaringClass, map); this.parameterNamesCache.put(declaringClass, map);
} }
if (map != NO_DEBUG_INFO_MAP) { if (map != NO_DEBUG_INFO_MAP) {
return map.get(method); return map.get(originalMethod);
} }
return null; return null;
} }
@ -82,14 +82,12 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
Class<?> declaringClass = ctor.getDeclaringClass(); Class<?> declaringClass = ctor.getDeclaringClass();
Map<Member, String[]> map = this.parameterNamesCache.get(declaringClass); Map<Member, String[]> map = this.parameterNamesCache.get(declaringClass);
if (map == null) { if (map == null) {
// initialize cache
map = inspectClass(declaringClass); map = inspectClass(declaringClass);
this.parameterNamesCache.put(declaringClass, map); this.parameterNamesCache.put(declaringClass, map);
} }
if (map != NO_DEBUG_INFO_MAP) { if (map != NO_DEBUG_INFO_MAP) {
return map.get(ctor); return map.get(ctor);
} }
return null; return null;
} }