[weld-dev] non-visable classes and constructors

Mark Struberg struberg at yahoo.de
Mon Nov 30 10:45:46 EST 2009


I'm completely fine with that! I just wanted to make sure that we didn't force something (or better said: allow something) which isn't covered by the spec :)
I think this is also important for the resin folks.


LieGrue,
strub

--- Gavin King <gavin.king at gmail.com> schrieb am Mo, 30.11.2009:

> Von: Gavin King <gavin.king at gmail.com>
> Betreff: Re: [weld-dev] non-visable classes and constructors
> An: "Mark Struberg" <struberg at yahoo.de>, "Weld-Dev" <weld-dev at lists.jboss.org>
> Datum: Montag, 30. November 2009, 16:36
> > The spec says:
> >
> >
> > "A top-level Java class is a managed bean if it is
> defined to be a
> > managed bean by any other Java EE specification, or if
> it meets all of
> > the following conditions:
> > •       It is not a non-static inner class.
> > •       It is a concrete class, or is annotated
> @Decorator.
> > ...
> > •       It has an appropriate
> constructor—either:
> >    •   the class has a constructor with no
> parameters, or
> >    •   the class declares a constructor annotated
> @Inject.
> >
> > All Java classes that meet these conditions are
> managed beans and thus
> > no special declaration is required to define a man-
> aged bean."
> >
> > Which part of the word "all" do you not understand?
> ;-)
> >
> > But more importantly, there is a very good usecase for
> allowing this
> > case. I might be using an interface at the injection
> point, and hiding
> > the actual implementation of the client by declaring
> the bean class
> > package private. This is just like having a factory
> method defined
> > within the package, so I'm not "breaking" any normal
> Java behavior
> > here.
> >
> > Now, look, I'm slightly sympathetic to the idea that
> we could have
> > chosen to say that bean constructors must not be
> private private, and
> > that if the constructor with no parameters is private,
> then the class
> > is not a bean. That would not be a completely
> unreasonable behavior
> > (it doesn't necessarily follow from first principles,
> but you could do
> > a bit of guessing about user intent and say that it's
> reasonable). But
> > we didn't say that. We said something else. And the
> spec is now final.
> > So for portability, we all have to comply with that.
> 
> 
> 
> 
> -- 
> Gavin King
> gavin.king at gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
> 

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 



More information about the weld-dev mailing list