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

JDK 1.2 Beta3 - javac handles inheritence incorrectly

XMLWordPrintable

    • 1.2fcs
    • generic
    • solaris_2.5.1
    • Not verified

      I believe javac handles the following code incorrectly:

      // file: tmp/temp.java
      package tmp;

      class tempBase {

          void anotherMethod () { }
      }

      public class temp extends tempBase { }

      class bottom extends tmp.pack1.temp
        {
          void myMethod ()
           {
           anotherMethod ();
           }

          public static void main (String [] argv) {
              bottom o_temp = new bottom ();
              o_temp.myMethod ();
          }
        }


      //file: tmp/pack1/temp.java
      package tmp.pack1;

      public class temp extends tmp.temp {
       }

      I believe bottom should not inherit anotherMethod because a class only
      inherits from its direct supertypes, and therefore should not inherit any
      methods that the super type does not have access to.

            tturnidgsunw Todd Turnidge (Inactive)
            jbenoit Jonathan Benoit (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: