I agree, but I guess IDEA could guess the type to use (It can provide the choice as well). Right now it guesses the type by the "Expression return type" (ERT)  if, instead, it would use "Expected type" (ET) - that is, type required by context of expression that would do the trick. That would work as a good first suggestion. The full choice would be the list of all classes from ERT to ET in the inheritance chain.
 
for example if you have:
 
Collections.synchronizedCollection(new Vector())
 
 
highlight "new Vector()" and do introduce variable. The good first guess would be:
 
Collection coll = new Vector();
 
the full choice would be: Collection, List, AbstractCollection, AbstractList, Vector

--
fedor.

----
In Corning, Iowa, it's a misdemeanor for a man to ask his wife to ride
in any motor vehicle.

-----Original Message-----
From: Alain Ravet [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 2:48 AM
To: [EMAIL PROTECTED]
Subject: [Eap-features] introduce variable : encourage use of interface

When using "Introduce Variable" on  
    .
    new ArrayList ();
 
you get
 
   ArrayList arrayList = new ArrayList ();
 
 
Most of the time, though, you should use
   .
   List arrayList = new ArrayList ();
 
 
 
"Introduce Variable" should allow the user to choose it's target type.
 
   
Alain Ravet

Reply via email to