[BZ-1072629] fix compilation issue when using a class extending java.util.Date
(cherry picked from commit 36c5478d3f506ae1aef637d5842a7d89fdaa6cbb)