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 268312 - [82cat] Undo of local variable refactoring incorrect cursor position if an import is added
Summary: [82cat] Undo of local variable refactoring incorrect cursor position if an im...
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2016-10-02 19:48 UTC by mclaborn
Modified: 2016-10-17 18:00 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

IDE log (547.82 KB, text/plain)
2016-10-02 19:49 UTC, mclaborn

Note You need to log in before you can comment on or make changes to this bug.
Description mclaborn 2016-10-02 19:48:58 UTC
Product Version = NetBeans IDE 8.2 (Build 201609300101)
Operating System = Linux version 4.4.0-38-generic running on amd64
Java; VM; Vendor = 1.8.0_102
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.102-b14

Reproducibility: Happens every time

When I do an introduce local variable refactoring that adds an import statement (I assumed it infers the needed import from the method return) and then immediately undo (ctrl + z), the cursor after the undo is positioned in the imports section of the document instead of at the point of the refactor and undo. In a larger class, this also moves the window position in the document so that the line in question is not in view. 

STEPS: (see test case code below)
  * select code: url.openConnection()
  * Invoke refactoring introduce local variable with your choice of new variable name
  * Invoke undo

  Cursor is positioned at the top of the file, after the line: import;

  Code that is selected, and cursor position, should return to what they were before the refactoring. 

Source for test case.


public class AAAA {
  private void test() throws Exception {
    URL url = new URL("test");
Comment 1 mclaborn 2016-10-02 19:49:02 UTC
Created attachment 162308 [details]
IDE log