Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-458

we should unpack the parameter for proxied equals(Object) calls in certain cases

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0.0-alpha-2
    • Fix Version/s: None
    • Labels:
      None

      Description

      The problem:
      If you invoke an equals(Object o) method on a proxy, then the proxy might directly access private fields if o is of the same type as the proxied object itself.
      But if the proxy directly accesses private fields, then no interception occurs and the equals method will effectively only get the empty values from proxy itself (which enhances o's class and thus has the exact same fields).

      The solution:
      We need to 'unpack' the proxy parameter and instead provide the underlying contextual instance

      if (inteceptedMethod.equals("equals") && param.intanceOf(bean.getType()) && isOurProxy(parram)
      {
      unpackedParam = getUnderlyingContextualInstance((NormalScopedBeanInterceptor) param);
      invoke("equals", unpackedParam);
      }
      ..

        Attachments

          Activity

            People

            • Assignee:
              struberg Mark Struberg
              Reporter:
              struberg Mark Struberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: