Search in sources :

Example 11 with CurrentLiveVersion

use of org.springsource.loaded.CurrentLiveVersion in project spring-loaded by spring-projects.

the class ReflectiveInterceptor method jlrMethodGetParameterAnnotations.

public static Annotation[][] jlrMethodGetParameterAnnotations(Method method) {
    ReloadableType rtype = getReloadableTypeIfHasBeenReloaded(method.getDeclaringClass());
    if (rtype == null) {
        //Nothing special to be done
        return method.getParameterAnnotations();
    } else {
        // Method could have changed...
        CurrentLiveVersion clv = rtype.getLiveVersion();
        MethodMember currentMethod = rtype.getCurrentMethod(method.getName(), Type.getMethodDescriptor(method));
        Method executor = clv.getExecutorMethod(currentMethod);
        Annotation[][] result = executor.getParameterAnnotations();
        if (!currentMethod.isStatic()) {
            //Non=static methods have an extra param.
            //Though extra param is added to front...
            //Annotations aren't being moved so we have to actually drop the *last* array element
            result = Utils.arrayCopyOf(result, result.length - 1);
        }
        return result;
    }
}
Also used : ReloadableType(org.springsource.loaded.ReloadableType) CurrentLiveVersion(org.springsource.loaded.CurrentLiveVersion) Method(java.lang.reflect.Method) MethodMember(org.springsource.loaded.MethodMember)

Aggregations

CurrentLiveVersion (org.springsource.loaded.CurrentLiveVersion)11 ReloadableType (org.springsource.loaded.ReloadableType)10 Method (java.lang.reflect.Method)9 MethodMember (org.springsource.loaded.MethodMember)4 MethodHandle (java.lang.invoke.MethodHandle)1 MethodHandles (java.lang.invoke.MethodHandles)1 MethodType (java.lang.invoke.MethodType)1 AccessibleObject (java.lang.reflect.AccessibleObject)1 Field (java.lang.reflect.Field)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Handle (org.objectweb.asm.Handle)1 Type (org.objectweb.asm.Type)1 ReloadException (org.springsource.loaded.ReloadException)1 TypeRegistry (org.springsource.loaded.TypeRegistry)1