Community
Participate
Working Groups
Build ID: M20070921-1145 Consider this code segment: String f(int x, int y, String z) { return g(z); } String g(String z) { return z; } If I change the invocation of g to "g(x, y, z)" then I get an error. Quick fix allows me to "Change method g(int): add params "int, int". The result is: String f(int x, int y, String z) { return g(x, y, z); } String g(int x, int y, String z) { return z; } This works as expected. However now change the type of z to int: int f(int x, int y, int z) { return g(z); } int g(int z) { return z; } Again change the invocation to "g(x, y, z)" and apply the quick fix. You get: int f(int x, int y, int z) { return g(x, y, z); } int g(int z, int y, int z2) { return z; } It seems like Quick Fix is doing a sequence alignment (probably using dynamic programming) -- but that it is only looking at types. Within a type, the algorithm should also look at variable names, and if there are any exact matches between invocation and method declaration, this alignment should be preserved after inserting the new parameters. The expected output is: int f(int x, int y, int z) { return g(x, y, z); } int g(int x, int y, int z) { return z; } More information:
Yes, quick fix only looks at types and fills in matching variables. Could be improved, but not on the list of urgent fixes. Help is welcome.