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

Diamod operator causes an unexpected compilation error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 7
    • 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.

            mcimadamore Maurizio Cimadamore
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: