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 252953 - Fix import does not provided for static method
Summary: Fix import does not provided for static method
Status: RESOLVED 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-06-12 11:38 UTC by Jiri Prox
Modified: 2015-09-30 01:19 UTC (History)
0 users

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 Jiri Prox 2015-06-12 11:38:16 UTC
Fix import hint is not provided for static method if the expression is used at the right side of assignment.

Steps to reproduce:
1) have a code:
valueOf(12);

-> hint is provided, suggesting several java.lang.String.valueOf(...) methods

2) change to code to 
String valueOf = valueOf(12);

-> no hint is provided

It must be some name conflict since for 
String x = valueOf(12);
it works fine


Product Version: NetBeans Dev JDK9 branch (Build 201506120405)
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; Cp1252; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev-jdk9-branch
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev-jdk9-branch
Comment 1 Svata Dedic 2015-07-29 06:51:49 UTC
JDK9 specific, works OK (CC offers many valueOfs for case (2)) in trunk.
Comment 2 Svata Dedic 2015-09-25 11:51:45 UTC
My bad, I've made a typo when testing, so I wasn't testing `valueOf' variable. Sorry.

The code contained check for same-named elements in the current scope; however, for a method call, it also considered same-named field as a conflict - but fields, methods and classes have different namespaces.
I relaxed the check a little.

Fixed in jet-main#b4b1cc6ba717
Comment 3 Quality Engineering 2015-09-30 01:19:58 UTC
Integrated into 'main-silver', will be available in build *201509300002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b4b1cc6ba717
User: Svata Dedic <sdedic@netbeans.org>
Log: #252953: allowed to import methods if field of same name is in scope. Fixed defect when using FQN for a method (whole signature was inserted, not just FQN)