Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15651

JdkDynamicAopProxy constructs ReflectiveMethodInvocation with EmptyTargetSource.EMPTY_TARGET for static methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 5.0 RC2
    • Fix Version/s: 5.0 RC2
    • Component/s: Core:AOP
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      The recent changes to EmptyTargetSource have broken Spring Security's tests.

      Spring Security relies on checking to see if a MethodInvocation.getThis() is null to determine if the method is static. This seems to be a safe assumption based on the javadoc which states:

      Returns:
      the object (can be null if the accessible object is static).

      What's more is it would seem non-obvious for me to use the EmptyTargetSource.EMPTY_TARGET (which is not accessible, so I need to use EmptyTargetSource.INSTANCE.getTarget() from Spring Framework to compare against the result of MethodInvocation.getThis() from aopalliance.

      I think it makes sense to ensure that the construction of ReflectiveMethodInvocation contains target=null and targetClass=null for static methods.

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            rwinch Rob Winch
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 35 weeks, 6 days ago