From commits-return-59652-apmail-harmony-commits-archive=harmony.apache.org@harmony.apache.org Sun Aug 02 15:19:35 2009 Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 55552 invoked from network); 2 Aug 2009 15:19:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Aug 2009 15:19:35 -0000 Received: (qmail 20835 invoked by uid 500); 2 Aug 2009 14:19:39 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 20780 invoked by uid 500); 2 Aug 2009 14:19:39 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 20771 invoked by uid 99); 2 Aug 2009 14:19:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Aug 2009 14:19:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Aug 2009 14:19:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C3A19234C046 for ; Sun, 2 Aug 2009 07:19:14 -0700 (PDT) Message-ID: <458124373.1249222754796.JavaMail.jira@brutus> Date: Sun, 2 Aug 2009 07:19:14 -0700 (PDT) From: "Sebb (JIRA)" To: commits@harmony.apache.org Subject: [jira] Created: (HARMONY-6289) Inconsistent behaviour of ternary operator and types MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Inconsistent behaviour of ternary operator and types ---------------------------------------------------- Key: HARMONY-6289 URL: https://issues.apache.org/jira/browse/HARMONY-6289 Project: Harmony Issue Type: Bug Components: JDK Affects Versions: 5.0M10 Environment: Eclipse Java Compiler 0.894_R34x, 3.4.2 release, Copyright IBM Corp 2000, 2008. All rights reserved. WinXP/SP3 Reporter: Sebb Compile the following class using: javac -5 TernaryType.java ==== cut here ==== import java.util.*; class TernaryType { Map functions; public void setFunctionsBug(Map funcs) { functions = funcs != null ? funcs : Collections.emptyMap(); } public void setFunctionsOK(Map funcs) { if (funcs != null) { functions = funcs; } else { functions = Collections.emptyMap(); } } } === cut here === Compiler output is: 1. ERROR in TernaryType.java (at line 8) functions = funcs != null ? funcs : Collections.emptyMap(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type mismatch: cannot convert from Map to Map The two methods have exactly the same behaviour, yet only the ternary version generates an error. Note that the Sun 1.5 and 1.6 compilers behave the same way, but it still seems like a bug to me. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.