This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 159875 - guess better the used classes to do imports
Summary: guess better the used classes to do imports
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-08 19:46 UTC by ddv36a78
Modified: 2010-01-11 02:11 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ddv36a78 2009-03-08 19:46:27 UTC
Suppose I have 3 packages :
- x : class Image
- y : class Image + ImageProvider
- z : class Main

Class y.ImageProvider has the following method:

public static y.Image getImage() {
  doSomething();
  return ...;
}

So, class y.ImageProvider returns/uses the y.Image class, so the Image class of the same package.

Let's imagine, I define the following method into the z.Main class:

public static Image f() {
        return ImageProvider.getImage();
}

First, z.Main class has no import: several red underline markings appear for Image, and ImageProvider.

I first click on hint for ImageProvider and NetBeans introduces "import y.ImageProvider;"

Still remains a red underline for Image. NetBeans does not know if it is x.Image or y.Image class to use.

But as f() returns "ImageProvider.getImage();", NetBeans should be able to guess f() has the same return type as
getImage() method. So, NetBeans should be able to guess it's y.Image class to use.

It's an improvement that could help a lot. Just think, for example, about how many Action classes developers define into
different frameworks !
Having a better guessing algorithm could help a lot for programming.
Thanks.