JDK-8050494 : OptimisticTypesPersistence should use java.util.Date, not java.sql.Date
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u40
  • Priority: P2
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2014-07-15
  • Updated: 2016-01-06
  • Resolved: 2014-07-17
Related Reports
Duplicate :  
Relates :  
Description
The change for JDK-8046921 introduced a new utility class, OptimisticTypesPersistence, that makes use of a type in java.sql, java.sql.Date. This would appear to be a mistake, most likely by the IDE when automatically adding the import statements.  I suspect that it should be "import java.util.Date".

Snippets below show the affected code, in OptimisticTypesPersistence.java:

    import java.sql.Date;
    ....

    private static String getVersionDirName() throws Exception {
         ....
         return "dev-" + new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date(getLastModifiedClassFile(dir, 0L)));
        ....
    } 


This issue causes problems for modularity, as it creates a new dependency on a type in java.sql.
Comments
Duplicate of JDK-8050964
17-07-2014