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

generics: forward referenced bounds vs separate compilation

XMLWordPrintable

    • hopper
    • generic
    • solaris_7
    • Not verified

        frog:~/workspaces/test/Generic5 $ rm *.class
        frog:~/workspaces/test/Generic5 $ cat -n T1.java
             1 class X<T> {}
             2 class T1<A extends X<B>, B> {}
        frog:~/workspaces/test/Generic5 $ cat -n T2.java
             1 class Z {}
             2 class Y extends X<Z> {}
             3 class T2 {
             4 T1<Y, Z> t1;
             5 }
        frog:~/workspaces/test/Generic5 $ newjavac -gj T1.java T2.java
        frog:~/workspaces/test/Generic5 $ newjavac -gj T2.java
        T2.java:4: cannot access T1
        bad class file: ./T1.class
        undeclared type variable: B
        Please remove or make sure it appears in the correct subdirectory of the classpath.
            T1<Y, Z> t1;
            ^
        1 error
        frog:~/workspaces/test/Generic5 $

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: