Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#553 Refactoring local variable is incorrect.

1.3.8
closed-fixed
Editor (491)
5
2007-09-05
2007-08-20
Brian DeWeese
No

Refactoring local variables at one time worked for me but this is the 1st time I've tried it while evaluating PyDev Extensions. This time it correctly showed the results in preview but when actually performing the refactoring, it messed up the variable. I was changing 'mapProcess' to 'dictProcess'. It seems to be adding an extra character to the variable name, incrementing the number of extra characters for each instance of the variable. The 'return' statement was also messed up as well.

I'm running PyDev/PyDev Extensions 1.3.8 on Europa 3.3 on Suse 10.1 with JDK 1.6.02

Brian

#-- Before refactoring
def createProcessMap(self):
mapProcess = {}
curs = pg.Cursor( self.cxn, query)
for row in curs:
procName = row['proc_name'].toString()

if mapProcess.has_key(procName):
pass
else:
mapProcess[procName] = Process(procName)

return mapProcess

#-- After refactoring
def createProcessMap(self):
dictProcesss = {}
curs = pg.Cursor(self.cxn, query)
for row in curs:
procName = row['proc_name'].toString()

ifdictProcessss.has_key(procName):
pass
else:
dictProcessess[procName] = Process(procName)

retudictProcesscess

Discussion

  • Fabio Zadrozny
    Fabio Zadrozny
    2007-09-05

    Logged In: YES
    user_id=617340
    Originator: NO

    Yeap, I've been able to reproduce it here... I'll take a look at it... note that if you're just making a local refactoring, you may want to do: Ctrl+2 -> r (that will make a local rename refactoring with your selection -- and works in this case).

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2007-09-05

    Logged In: YES
    user_id=617340
    Originator: NO

    Fixed for 1.3.9.

    The problem was that many heuristics are used for finding the occurrences of a given variable, and in this case, 2 heuristics were yielding the same results, so, one was being applied on top of the other... thus giving that error (so, it would not happen very often, only on cases where different heuristics ended up yielding the same results -- the preview can take care of that, but actually applying it won't).

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2007-09-05

    • milestone: --> 1.3.8
    • status: open --> closed-fixed