From commits-return-59667-apmail-harmony-commits-archive=harmony.apache.org@harmony.apache.org Tue Aug 04 02:32:34 2009 Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 42807 invoked from network); 4 Aug 2009 02:32:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Aug 2009 02:32:34 -0000 Received: (qmail 68884 invoked by uid 500); 4 Aug 2009 02:32:39 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 68824 invoked by uid 500); 4 Aug 2009 02:32: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 68813 invoked by uid 99); 4 Aug 2009 02:32:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Aug 2009 02:32:39 +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; Tue, 04 Aug 2009 02:32:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C841C234C045 for ; Mon, 3 Aug 2009 19:32:14 -0700 (PDT) Message-ID: <2111854382.1249353134805.JavaMail.jira@brutus> Date: Mon, 3 Aug 2009 19:32:14 -0700 (PDT) From: "Nathan Beyer (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-6289) Inconsistent behaviour of ternary operator and types In-Reply-To: <458124373.1249222754796.JavaMail.jira@brutus> 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 [ https://issues.apache.org/jira/browse/HARMONY-6289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738767#action_12738767 ] Nathan Beyer commented on HARMONY-6289: --------------------------------------- Sorry ... I was typing it from memory. > 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 > Assignee: Nathan Beyer > > 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.