Bug 337751 - COMPILER_PB_UNAVOIDABLE_GENERIC_TYPE_PROBLEMS misses references in conditional expression
Summary: COMPILER_PB_UNAVOIDABLE_GENERIC_TYPE_PROBLEMS misses references in conditiona...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-21 13:44 EST by Markus Keller CLA
Modified: 2011-05-03 06:07 EDT (History)
2 users (show)

See Also:


Attachments
Patch under consideration (1.03 KB, patch)
2011-03-14 10:58 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-02-21 13:44:52 EST
HEAD, follow-up to bug 322817

The JavaCore.COMPILER_PB_UNAVOIDABLE_GENERIC_TYPE_PROBLEMS option misses references in conditional expressions.

In the example below, generifying Project#getOptions() gets rid of the type safety warning, and the compiler option should also hide it.


package problems;
import java.util.Map;

public class Project {
    //raw return type (assume in 1.4 code)
    public Map/*<String, String>*/ getOptions(boolean b) {
        return null;
    }
}

package problems;
import java.util.Map;

public class GenericConditional {
    void foo(Project project) {
        // Bad warning: "Type safety: The expression of type Map needs
        //    unchecked conversion to conform to Map<String,String>"
        Map<String, String> options=
                        project != null ? project.getOptions(true) : null;
        System.out.println(options);
    }
}
Comment 1 Ayushman Jain CLA 2011-02-21 14:34:06 EST
Srikanth, please investigate. Thanks!
Comment 2 Srikanth Sankaran CLA 2011-03-14 10:58:35 EDT
Created attachment 191125 [details]
Patch under consideration
Comment 3 Srikanth Sankaran CLA 2011-03-15 01:46:39 EDT
Added regression tests
org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest.test337751
org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest.test337751a

Released in HEAD for 3.7 M7
Comment 4 Jay Arthanareeswaran CLA 2011-04-25 04:56:52 EDT
Verified for 3.7M7 using build I20110421-1800
Comment 5 Ayushman Jain CLA 2011-05-03 06:07:00 EDT
Verified for 3.7RC0 using I20110428-0845