Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5103041

Regression: binary compatibility problem with java.sql.Timestamp.compareTo

    Details

    • Subcomponent:
    • Introduced In Build:
      rc
    • Introduced In Version:
      5.0
    • Resolved In Build:
      b59
    • CPU:
      generic, x86
    • OS:
      generic, linux, windows_xp
    • Verification:
      Verified

      Backports

        Description

        Just to make this concrete, here's a small program demonstrating the
        problem. Compile and run it, first against 1.4.2, then against
        1.5/5.0:

        import java.sql.Timestamp;
        import java.util.Date;

        public class Foo {
          public static void main(String[] args) {
            Date d = new Date();
            Timestamp ts = new Timestamp(d.getTime());
            System.out.println(ts.compareTo(d));
          }
        }

        Note that this a *binary compatibility problem*!! The overload
        resolution is the same in 1.4.2 and 1.5.0; in either case, it's
        compareTo(Date). With a 1.4.2 runtime, it dispatches to the version
        defined in java.util.Date, with a 1.5.0 runtime it dispatches to the
        version defined in java.sql.Timestamp, which promptly casts its
        argument to Timestamp (and blows up). This really feels like a P2 bug
        to me.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ahandasunw Amit Handa (Inactive)
                  Reporter:
                  ahe Peter Ahe
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: