Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-3033

ApplicationUtil private constructor does not throw AssertionError

    Details

      Description

      Although com.liferay.faces.util.application.ApplicationUtil class has the final keyword with a private constructor, it does not follow the pattern of throwing AssertionError if the private constructor is called.

      This task involves modifying the ApplicationUtil private constructor to look like the following:

      ApplicationUtil.java
      public final class ApplicationUtil {
      
      	// Prevent instantiation since this is a static utility class.
      	private ApplicationUtil() {
      		throw new AssertionError();
      	}
      

      Note that adding a private constructor to static utility classes is a recommended practice by Joshua Bloch in his book titled "Effective Java", Second Edition, page 19.

        Attachments

          Activity

            People

            • Assignee:
              neil.griffin Neil Griffin
              Reporter:
              neil.griffin Neil Griffin
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                util-2.1.0
                util-3.1.0