users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] [jsr344-experts] Re: ViewDeclarationLanguage API review

From: Edward Burns <edward.burns_at_oracle.com>
Date: Mon, 18 Mar 2013 08:08:06 -0700

>>>>> On Tue, 12 Mar 2013 14:58:49 -0400, Andy Schwartz <andy.schwartz_at_oracle.com> said:

AS> Gang -
AS> Minor comments on ViewDeclarationLanguage:

AS> Index: javax/faces/view/ViewDeclarationLanguage.java
AS> ===================================================================
AS> --- javax/faces/view/ViewDeclarationLanguage.java (revision 8845)
AS> +++ javax/faces/view/ViewDeclarationLanguage.java (revision 11719)

AS> + /**
AS> + * <p class="changed_added_2_2">Return the list of resource library
AS> + * contracts that will be made available for use in the view
AS> + * specified by the argument {_at_code viewId}. If no match is found,
AS> + * return an empty list. See section JSF.7.7.2 for the
AS> + * specification of the default implementation. For backward
AS> + * compatibility with prior implementations, an implementation is
AS> + * provided that returns {_at_code null}, but any implementation
AS> + * compliant with the version of the specification in which this
AS> + * method was introduced must implement it as specified in
AS> + * JSF.7.7.2. </p>
AS> + *
AS> + * @param context the {_at_code FacesContext} for this request
AS> + * @param viewId the view id for which the applicable resource library
AS> + * contracts should be calculated.
AS> + *
AS> + * @since 2.2
AS> + */
AS> +
AS> + public List<String> calculateResourceLibraryContracts(FacesContext
AS> context,
AS> + String viewId) {
AS> + return null;
AS> + }


AS> I don't understand the relationship between:

AS> + * If no match is found,
AS> + * return an empty list.

AS> And:

AS> + * For backward
AS> + * compatibility with prior implementations, an implementation is
AS> + * provided that returns {_at_code null}

AS> These statements seem contradictory.

AS> We should spec that:

AS> - The returned List is immutable. And...
AS> - The returned List is guaranteed to be non-null.

AS> The default implementation should return Collections.emptyList() instead
AS> of null.

AS> This avoids forcing callers to explicitly check for a null return value.

Yes, I have done this.

Ed

--