get parameters autogenerated for a method invocation

Hi,

I can't get parameters autogenerated for a method invocation. Can't believe this is impossible with idea. To make it clear, consider:


class A {
  public void method1(String xxx){
          ...
  }
}

class B{
  public void someMethod(){
      A a = new A();
      a.method1(  //<  and here I want Idea to fill in method parameters and declare local variable for them. Eclipse can perfrectly do this.
  }
}




Best regards, Eugene.

8 comments
Comment actions Permalink

You can use smart type completion (Ctrl-Shift-Space) to complete variables of approriate type. There is no shortcut to put in a non-existing variable and to declare it above, because we never found it to be a useful scenario.

0
Comment actions Permalink

that's pity. Free your mind :) This can be really cool feature.

0
Comment actions Permalink

Could you please describe in more detail the situations where you find it useful?

0
Comment actions Permalink

Whenever you know what method to call but don't yet know or remember what is needed to call it. The most evident case is a test case method, ususaly I start code it with calling a method under test (or generating it), at this time there are no variables to be inserted into params. If there is an appropiate variable, IDE should suggest it, if there is no one - it should offer to create it. Now Idea does almost all this except autogenerating variable names for missing params and I have to type it, which is annoying, and then press Alt+Enter. Try it in Eclipse, it's a bit askew there, as usually, but does the job.

Best regards, Eugene.

0
Comment actions Permalink

The main thing I don't understand in your explanation is why you need a variable to pass a value to a method you're going to call.

0
Comment actions Permalink

Or, in a more general way, such feature is usefull when you're used to code weaving contexts around the methods being called rather than creating contexts first and then calling methods.

0
Comment actions Permalink

well, yes, it shouldn't always be a variable, and yes, I know, local variables are evil (Martin F.) but something you still need them.

0
Comment actions Permalink

and it's not just about local variable. With Alt+Enter I can creating instance memeber to. I just whant too avoid typing its name and have it derived from method param.

0

Please sign in to leave a comment.