private void clearLocalVariableTableParameterNameDiscovererCache ( Class < ? > clazz ) { if ( localVariableTableParameterNameDiscovererInstances == null ) { return ; } if ( debug ) { System . out . println ( "SPRING_PLUGIN: ParameterNamesCache: Clearing parameter name discoverer caches" ) ; } if ( parameterNamesCacheField == null ) { try { parameterNamesCacheField = localVariableTableParameterNameDiscovererInstances . get ( 0 ) . getClass ( ) . getDeclaredField ( "parameterNamesCache" ) ; } catch ( NoSuchFieldException nsfe ) { log . log ( Level . SEVERE , "Unexpectedly cannot find parameterNamesCache field on LocalVariableTableParameterNameDiscoverer class" ) ; } } for ( Object instance : localVariableTableParameterNameDiscovererInstances ) { try { parameterNamesCacheField . setAccessible ( true ) ; Map < ? , ? > parameterNamesCache = ( Map < ? , ? > ) parameterNamesCacheField . get ( instance ) ; Object o = parameterNamesCache . remove ( clazz ) ; if ( debug ) { System . out . println ( "SPRING_PLUGIN: ParameterNamesCache: Removed " + clazz . getName ( ) + " from cache?" + ( o != null ) ) ; } } catch ( IllegalAccessException e ) { log . log ( Level . SEVERE , "Unexpected IllegalAccessException trying to access parameterNamesCache field on LocalVariableTableParameterNameDiscoverer class" ) ; } catch ( IllegalArgumentException iae ) { log . log ( Level . SEVERE , "Unexpected IllegalArgumentException trying to access parameterNamesCache field on LocalVariableTableParameterNameDiscoverer class" ) ; } } }
The Spring class LocalVariableTableParameterNameDiscoverer holds a cache of parameter names discovered for members within classes and needs clearing if the class changes .