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

Confusing error message for method conflict

XMLWordPrintable

    • b21
    • generic
    • generic

      The error message for incompatible inherited methods doesn't account for the possibility that both methods could come from the same class. The message could be improved:

      InstanceClash.java:13: error: types Foo<String> and Foo<String> are incompatible; both define m(java.lang.String), but with unrelated return types
        interface I extends Foo<String> {}
        ^
      Here's the relevant source:

        public static interface Foo<S> {
          String m(String s);
          int m(S o);
        }

        interface I extends Foo<String> {}

            acobbs Archie Cobbs
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: