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 252315 - No hint to add a static import of method used with many signatures
Summary: No hint to add a static import of method used with many signatures
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-09 08:10 UTC by cezariusz
Modified: 2015-07-27 08:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cezariusz 2015-05-09 08:10:09 UTC
Product Version: NetBeans IDE Dev (Build 201505020001)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14
System: Windows 7 version 6.1 running on amd64; UTF-8; pl_PL (nb)

If a method with different signatures is used in a code, a hint to add a static import is not available.

Testcase:

public class SampleTest {

    public void testToString() {
        String exp = "";
        String result = toString();
        assertEquals(exp, result);
    }

    public void testDouble() {
        double exp = 0.0;
        double result = 0.0;
        assertEquals(exp, result, 0.0);
    }

}

Try to call hint at any of "assertEquals" - you will be offered only to create method. Now remove any of "assertEquals" and call hint at the other - you will be offered to add imports.

You may wonder why I didn't add import right after writing the first assertEquals - in this case the code with missing imports is an effect of bug 252173. But it could come from a simple copy-paste as well. It took me a while to find the reason and a reproducible testcase.
Comment 1 Jiri Prox 2015-05-11 08:40:11 UTC
reproducible
Comment 2 Svata Dedic 2015-05-25 13:59:55 UTC
Should be fixed by jet-main#c6a2e93402a0
Comment 3 Quality Engineering 2015-06-05 02:40:00 UTC
Integrated into 'main-silver', will be available in build *201506050001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/be3c03873125
User: Svata Dedic <sdedic@netbeans.org>
Log: #252315: implemented import of overloaded method symbol
Comment 4 cezariusz 2015-07-27 08:41:44 UTC
Verified with Build 201507240001.