[ 
https://issues.apache.org/jira/browse/EXTCDI-162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012146#comment-13012146
 ] 

Mark Struberg commented on EXTCDI-162:
--------------------------------------

the need of using @Typed for every kind of bean which gets created via a 
producer (which is a 'managed bean' for that type itself!) is just a standard 
mechanism in CDI. This is caused by the (imo very unwise, but please spare me 
the long story behind that) fact that every java class gets picked up as 
@Dependent bean automatically. Whenever you use CDI, you will stumble about 
this fact pretty quickly. So having to write @Typed for those kind of beans is 
'just natural'. Wheras finding our Extension which vetoes such classes might be 
very hard for a beginner to find...

So I'm basically against vetoing those beans in our extension because
a) it's not necessary
b) will slow down the startup (a bit)
c) might confuse users even more.

We shall instead just explain the necessity of @Typed in our documentation. A 
user will need to use this for his very own beans anyway.

The alternative would be to introduce a @Veto annotation which we could use for 
other beans also...

> re-visit implementation of custom project stages.
> -------------------------------------------------
>
>                 Key: EXTCDI-162
>                 URL: https://issues.apache.org/jira/browse/EXTCDI-162
>             Project: MyFaces CODI
>          Issue Type: Task
>          Components: Core
>    Affects Versions: 0.9.4
>            Reporter: Gerhard Petracek
>
> if users forget @Typed(), they would see an AmbiguousResolutionException.
> cdi-qualifiers aren't supported (in case of project-stages). so @Typed() is 
> required all the time.
> currently valid example:
> public class CustomProjectStage implements ProjectStageHolder
> {
>     @Typed()
>     public static final class Debugging extends ProjectStage
>     {
>         private static final long serialVersionUID = -8626602281649294170L;
>     }
>     public static final Debugging Debugging = new Debugging();
> }
> since there is no support for cdi-qualifiers, we could veto those classes. 
> that would allow to skip the @Typed() but the rest would be the same (because 
> codi will still find them).
> pro: users don't have to use @Typed() explicitly (and they won't see the 
> AmbiguousResolutionException, if they forget using @Typed())
> con: it isn't std. cdi - but adding @Typed() even though it isn't needed 
> wouldn't harm.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to