I mistakenly annotated one of my Seam classes as Stateless and then applied it to the EVENT Seam scope.
It is my impression that @Scope is always ignored on stateless session beans.
So yes, I think it would be nicer if seam gave at least a log message on warning level if the scope annotation is present at all.
But in fact your mistake is unrelated to seam and the @Scope annotation, isn't it?
You put state in a stateless bean that should have been a stateful bean.
But maybe I have not understood something correctly.
Yes, that's correct. I made a mistake and the bean was intended to be stateful. I was surprised that Seam didn't pick up on this as it seems to notice other incorrect annotations and halts deployment.
Perhaps I am expecting too much of frameworks: should annotation based frameworks validate annotation usage? how should they react to any silly usages? is such validation expensive?
I think my bad use of the @Scope annotation was an easily made mistake. I would rather the application was not deployed than deployed like this.
Another mistake I made previously was to give two components the same name (@Name) in the same scope. This also led to strange behaviour. Again, is this something Seam should pick up on?
Well, it's arguable.
It is actually OK to cache the reference to the stateless bean in SESSION or EVENT scope. What is not OK is to use the stateless bean to hold state...
I am currently writing a plugin for IntelliJ Idea that catches these errors early on.
Gavin, so @Scope on @Stateless beans is actually ok, and used by Seam, right? Then I will probably only give a warning on that.
Shameless hijacking of the thread: Could you or some other expert maybe answer another questions about scope:
Thanks a lot.
Yes, a warning is fine.
Looking forward to seeing your plugin! :-)