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 250756 - Static import hint produces invalid code
Summary: Static import hint produces invalid code
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
: 247045 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-02-27 09:14 UTC by Jiri Prox
Modified: 2015-04-23 02:10 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 Jiri Prox 2015-02-27 09:14:58 UTC
Convert class to static import hint produces invalid code.

Steps to reproduce:
1) enable static import hint (JDK Migration Support)
2) have a code:
public class NewClass {
    public static void main(String[] args) {
        String canonicalName = NewClass.class.getCanonicalName();
    }
}

-> hint is provided in this case
-> if applied:

public class NewClass {
    public static void main(String[] args) {
        String canonicalName = class.getCanonicalName();  // <--- invalid code
    }
}


Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 1
Java: 1.7.0_75; Java HotSpot(TM) 64-Bit Server VM 24.75-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_75-b13
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\8.0.2
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\8.0.2
Comment 1 Svata Dedic 2015-04-15 13:37:08 UTC
fixed in jet-main#b19cfd6fd4d8
Comment 2 Svata Dedic 2015-04-15 13:38:37 UTC
*** Bug 247045 has been marked as a duplicate of this bug. ***
Comment 3 Quality Engineering 2015-04-23 02:10:29 UTC
Integrated into 'main-silver', will be available in build *201504230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b19cfd6fd4d8
User: Svata Dedic <sdedic@netbeans.org>
Log: #250756: ignore .class, do not offer static import