You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you try to extract the body of the loop to a new method, you get
This is a wrong conclusion since the local variables are local to the extracted method, and cease to exist at the end of that body. If the code performs continue, I would hope the local oldRules and newSuffixes variables are also created from scratch again, but even if they don't, they are initialized in the declaration after the continue, so any old data in them would be destroyed.
The text was updated successfully, but these errors were encountered:
- fix ExtractMethodAnalyzer.computeOutput() method to add a check
for local variables that have been added to the returnValues list
but the declaration and all references are within the selected
region
- add new test to ExtractMethodTests
- fixeseclipse-jdt#1292
jjohnstn
added a commit
to jjohnstn/eclipse.jdt.ui-1
that referenced
this issue
May 22, 2024
- fix ExtractMethodAnalyzer.computeOutput() method to add a check
for local variables that have been added to the returnValues list
but the declaration and all references are within the selected
region
- add new test to ExtractMethodTests
- fixeseclipse-jdt#1292
This is the 2nd refactor bug in the same original code as #1291 after working around the first refusal.
Encountered in Eclipse 2023-03, and confirmed in 2024-03. It seems related to my previous bug report #671 except that was in
while
context.I assumed the cause for both bugs are different, so I simplified the original code independent from what I did in #1291. That lead to
When you try to extract the body of the loop to a new method, you get
This is a wrong conclusion since the local variables are local to the extracted method, and cease to exist at the end of that body. If the code performs
continue
, I would hope the localoldRules
andnewSuffixes
variables are also created from scratch again, but even if they don't, they are initialized in the declaration after thecontinue
, so any old data in them would be destroyed.The text was updated successfully, but these errors were encountered: