[cdi-dev] [JBoss JIRA] (CDI-670) Clarify InterceptionFactory.ignoreFinalMethods() purpose and functioning

Antoine Sabot-Durand (JIRA) issues at jboss.org
Tue Jan 10 04:55:00 EST 2017

     [ https://issues.jboss.org/browse/CDI-670?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on CDI-670 started by Antoine Sabot-Durand.
> Clarify InterceptionFactory.ignoreFinalMethods() purpose and functioning
> ------------------------------------------------------------------------
>                 Key: CDI-670
>                 URL: https://issues.jboss.org/browse/CDI-670
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>            Reporter: Martin Kouba
>            Assignee: Antoine Sabot-Durand
>            Priority: Critical
>             Fix For: 2.0 .Final
> 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):
> {code:java}
>  @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());
>   }
> {code}
> 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*.

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list