deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Muir <pm...@redhat.com>
Subject Re: Need a @Typed for custom project stage (documentation and test class issue)
Date Tue, 31 Jan 2012 23:03:06 GMT
+1 to gerhards approach.

--
Pete Muir
http://in.relation.to/Bloggers/Pete

On 31 Jan 2012, at 14:30, Gerhard Petracek <gerhard.petracek@gmail.com> wrote:

> hi rudy,
> 
> thx! imo it's the right time to restart this discussion.
> 
> mark prefers to use @Typed() for custom project-stages (@mark please
> correct me if i mix it up with a different discussion).
> but i don't really see the need for it. we just can veto project-stage
> classes, because the result is the same and users don't have to care
> about @Typed()
> 
> regards,
> gerhard
> 
> 
> 
> 2012/1/31 Rudy De Busscher <rdebusscher@gmail.com>
> 
>> Hi all,
>> 
>> During testing of the forge deltaspike plugin, I came across a small
>> documentation problem (I hope it is that) regarding the custom project
>> stage.
>> 
>> When the plugin generates the Java class as this
>> 
>> public class CustomProjectStageHolder implements ProjectStageHolder
>> {
>>   public static final class CustomProjectStage extends ProjectStage
>>   {
>>       private static final long serialVersionUID = 1029094387976167179L;
>>   }
>> 
>>   public static final CustomProjectStage CustomProjectStage = new
>> CustomProjectStage();
>> }
>> 
>> and puts the correct value in the
>> 
>> META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder.
>> 
>> I get the following WELD error when starting up the application: (Glassfish
>> 3.1.1, Glassfish 3.1.2 b19 [promoted build], JBoss 7.1.0.CR1b]
>> 
>> *WELD-001409 Ambiguous dependencies for type [ProjectStage] with qualifiers
>> [@Default] at injection point [[field] @Inject private
>> org.apache.deltaspike.demo.HelloWorld.projectStage]. Possible dependencies
>> [[Producer Method [ProjectStage] with qualifiers [@Any @Default] declared
>> as [[method] @Produces @Dependent @Default public
>> org.apache.deltaspike.core.util.ProjectStageProducer.getProjectStage()],
>> Producer Method [ProjectStage] with qualifiers [@Any @Default] declared as
>> [[method] @Produces @Dependent @Default public
>> org.apache.deltaspike.core.util.ProjectStageProducer.getProjectStage()],
>> Managed Bean [class
>> be.rubus.forge.deltaspike.test.projectstage.RudyHolder$Rudy] with
>> qualifiers [@Any @Default]]*
>> 
>> The error goes away by annotating the CustomProjectStage with @Typed.
>> 
>> - Looking at the default project stages defined in class
>> org.apache.deltaspike.core.api.projectstage.ProjectStage, they are also
>> excluded as CDI.
>> - Within the core-impl tests, there is also a custom project stage
>> 
>> (org.apache.deltaspike.test.core.api.projectstage.TestProjectStages.CustomProjectStage)
>> but without the @Typed(). But it seems never used in an integration test.
>> So that's why there is no problem with it.
>> 
>> So do you all agree that
>> 1) I adopt the documentation in adding the @Typed annotation
>> 2) Add the @Typed annotation at the test
>> class
>> org.apache.deltaspike.test.core.api.projectstage.TestProjectStages.CustomProjectStage.
>> Although not needed, it is good for uniformity.
>> 
>> Regards
>> Rudy
>> 
>> --
>> Rudy De Busscher
>> http://www.c4j.be
>> 

Mime
View raw message