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

another compatibility problem with java.io.File

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b56
    • CPU:
      generic
    • OS:
      solaris_8

      Description

      From http://forum.java.sun.com/thread.jsp?forum=316&thread=527393&tstart=0&trange=50

      Compile the following code with 1.4.2_04:

      import java.io.File;

      public class Over15A extends File {
      public Over15A(String s) { super(s); }
      public int compareTo(File file) { return 0; }
      public int compareTo(Object o) { return 0; }
      }



      and try to compile the following code with 1.5-beta2:


      public class Over15B extends Over15A {
      public Over15B(String s) { super(s); }
      }



      Error is:

      Over15B.java:1: name clash: compareTo(java.lang.Object) in Over15A and compareTo(T)
      in java.lang.Comparable<java.io.File> have the same erasure, yet neither overrides the other

      File class is a key, because in 1.5 it is defined like this: "File implements Comparable<File>"

        Attachments

          Activity

            People

            • Assignee:
              gafter Neal Gafter
              Reporter:
              gafter Neal Gafter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: