Archive for the ‘liferay’ Category

One of the many Lifeary’s features is the lack of “proper JavaDoc”.

To make it clear “proper JavaDoc” means having not only listings of classes and methods with parameter types, but having for each interface method a description of what that method does, even if it is a two-line description.

But don’t get it wrong, the description must be non-trivial and meaningful, not like the ones generated by IDEs like “This method gets the cost” on method “getCost”, as that is worth nothing. If some method can only have a trivial comment it can be safely left blank.

This lack of “proper javadoc” made me loose a couple of hours today reviewing code that created articles programmatically because the last version of them was not shown. We used the next method to get an article display instance for displaying it in one of our portlets:

JournalArticleLocalServiceUtil.getArticleDisplay(groupId, articleId, viewMode, languageId, themeDisplay);

After ensuring that our code was working right I took a trip into Liferay’s source code and after reading/debugging the method I found it returns the article display of the first article it founds that have a display date before the current time (Date()) and that is not expired, so instead of the latest version that was the last one in the list got from db it returned the previous one because it fullfilled these conditions, ¿but how could you know that looking at a naked JavaDoc API?