javaeclipsejspliferayliferay-6

How to solve warning when using liferay-ui:search-container in JSP?


I'm developing a portlet in Liferay 6.1 using Liferay MVC famework. When I use

<liferay-ui:search-container />  

Eclipse allways shows me the following warning message

SearchContainer is a raw type. References to generic type SearhcContainer<R> should be parameterized

JSP code fragment:

<%
    List<User> users = UserLocalServiceUtil.search(...);
%>

<liferay-ui:search-container>

    <liferay-ui:search-container-results
        results="<%= users %>"
        total="<%= users.size() %>"
    />

    <liferay-ui:search-container-row 
            className="com.liferay.portal.model.User"
            keyProperty="userId"
            modelVar="userVar">

        <liferay-ui:search-container-column-text
                name="name"
                value="<%= userVar.getFullName() %>" />

    </liferay-ui:search-container-row>

    <liferay-ui:search-iterator />

</liferay-ui:search-container>

I have searched many examples. I've imported them into my workspace. And they also show me the same Warning message when search-container tag is used.

An example is this portlet: Event listing portlet
in /docroot/html/eventlisting/view.jsp Eclipse shows me the same warning.

I've not found any solution searching nor in google neither in stackoverflow. I have found many references to warnings in jsp, but no when the warning occurs when using some tag.

If it's possible, I don't want to disable JSP Validation or use some @SuppressWarnings.

I would really like to know if there is a correct way to avoid this warning in JSP when I use this taglib.

I'm working with
- Liferay 6.1.1 CE GA2
- Eclipse Luna Release 4.4.0

Thanks in advance


Solution

  • Class SearchContainer is a generic class (http://cdn.docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/kernel/dao/search/SearchContainer.html), and as all generic class produce that warning when you try to instantiate without pass a type argument.

    For more details:

    But SearchContainer is instantiated via tablib, so i think eclipse "see through" the taglib and produce the warning. The problem probably will be in that generated code and I really guess that this problem has no a pratical solution (hook/ext the taglib code? really?)

    Sorry for this (un)answer !