Bug 577250 - java refactor fail and loses many changes
Summary: java refactor fail and loses many changes
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.21   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2021-11-14 20:33 EST by Dave Moten CLA
Modified: 2023-12-01 09:57 EST (History)
3 users (show)

See Also:


Attachments
error dialog preceding refactoring stuffup (18.65 KB, image/png)
2021-11-16 18:13 EST, Dave Moten CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Moten CLA 2021-11-14 20:33:18 EST
I have noticed this problem many times in the last couple of weeks and lost a lot of work in the process.

I'm using updated version of Eclipse 4.21 (latest updates available as of November 15 2021). 

Occasionally a refactor (field or method rename for instance) in java code fails for no apparent reason and the result of the code in the editor is old (many many changes have been rolled back). 

I lost a lot of work while bumping into this. I started committing to git before refactors so that if it happened I could do a "git checkout ." to get back the previous state. 

I have since found another workaround in that I could hold down Ctrl-Shift-Z to reapply all recent changes. I imagine this is a good hint to the cause.

I cannot reliably reproduce this but it hits me every 15 minutes or so in normal work (renaming stuff is a very common activity for me).
Comment 1 Dave Moten CLA 2021-11-14 20:37:07 EST
I just noticed that an error message like "refactoring failed because input does not exist" was reason for failure but also that when I reverted by holding down Ctrl-Shift-Z that the refactoring had succeeded (!).
Comment 2 Carsten Hammer CLA 2021-11-16 12:57:38 EST
I have seen similar things and suspect the undo stack gets broken somehow eg undoing a java file move/rename in some situations.
Comment 3 Dave Moten CLA 2021-11-16 18:13:37 EST
Created attachment 287533 [details]
error dialog preceding refactoring stuffup

On renaming a class I got this error dialog after which all recent changes were lost from the file I was working in.
Comment 4 Dave Moten CLA 2021-11-16 21:10:53 EST
Drives me insane this bug. I perform one class rename (a contained public static final class), save the file, then perform another in the same file (again a contained public static final class) and the refactor gets accepted but I lose the two refactors and more. All the time there are no compile errors.
Comment 5 Andrey Loskutov CLA 2021-11-17 00:59:51 EST
Can you please attach error log? Any specific steps to reproduce? Is this a regression in 4.21 or did it happen also before?
Comment 6 Dave Moten CLA 2021-11-17 03:20:15 EST
Nothing in the .metadata/.log pertaining to those refactoring problems.

I've restarted Eclipse and tried to reproduce but can't yet. It has happened after restarts though so I do expect to see it again.

Yes this is a regression, I've been happily refactoring my heart out for years. I think it's been happening since I applied updates on Oct 27. These are the JDT plugins that turned up Oct 27:

org.eclipse.jdt_3.18.900.v20210906-0500.jar
org.eclipse.jdt.apt.ui_3.7.0.v20210620-1751.jar
org.eclipse.jdt.apt.pluggable.core_1.3.0.v20210618-1653.jar
org.eclipse.jdt.compiler.tool_1.3.0.v20210726-1148.jar
org.eclipse.jdt.apt.core_3.7.0.v20210623-1209.jar
org.eclipse.jdt.compiler.apt_1.4.0.v20210708-0430.jar
org.eclipse.jdt.core.formatterapp_1.1.0.v20210618-1653.jar
org.eclipse.jdt.core_3.27.0.v20210823-1758.jar
org.eclipse.jdt.debug.ui_3.12.400.v20210816-1720.jar
org.eclipse.jdt.junit_3.13.0.v20210811-0812.jar
org.eclipse.jdt.junit.core_3.11.0.v20210629-0111.jar
org.eclipse.jdt.core.manipulation_1.15.0.v20210812-1539.jar
org.eclipse.jdt.junit.runtime_3.6.100.v20210708-1502.jar
org.eclipse.jdt.debug_3.18.0.v20210816-1805
org.eclipse.jdt.launching_3.19.300.v20210815-1119.jar
org.eclipse.jdt.ui_3.24.0.v20210823-0647.jar
org.eclipse.m2e.jdt_1.18.1.20210618-1338.jar
org.eclipse.jdt.doc.user_3.15.1200.v20210901-0815.jar
Comment 7 Eclipse Genie CLA 2023-12-01 09:57:39 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.