Diamod operator causes an unexpected compilation error

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: 7
    • Component/s: tools
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0_01"
      Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
      Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Let's take class javax.xml.ws.Holder<T> for example.

      This code compiles without error:
      Holder<Object> holder = new Holder<Object>("abc");

      If we turn to use the diamond operator:
      Holder<Object> holder = new Holder<>("abc");

      Compilation fails with the following erro message:
      Uncompilable source code - incompatible types
        required: javax.xml.ws.Holder<java.lang.Object>
        found: javax.xml.ws.Holder<java.lang.String>


      REPRODUCIBILITY :
      This bug can be reproduced always.

            Assignee:
            Maurizio Cimadamore
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: