Bug 42519

Summary: suboptimal solution computed by type constraints (refactoring)
Product: [Eclipse Project] JDT Reporter: Frank Tip <tip>
Component: UIAssignee: Adam Kiezun <akiezun>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: akiezun
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frank Tip CLA 2003-09-04 09:16:29 EDT
For the following example program:

public class Foo {
	public void bar(){
		java.util.Dictionary dd = new java.util.Hashtable();
		dd.put(new Object(), new Object());
		
	}
}

the computed type constraints include:
         [dd] <= Decl(Dictionary:put(Object, Object))
which leads us to believe that the type of variable dd must be a subtype
of Dictionary.

However, what could have been computed is the less restrictive:
          [dd] <= Decl(Dictionary:put(Object, Object)) OR
          [dd] <= Decl(Map:put(Object, Object))

This would allow greater flexibility in the "Generalize Type" refactoring
that I'm currently implementing. Specifically, we could have inferred that
type java.util.Map is also allowed for variable dd in this case.

  -Frank
Comment 1 Adam Kiezun CLA 2003-09-19 00:17:30 EDT
rootdef calculation bug?
Comment 2 Dirk Baeumer CLA 2003-10-20 10:05:07 EDT
Adam, are you looking at this ?
Comment 3 Adam Kiezun CLA 2003-10-20 12:05:54 EDT
i'm not right now but i will take it home and think about it