Create local variable & list of suggested classes : what rule is used ?

On the code below (notice : no imports !),



, if you accept the "create a local variable" intention, IDEA will offer
you dozens of classes, but no "JFrame".
If you type "J", IDEA will refine the list to

JarIndex
JMenu
JMenuBar
JobStateReasons
JPopupMenu
JTabbedPane
JToolbar

What rule does IDEA use to choose the classes in the list?

Alain

5 comments

I guess JFrame does not have add method.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Alain Ravet" <alain.ravet.list@wanadoo.be> wrote in message
news:bo5hrf$9tt$1@is.intellij.net...

On the code below (notice : no imports !),

>
>

     package spike ;
>     public class Foo1
>     {
>         public void foo ( )
>         {
>             fra|me.add ( panel );
>         }
>     }
> ]]>

>
>

, if you accept the "create a local variable" intention, IDEA will offer
you dozens of classes, but no "JFrame".
If you type "J", IDEA will refine the list to

>

JarIndex
JMenu
JMenuBar
JobStateReasons
JPopupMenu
JTabbedPane
JToolbar

>

What rule does IDEA use to choose the classes in the list?

>

Alain

>


0

Maxim Shafirov (JetBrains) wrote:

>I guess JFrame does not have add method.

>

It inherits one from Container.

Alain



0

Then please file a bug request:))

"Alain Ravet" <alain.ravet.list@wanadoo.be> wrote in message
news:bo5sjk$s3c$1@is.intellij.net...

Maxim Shafirov (JetBrains) wrote:

>

>I guess JFrame does not have add method.
>
>

>

It inherits one from Container.

>

Alain

>
>
>


0

Evgueny Vigdorchik wrote:

>Then please file a bug request:))

>

I first want to be sure it's not done the current way by design, as you
could argue that with a broader rule, some cases - e.g. toString() -
could make the list explode, in the absence of additional filter.

What do you think?

Alain

0

I think that only one instance of each toString() signature should be
offered (That will default to Object
anyway if no other hint is given, but may result in some sensible
suggestion if you have other method call
with that invalid qualifier).

Indeed current behaviour was once done by design since I thought it would be
too expensive to search for candidate
methods in base classes. However since that time the design has changed, so
now it is simply a bug.

"Alain Ravet" <alain.ravet.list@wanadoo.be> wrote in message
news:bo60vc$uvd$1@is.intellij.net...

Evgueny Vigdorchik wrote:

>

>Then please file a bug request:))
>
>

>

I first want to be sure it's not done the current way by design, as you
could argue that with a broader rule, some cases - e.g. toString() -
could make the list explode, in the absence of additional filter.

>

What do you think?

>

Alain

>


0

Please sign in to leave a comment.