The ObjectInputStream.GetField.get(name, object) method was changed to throw a ClassNotFoundException

This rule flags the use of the get(String name, Object val) method in java.io.ObjectInputStream.GetField.

The signature of ObjectInputStream.GetField.get(name, val) has been updated to throw a ClassNotFoundException. Previously, null was returned, which prevented the caller from correctly handling the case where the class was not found. To revert to the old behavior, a system property, jdk.serialGetFieldCnfeReturnsNull, has been added to the implementation. Setting the value to true reverts to the old behavior (returning null) and leaving it unset or to any other value results in the throwing of ClassNotFoundException.

For more information see JDK-8276665. JDK-8273660.