Return type consideration when asking for imports?

Hi everyone.

Does anybody know how to teach IntelliJ to consider the return type when asking for a class to import?

Example:


public class MyClass {


    private static final Log LOG = LogFactory.getLog(MyClass.class);



    ...

 
}

At first I'll let IDEA import the LogFactory class which is part of the commons-logging framework. After successfully importing the LogFactory class, IDEA still thinks Log is ambigous - but it's not. There's nothing in the classpath that would match the required return type of LogFactory. It seems that IDEA is not considering the return type when suggesting imports for a class.

Is there any way to enable this feature (if it exists)?

Thanks in advance!

2 comments
Comment actions Permalink

Hello Thorsten,

I don't think this feature exists.

Does anybody know how to teach IntelliJ to consider the return type
when asking for a class to import?

Example:

public class MyClass {

private static final Log LOG = LogFactory.getLog(MyClass.class);

...

}

At first I'll let IDEA import the LogFactory class which is part of
the commons-logging framework. After successfully importing the
LogFactory class, IDEA still thinks Log is ambigous - but it's not.
There's nothing in the classpath that would match the required return
type of LogFactory. It seems that IDEA is not considering the return
type when suggesting imports for a class.

Is there any way to enable this feature (if it exists)?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hello Thorsten,

I don't think this feature exists.


Ouch ... too bad - I'd really like that feature ;)

0

Please sign in to leave a comment.