diff --git a/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java b/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java index 6f0a29e8a7d..dde5b57842d 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java +++ b/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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. @@ -39,12 +39,11 @@ import org.springframework.util.ClassUtils; /** * Implementation of {@link ParameterNameDiscoverer} that uses the LocalVariableTable * information in the method attributes to discover parameter names. Returns - * null if the class file was compiled without debug information. + * {@code null} if the class file was compiled without debug information. * - *

Uses ObjectWeb's ASM library for analyzing class files. Each discoverer - * instance caches the ASM discovered information for each introspected Class, in a - * thread-safe manner. It is recommended to reuse discoverer instances - * as far as possible. + *

Uses ObjectWeb's ASM library for analyzing class files. Each discoverer instance + * caches the ASM discovered information for each introspected Class, in a thread-safe + * manner. It is recommended to reuse ParameterNameDiscoverer instances as far as possible. * * @author Adrian Colyer * @author Costin Leau @@ -64,15 +63,15 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD public String[] getParameterNames(Method method) { - Class declaringClass = method.getDeclaringClass(); + Method originalMethod = BridgeMethodResolver.findBridgedMethod(method); + Class declaringClass = originalMethod.getDeclaringClass(); Map map = this.parameterNamesCache.get(declaringClass); if (map == null) { - // initialize cache map = inspectClass(declaringClass); this.parameterNamesCache.put(declaringClass, map); } if (map != NO_DEBUG_INFO_MAP) { - return map.get(method); + return map.get(originalMethod); } return null; } @@ -82,14 +81,12 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD Class declaringClass = ctor.getDeclaringClass(); Map map = this.parameterNamesCache.get(declaringClass); if (map == null) { - // initialize cache map = inspectClass(declaringClass); this.parameterNamesCache.put(declaringClass, map); } if (map != NO_DEBUG_INFO_MAP) { return map.get(ctor); } - return null; }