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

Usage of diamond notation with ?: conditional operator

XMLWordPrintable

    • x86
    • linux, windows_7

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: