harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Beyer (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-6289) Inconsistent behaviour of ternary operator and types
Date Mon, 03 Aug 2009 02:53:14 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-6289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Nathan Beyer resolved HARMONY-6289.
-----------------------------------

    Resolution: Invalid
      Assignee: Nathan Beyer

I'm going to resolve this as invalid for now, but if you get information back that is to the
contrary, please reopen and post links to that information.

> 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<String, Object> functions;
>     public void setFunctionsBug(Map<String, Object> funcs) {
>         functions = funcs != null ? funcs : Collections.emptyMap();
>     }
>     public void setFunctionsOK(Map<String, Object> 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<capture#1-of ? extends Object,Object> to
Map<String,Object>
> 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.


Mime
View raw message