Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0, 4.x
-
Platform independent
Description
The Javadoc comment below states that the method "throws IllegalArgumentException if the prototype is null":
/**
..
- @param prototype the object to clone each time in the factory
- @return the <code>prototype</code> factory
- @throws IllegalArgumentException if the prototype is null
- @throws IllegalArgumentException if the prototype cannot be cloned
*/
public static <T> Factory<T> prototypeFactory(T prototype) { return PrototypeFactory.<T>prototypeFactory(prototype); }
However, the method returns a NULL_INSTANCE object instead of throwing IllegalArgumentException when called with null.
Suggested Fixes:
1. Change "@throws IllegalArgumentException if the prototype is null" and "@return" to "@return NULL_INSTANCE if the prototype is null".
or
2. Remove the entire "throws IllegalArgumentException if the prototype is null".