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 270816 - Can't refactor - introduce variable if it starts with a reserved word
Summary: Can't refactor - introduce variable if it starts with a reserved word
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.2
Hardware: PC Windows 10
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-06 14:12 UTC by peterhull90
Modified: 2017-07-30 01:57 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 peterhull90 2017-06-06 14:12:56 UTC
Product Version = NetBeans IDE 8.2 (Build 201609300101)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_101
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.101-b13

Reproducibility: Happens every time

STEPS:
  * Edit a java project
  * Select a subexpression
  * Choose Refactor | Introduce | Variable (ALT+SHIFT+V)
  * Begin typing a variable name like "newvalue" or "intake"
  * Get as far as a reserved word like "new" or "int"

ACTUAL:
     red alert appears "name is not a valid java identifier" and OK button is disabled, but subsequent typing does not re-enable the OK button.  


EXPECTED:
    Subsequent typing re-enables the OK button and  new variable can introduced

Workaround: introduce it with another name and Refactor - Rename it to the desired name.

Example code:

package javaapplication25;

public class JavaApplication25 {
    public static void main(String[] args) {
       double z = (2.0+(2.0 * 3.0));
    }
    
}

Select '(2.0 * 3.0)' and press ALT+SHIFT+V.
Comment 1 Svata Dedic 2017-07-28 14:54:50 UTC
Fixed by jet-main#e971078c3a76
Comment 2 Quality Engineering 2017-07-30 01:57:14 UTC
Integrated into 'main-silver', will be available in build *201707300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e971078c3a76
User: Svata Dedic <sdedic@netbeans.org>
Log: #270816: panel must listen on name validator support for OK enablement