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

Name clash

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u40
    • tools
    • b89
    • x86_64
    • windows_7
    • Verified

        FULL PRODUCT VERSION :
        java version "1.8.0_40"
        Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
        Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        A DESCRIPTION OF THE PROBLEM :
        Getting compile error

        C.java:2: error: name clash: m() in A1 and m() in B1 have the same erasure, yet neither overrides the other
        public abstract class C extends A2 implements B2 {

        for the following class/interface constellation :

        public interface A1 {
            A1 m();
        }
        public abstract class A2 implements A1 {
            public abstract A2 m();
        }
        public interface B1 {
            A1 m();
        }
        public interface B2 extends B1 {
            A2 m();
        }
        public abstract class C extends A2 implements B2 {
        }


        ADDITIONAL REGRESSION INFORMATION:
        java version "1.8.0_40"
        Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
        Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compiling the above classes / interfaces

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        compile without any errors
        ACTUAL -
        C.java:2: error: name clash: m() in A1 and m() in B1 have the same erasure, yet neither overrides the other
        public abstract class C extends A2 implements B2 {


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        C.java:2: error: name clash: m() in A1 and m() in B1 have the same erasure, yet neither overrides the other
        public abstract class C extends A2 implements B2 {


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public interface A1 {
        A1 m();
        }
        public abstract class A2 implements A1 {
        public abstract A2 m();
        }
        public interface B1 {
        A1 m();
        }
        public interface B2 extends B1 {
        A2 m();
        }
        public abstract class C extends A2 implements B2 {
        }

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

        CUSTOMER SUBMITTED WORKAROUND :
        public abstract class C extends A2 implements B2 {
        public abstract A2 m();
        }


              sadayapalam Srikanth Adayapalam (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: