JDO spec: "11.9 Registering for life cycle events", "12.15 Life-cycle callbacks" (http://people.apache.org/~clr/jdo-2010-04-09.pdf
1. "11.9 If the listener is already registered for life cycle events, the classes are added to the set of classes being listened to". If the same listener is added in multiple calls, the classes from each call should be merged into a single LifecycleListenerForClass object.
2. "11.9 The addInstanceLifecycleListener and removeInstanceLifecycleListener methods are considered to be configuration methods and can only be called when the PersistenceManagerFactory is configurable (before the first getPersistenceManager is called)". With the missing "assertConfigurable" guards in place, the current code for auto-adding the new listeners to existing PMs is also superfluous.
3. The spec says what to do if the 'classes' parameter of PMF.addInstanceLifecycleListener is itself null, but not what to do in case individual elements of the array are null (or if the array is empty). I propose to ignore null elements and empty arrays (currently there would probably be NPEs in some cases).
4. The considerations for 1 & 3 above also apply to the PM.addInstanceLifecycleListener method (12.15).
5. We should make defensive copies of the 'classes' parameter as necessary to guard against subsequent modification of the elements.
6. Relevant test cases should also be contributed to the JDO TCK.