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

Partial subst broken

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      5.0
    • Introduced In Version:
      5.0
    • CPU:
      generic
    • OS:
      generic

      Description

      $ cat -n Subst.java
           1 class A<T> {
           2 class B {
           3 T returnT() { return null; }
           4 Object returnU() { return null; }
           5 }
           6 }
      $ cat -n Subst2.java
           1 class A<T> {
           2 class B<U> {
           3 T returnT() { return null; }
           4 U returnU() { return null; }
           5 }
           6 }
      $ cat -n X.java
           1 class X {
           2 A<String>.B y;
           3 }
      $ cat -n Y.java
           1 class Y {
           2 X x;
           3 void foo() {
           4 String s = x.y.returnU();
           5 }
           6 public static void main(String... args) {
           7 }
           8 }

      Now compile like this:

      $ rm *.class
      $ javac -sourcepath /xyyz Subst.java X.java Y.java
      Y.java:4: incompatible types
      found : java.lang.Object
      required: java.lang.String
              String s = x.y.returnU();
                                    ^
      1 error
      $ javac -sourcepath /xyyz Subst2.java Y.java

      The last command succeeds indicating that the type variable U got the type String.

      ###@###.### 2004-11-18 05:34:50 GMT

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ahe Peter Ahe
              Reporter:
              ahe Peter Ahe
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: