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

Compiler binds base class incorrectly (shortcoming of base circularity spec)

    Details

    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      1.6.0_18

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Enterprise 64-bit

      A DESCRIPTION OF THE PROBLEM :
      Javac (any version) compiles the attached code without error, but when Main is run it prints "X.Q" instead of "A<T>.X.Q" as required by the language specification. I think this is really a shortcoming of the specification for circular class declarations, but demonstrating my point is easier if I just start by reporting it as a compiler bug.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run attached program

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A<T>.X.Q

      -or-

      Compilation error complaining about base class circularity.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      class A<T> {
        static class X {
          static class Q {
            public static void main() {
              System.out.println("A<T>.X.Q");
            }
          }
        }
      }

      class B extends A<B.Y.Q> {
        static class Y extends X { } // X here is inherited from A
      }

      class X {
        static class Q {
          public static void main() {
            System.out.println("X.Q");
          }
        }
      }

      class Main {
        public static void main(String[] args) {
          B.Y.Q.main();
        }
      }

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: