Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-670

Clarify InterceptionFactory.ignoreFinalMethods() purpose and functioning

XMLWordPrintable

    • Icon: Clarification Clarification
    • Resolution: Done
    • Icon: Critical Critical
    • 2.0 .Final
    • None
    • None
    • None

      It should be clear that InterceptionFactory.ignoreFinalMethods() only affects the generation of the "proxy" which enables interception. E.g. the following example would FAIL during validation of myFoo injection point (bootstrap):

       @Inject
       Foo myFoo;
      
       @Produces
       @RequestScoped // -> Requires a client proxy
       public Foo produce(InterceptionFactory<Foo> interceptionFactory) {
              // Suppose Foo has a final method
              return interceptionFactory.ignoreFinalMethods().createInterceptedInstance(new Foo());
        }
      

      The reason is that the CDI container must treat the producer as a deployment problem (unless javax.enterprise.inject.spi.ProcessBeanAttributes.ignoreFinalMethods() is used for the producer method).

      I understand that it's not very intuitive. On the other hand, these are two different concepts. I.e. the injection point validation happens during bootstrap while the InterceptionFactory is used at runtime.

              asabotdu@redhat.com Antoine Sabot-Durand (Inactive)
              mkouba@redhat.com Martin Kouba
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: