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

Usage of diamond notation with ?: conditional operator

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux, windows_7

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      The javac compiler can't handle the usage of diamond notation <> with ?: conditional operator.

      The following code:
      List<String> list = false ? null : new ArrayList<>();
      doesn't compile with error:
       incompatible types
       required: List<String>
       found: ArrayList<Object>


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: