-
Type:
Improvement
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: facesbridge-api-5.0.0
-
Component/s: FacesBridge API
-
Labels:None
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.