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

Invalid compiler error on covariant overriding methods with the same erasure

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 7
    • tools
    • b134
    • x86
    • linux
    • Verified

      FULL PRODUCT VERSION :
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b130)
      Java HotSpot(TM) Server VM (build 21.0-b02, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      Attached source code does not compile

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to compile the attached source code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The code should compile
      ACTUAL -
      The code does not compile.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      name clash: <T>clone() in JavacBug and clone() in Superclass have the same erasure, yet neither overrides the other

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package bugs;

      public abstract class JavacBug extends Superclass
      {
      abstract <T extends JavacBug> T clone () throws CloneNotSupportedException;
      }

      class Superclass
      {
      @Override
      public Superclass clone () throws CloneNotSupportedException
      {
      return (Superclass) super.clone ();
      }
      }

      ---------- END SOURCE ----------

            mcimadamore Maurizio Cimadamore
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: