jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [jsr372-experts mirror] Re: Re: Deprecating types in javax.faces.bean package?

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Wed, 1 Jun 2016 19:48:00 +0200

Hi y'all,

I've implemented the javax.faces.bean.ManagedProperty replacement. After
some consideration I went for the @ManagedProperty name again. Not an easy
choice, but alas.

It's implemented here:
https://github.com/jsf-spec/mojarra/commit/167374880e650c25ce4012364bfa8177d99e5b70

And a test is available here:
https://github.com/jsf-spec/mojarra/commit/72692c2204044dc4d14771485d2a8c0615e0e04a

Principally you could add an almost endless amount of extra features to
this, such as converters, default values (handy for #{param[...]} and what
have you.

To keeps things simple for now I didn't went for those extras.

One thing I'm considering though is support for EL evaluation using the EL
3.0's ELProcessor / CDI's BeanManager#getELResolver combo. See e.g.
https://github.com/javaee-security-spec/soteria/blob/master/impl/src/main/java/org/glassfish/soteria/cdi/RememberMeInterceptor.java#L201

Advantage of having that is the ability to evaluate EL via injection when
there's no FacesContext, e.g. when an application scoped bean is
initialised during startup. Could be done via an attribute, e.g.
"resolveByCDI", or automatically perhaps (no FacesContext? use CDI,
otherwise use JSF).

Thoughts?

Kind regards,
Arjan Tijms





On Thu, May 26, 2016 at 6:21 PM, Neil Griffin <neil.griffin_at_portletfaces.org
> wrote:

> Since javax.faces.bean.ViewScoped has the same name as
> javax.faces.view.ViewScoped, then for consistency I think it might be best
> to keep the name as ManagedProperty. When given a choice by the IDE as to
> which one to import, the developer will see a strikethrough for the
> deprecated one and so it will be obvious which is the new one.
>
> > On May 26, 2016, at 12:01 PM, Josh Juneau <juneau001_at_gmail.com> wrote:
> >
> > Do you think it would confuse developers if the replacement were named
> differently? I would assume that those who would use the replacement may
> be modifying existing applications. That said, if the name were the same
> then it seems like it may be more obvious. If one is looking for the
> replacement to @ManagedProperty, it may not be as straight-forward if it
> were named differently.
> >
> > On the other hand, it could be confusing to have the same name carried
> forward. However, I think that it would not be any more confusing than the
> past couple of years where we've been dealing with CDI and Faces scopes
> that were named the same.
> >
> > Hope this helps.
> >
> > Josh Juneau
> > juneau001_at_gmail.com
> > http://jj-blogger.blogspot.com
> > https://www.apress.com/index.php/author/author/view/id/1866
> >
> >
> > On Thu, May 26, 2016 at 10:49 AM, arjan tijms <arjan.tijms_at_gmail.com>
> wrote:
> > Does anyone have a preference for the @ManagedProperty replacement name?
> Same name but in the annotation package (where several other CDI qualifiers
> now reside), so javax.faces.annotation.ManagedProperty.
> >
> > Or use a different name, e.g. @EvaluateExpression?
> >
> >
> >
> >
> >
> > On Thu, May 26, 2016 at 5:32 PM, Neil Griffin <
> neil.griffin_at_portletfaces.org> wrote:
> > +1 for the @ManagedProperty replacement. Thanks so much for working on
> this Arjan.
> >
> > > On May 26, 2016, at 11:07 AM, arjan tijms <arjan.tijms_at_gmail.com>
> wrote:
> > >
> > > Hi,
> > >
> > > Thanks for the support. I'll look into @ManagedProperty soon then.
> > >
> > > On Thu, May 26, 2016 at 4:51 PM, Josh Juneau <juneau001_at_gmail.com>
> wrote:
> > > Thanks Arjan...no objections here! This is certainly going to help
> clarify things for those who are not familiar with the difference between
> Faces and CDI scopes.
> > >
> > > +1 on implementing a replacement for @ManagedProperty.
> > >
> > > Josh Juneau
> > > juneau001_at_gmail.com
> > > http://jj-blogger.blogspot.com
> > > https://www.apress.com/index.php/author/author/view/id/1866
> > >
> > >
> > > On Wed, May 25, 2016 at 10:13 AM, arjan tijms <arjan.tijms_at_gmail.com>
> wrote:
> > > Hi,
> > >
> > > As there were no objections after a week, I went ahead and prepared
> the change set. It can be previewed here:
> > >
> > >
> https://github.com/jsf-spec/mojarra/commit/2f9e0152559d33324627c66209eb2511e03e20c0
> > >
> > > If there are no further objections I'd like to push this to java.net
> soon.
> > >
> > > One thing to note, there currently is no replacement for
> @ManagedProperty. I'd like to provide a simple one roughly based on
> Manfred's blog from a while back, but as a Bean<T> instead with the ability
> to inject into various types. See
> http://manorrock.com/blog/2013/11/01/jsf_tip_31_migrate_your_managedproperty_annotations.html
> > >
> > > Kind regards,
> > > Arjan Tijms
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Thu, May 19, 2016 at 5:32 PM, arjan tijms <arjan.tijms_at_gmail.com>
> wrote:
> > > Hi,
> > >
> > > On Thu, May 19, 2016 at 5:27 PM, Neil Griffin <
> neil.griffin_at_portletfaces.org> wrote:
> > > +1 for an API change, indicating that annotations from
> javax.faces.bean are deprecated.
> > >
> > > Thanks
> > >
> > >
> > > However, I recall a conversation with Manfred in which he suggested
> having the legacy Managed Bean Facility utilize CDI under-the-hood. I think
> we should not do that because it would create complications for the JSF
> Portlet Bridge since the scope/meaning of javax.faces.bean.RequestScoped
> and javax.enterprise.context.RequestScoped are not equal in a portlet
> environment.
> > >
> > > I remember that this idea was pitched, but we're not doing that as far
> as I know and I don't think there are any plans anymore to pursue that. So
> no worries ;) Thanks for the reminder!
> > >
> > > Kind regards,
> > > Arjan Tijms
> > >
> > >
> > >
> > > > On May 19, 2016, at 5:12 AM, arjan tijms <arjan.tijms_at_gmail.com>
> wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Thu, May 19, 2016 at 10:33 AM, Bauke Scholtz <balusc_at_gmail.com>
> wrote:
> > > > It's about time. I've already prepared the community for years that
> @ManagedBean and friends are going to be deprecated.
> > > >
> > > > +1 definitely.
> > > >
> > > > When mentioning alternative for @ManagedProperty, don't mention only
> @Inject but also explain @Produces possibility and all those new CDI
> qualifiers for JSF artifacts.
> > > >
> > > > Sure, thanks for the feedback. I'll prepare a changeset in the
> upstream/staging repo first, which everyone can look at and provide further
> feedback on if needed. If there are no objections I'll then push that
> changeset through to java.net.
> > > >
> > > > Kind regards,
> > > > Arjan Tijms
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Cheers, B
> > > >
> > > >
> > > > On Wed, May 18, 2016 at 10:44 PM, arjan tijms <arjan.tijms_at_gmail.com>
> wrote:
> > > > Hi,
> > > >
> > > > Thanks for the support Michael en Paul :) I've created
> https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1417 in support
> of this.
> > > >
> > > > Kind regards,
> > > > Arjan Tijms
> > > >
> > > >
> > > > On Wed, May 18, 2016 at 9:41 PM, Paul Nicolucci <pnicoluc_at_us.ibm.com>
> wrote:
> > > > +1
> > > >
> > > > Regards,
> > > >
> > > > Paul Nicolucci
> > > >
> > > >
> > > > <graycol.gif>Michael Müller ---05/18/2016 03:40:02 PM---+99999 (at
> least) This avoids a commonly Seen problem
> > > >
> > > > From: Michael Müller <michael.mueller_at_mueller-bruehl.de>
> > > > To: jsr372-experts_at_javaserverfaces-spec-public.java.net
> > > > Date: 05/18/2016 03:40 PM
> > > > Subject: [jsr372-experts] Re: [jsr372-experts mirror] Deprecating
> types in javax.faces.bean package?
> > > >
> > > >
> > > >
> > > >
> > > > +99999 (at least)
> > > >
> > > > This avoids a commonly Seen problem
> > > > --
> > > > Herzliche Grüße, best regards
> > > > Michael Müller
> > > >
> > > > Am 18. Mai 2016 20:43:11 MESZ, schrieb arjan tijms <
> arjan.tijms_at_gmail.com>:
> > > > Hi,
> > > >
> > > > As it's been clear for some time we're moving away from the JSF
> native managed bean facility, I'd like to propose deprecating all the types
> in the javax.faces.bean package via the @deprecated annotation and/or
> javadoc, and mention what the alternative is now.
> > > >
> > > > This would particularly be helpful with things like
> javax.faces.bean.RequestScoped vs javax.enterprise.context.RequestScoped,
> where people not rarely import the wrong version.
> > > >
> > > > Thoughts?
> > > >
> > > > Kind regards,
> > > > Arjan Tijms
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
>
>