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

(inference) underconstrained type variable cannot be dereferenced

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 5.0
    • tools
    • generic
    • solaris_8

    Description

      The following program is correct but rejected by javac:

      X.java:3: X cannot be dereferenced
             String s = new X().foo().bar();
                        ^

      /////////////////////////////////////////
      public class X {
         public static void main(String[] args) {
             String s = new X().foo().bar();
         }
         <V extends X> V foo() {
             return null;
           }
         String bar() {
             return "";
         }
      }

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: