[weld-dev] Stereotype inheritance

Stuart Douglas stuart at baileyroberts.com.au
Mon Jan 18 02:52:08 EST 2010


Does the spec define what happens in the following situation?

@RequestScoped @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface Action {}

@ApplicationScoped @Action @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface Home {}

@Home
public class MyBean{}


As far as I could see the spec does not define what to do when stereotypes declare stereotypes that have conflicting scopes.  In this situation it would make sense to have Home's scope override Actions, but we can also get situations like this:


@RequestScoped @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface Action {}

@ApplicationScoped @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface Home {}

@Stereotype @Home @Action @Target(TYPE) @Retention(RUNTIME) public @interface HomeAction {}

@Home
public class MyBean{}

I think this should be an error.  

Stuart


More information about the weld-dev mailing list