Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1131

Weld Proxies (for instance created by Producer-Method) loose Annotations put ontop of Methods of source class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 1.1.8.Final
    • Reflection layer
    • None
    • Hide

      see description

      Show
      see description

      I have project specific Annotations ontop of public Methods of a class.

      class Customer {
      @MyProjectSpecificAnnotation
      public String getFirstName()

      { return firstName; }

      }

      When producing Objects of such an annotated class, like with
      class Example {
      @Produce
      Customer producerField;
      }

      Then at the Injection Side the Annotations "MyProjectSpecificAnnotation" is no longer available, because WELD injects a byte-code created proxy.

      class InjectionSide {
      @Inject
      Customer injectField; // here we get the WELD-Proxy of unpronouncable name...and no Annotations
      }

      I've used BeanIntrospector to reflect the injected Instance of class Customer. I get a set of PropertyDescriptors with a write/read Method each.
      But as allready said, none of them has the "MyProjectSpecificAnnotation".

      Could be due to the fact, that when subclassing a class, the Annotations of the super class are not available at sub class directly - But in Case of a "transparent" WELD proxy I'd expect they should be there. Probably you have to simply copy annotations during on-the-fly byte-code creation of the Proxy. The Problem is btw also true for javas built in Dynamic Proxy: using it you also loose Annotations.

      Hope you can fix that

              marko.luksa@gmail.com Marko Luksa (Inactive)
              huberp_jira P Huber (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: