Bug 42519 - suboptimal solution computed by type constraints (refactoring)
Summary: suboptimal solution computed by type constraints (refactoring)
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Adam Kiezun CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-04 09:16 EDT by Frank Tip CLA
Modified: 2003-10-20 12:05 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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