netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Renaming class with the `Rename Also File With the Declaration` option ends with an error

Open r-man opened this issue 3 years ago • 2 comments

Apache NetBeans version

Apache NetBeans 15

What happened

When I try to rename the class name and the file, NB first renames the file and then gives me the error "File seems no longer valid!"

How to reproduce

  1. Create php class
  2. Try rename class name
  3. In rename dialog check Rename Also File With the Declaration option

Did this work correctly in an earlier version?

Apache NetBeans 14

Operating System

windows 11 pro

JDK

Java: 18.0.1; Java HotSpot(TM) 64-Bit Server VM 18.0.1+10-24

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

r-man avatar Sep 11 '22 03:09 r-man

Confirmed still happens. Hard to isolate. Sometimes happens, sometimes not. Mostly for newly created classes, not yet referenced from other files.

The issue dissapears once the "reference" gets created. For example:

$o = new myclass(); $o->some_method();

Then click some_method and use navigate to the declaration. Since then, the myclass file can be refactored without issues.

--

Also after the issue occurs, there still appears the old file (before rename) in the list of files (sorry cannot recall where ATM) but it disappears from the above list after netbeans close-open. The point is, the issue leaves the reference of the old file somewhere until app restart.

Daniel-Peder avatar Feb 03 '23 17:02 Daniel-Peder

I can't reproduce it.

Product Version: Apache NetBeans IDE 20
Java: 19.0.2; OpenJDK 64-Bit Server VM 19.0.2+7-Ubuntu-0ubuntu322.04
Runtime: OpenJDK Runtime Environment 19.0.2+7-Ubuntu-0ubuntu322.04
System: Linux version 6.5.0-17-generic running on amd64; UTF-8;

junichi11 avatar Feb 14 '24 05:02 junichi11

I can't reproduce it.

Product Version: Apache NetBeans IDE 20
Java: 19.0.2; OpenJDK 64-Bit Server VM 19.0.2+7-Ubuntu-0ubuntu322.04
Runtime: OpenJDK Runtime Environment 19.0.2+7-Ubuntu-0ubuntu322.04
System: Linux version 6.5.0-17-generic running on amd64; UTF-8;

yes, as said before, sometimes happens, sometimes not, not sure but seems to be related to the size of project or number of project files

Product Version: Apache NetBeans IDE 21
Java: 11.0.22; OpenJDK 64-Bit Server VM 11.0.22+7-post-Ubuntu-0ubuntu220.04.1
Runtime: OpenJDK Runtime Environment 11.0.22+7-post-Ubuntu-0ubuntu220.04.1
System: Linux version 5.4.0-173-generic running on amd64; UTF-8; en_US (nb)

Daniel-Peder avatar Mar 20 '24 09:03 Daniel-Peder