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
{{ message }}
Repository navigation
Incorrect renaming when the method/field already has a numeric suffix #571
For example, if we have three methods: overloaded, overloaded and overloaded1. The second overloaded gets converted to overloaded1 but overloaded1 stays the same.
The second option would require multiple traversals with visitors and saving such information somewhere. Could be done, but complicates things for users.
A separator is not a bad idea, it also signals the rename to the user.
In this case, ffigen's UniqueNamer would do foo, foo, foo1, foo1 -> foo, foo1, foo11, foo12 😆. It doesn't try to parse the numbers at the end of the name, it just adds an incrementing number to the end of whatever you give it, until it finds something not in its set.
Activity
HosseinYousefi commentedon Sep 5, 2024
Multiple ways to solve this:
foo,foo,foo1->foo,foo1,foo2foo1to befoo1but it's not.foo,foo,foo1->foo,foo2,foo1foo1remainsfoo1.foo, but the only overloading isfoo2.foo,foo,foo1->foo,foo$1,foo1.$is overloaded.@liamappelbe @dcharkes wdyt? What happens in ffigen? Maybe we should use the same technique.
dcharkes commentedon Sep 5, 2024
The second option would require multiple traversals with visitors and saving such information somewhere. Could be done, but complicates things for users.
A separator is not a bad idea, it also signals the rename to the user.
HosseinYousefi commentedon Sep 5, 2024
Another way: methods with numeric suffices get an extra
$suffix.foo,foo,foo1,foo1->foo,foo1,foo1$,foo1$1As methods ending with a number are rare in Java (as Java has operator overloading), it's both correct and not ugly in the happy path.
liamappelbe commentedon Sep 5, 2024
In this case, ffigen's
UniqueNamerwould dofoo,foo,foo1,foo1->foo,foo1,foo11,foo12😆. It doesn't try to parse the numbers at the end of the name, it just adds an incrementing number to the end of whatever you give it, until it finds something not in its set.HosseinYousefi commentedon Sep 6, 2024
I think I like the last way the best. @liamappelbe Feel free to do the same for ffigen to be consistent.
Although eventually I want to give the users the ability to change this through transformations.