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

Add the final modifier and a private constructor to javax.portlet.faces.BridgeUtil since it is a static utility class



      The Bridge API features the javax.portlet.faces.BridgeUtil static utility class that contains two static methods:

      public class BridgeUtil {
      	public static Bridge.PortletPhase getPortletRequestPhase() { ... }
      	public static boolean isPortletRequest() { ... }

      This task involves adding the final modifier to the class signature and the following private constructor in order to prevent instantiation and subclassing:

      public final class BridgeUtil {
      	// Prevent instantiation and subclassing since this is a static utility class.
      	private BridgeUtil() {
      		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.

      Although this is technically a "breaking change" to the API, the BridgeUtil class was never intended to be instantiated or subclassed. In the Spec Lead's opinion, it is a very minor risk that this would break any legacy JSF portlets.




            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: