EXECUTE: Create any CDI project with Seam Solder module.
EXECUTE: Create a few types:
@Retention(RUNTIME) @GenericType(MessageSystemConfiguration.class) @interface ACMEQueue { String name(); }
public class MyMessageQueues { @Produces @ACMEQueue("defaultQueue") @Named("aaa") MessageSystemConfiguration defaultQueue = new MessageSystemConfiguration(null); @Produces @Durable @ACMEQueue("defaultQueue") @Named("aaa") MessageSystemConfiguration defaultQueue1 = new MessageSystemConfiguration(null); }
@GenericConfiguration(ACMEQueue.class) class MessageManager { @Inject @Generic MessageQueue queue; @Produces @ApplyScope MessageDispatcher messageDispatcherProducer() { return queue.createMessageDispatcher(); } @Produces DispatcherPolicy getPolicy() { return queue.getDispatcherPolicy(); } }
@GenericConfiguration(ACMEQueue.class) @ApplyScope public class QueueManager implements Serializable { @Produces @ApplyScope public MessageQueue messageQueueProducer() { // return factory.createMessageQueue(config.name()); return null; } }
public interface MessageQueue {}
EXECUTE: Save the files.
ASSERT: Both @Named("aaa") marked as duplicate EL names: "A few beans (QueueManager.messageQueueProducer(), MyMessageQueues.defaultQueue1, MyMessageQueues.defaultQueue) have the same EL name and the name is not resolvable [JSR-299 §5.3.1]
FAILURE: Both @Named("aaa") marked as duplicate EL names: "A few beans (QueueManager.messageQueueProducer(), MyMessageQueues.defaultQueue1, MyMessageQueues.defaultQueue, QueueManager.messageQueueProducer()) have the same EL name and the name is not resolvable [JSR-299 §5.3.1] <-- QueueManager.messageQueueProducer() mentioned twice!