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

Importing an inherited type doesn't work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P5
    • None
    • 1.4.0
    • tools
    • generic
    • solaris_7

    Description

      The following legal program fails to compile. See also 4209853

      frog$ cat -n test/A.java
           1 package test;
           2
           3 // Import all the members of X, included inherited members
           4
           5 import test.X.*;
           6
           7
           8 class A
           9 {
          10 public class B
          11 {
          12 }
          13 }
          14
          15 class X extends A
          16 {
          17 // X inherits a class B
          18 }
          19
          20 class C
          21 {
          22 B b; // class B is visible from here because of the import
          23 }
          24
      frog$ newjavac test/A.java
      + /home/gafter/workspaces/gjc-1.4-neal/build/solaris-sparc/bin/java -Xbootclasspath/p:/home/gafter/workspaces/gjc-1.4-neal/gjclasses2 -classpath /home/gafter/workspaces/gjc-1.4-neal/gjclasses2:/home/gafter/workspaces/gjc-1.4-neal/make/tools/javac/gjc.jar:/home/gafter/workspaces/gjc-1.4-neal/make/tools/javac/gjcmain.jar com.sun.tools.javac.Main test/A.java
      test/A.java:22: cannot resolve symbol
      symbol : class B
      location: class test.C
          B b; // class B is visible from here because of the import
          ^
      1 error

      Attachments

        Issue Links

          Activity

            People

              gafter Neal Gafter
              gafter Neal Gafter
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: