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

Confusing error message from javac when overriding a method from a raw supertype

    Details

    • Subcomponent:
    • Resolved In Build:
      b11
    • CPU:
      x86
    • OS:
      linux

      Description

      When a class extends a raw superclass, and overrides a method from it, the compiler issues a confusing error message. Example:

      class A<T> {
          void foo(Clazz<?> clazz) { ... }
      }

      class B extends A /* raw A here */ {
          @Override
          void foo(Clazz<?> clazz) { ... }
      }

      The error message is:
      error: name clash: run(Class<?>) in A and run(Class<?>) in B have the same erasure, yet neither overrides the other

      What is happening is that when you extend a raw type, the method descriptors are erased; at least the message should say run(Class<?>) and run(Class) to make it clear that erasure is the problem.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                briangoetz Brian Goetz
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: