Open LisoUseInAIKyrios opened 1 week ago
Looks like it could cause breaking changes in case someone already relies on this behavior. I think the API isn't that necessary since you have access to the class list and therefore can already find a class using any predicate you want. Therefore I'll consider deprecating the API
The more immediate fix needed is MethodWalker, where it uses findClass()
and can start walking from the wrong class:
you can use context.classes.find { it.type == className }
Right, but method walker needs that change since it's in patcher and not patches repo.
Bug description
Currently
findClass
works by only checking for contains:But this can cause issues where the class desired is a substring of another class:
Labc;
Labcdefg;
Calling
context.findClass("abc")
could return eitherabc
orabcdefg
Error logs
No response
Solution
Check for exact class name using == (and not contains):
fun findClass(className: String) = findClass { it.type == className }
Or if it's desirable to allow specifying class name only and not package, then maybe check with something like:
Additional context
No response
Acknowledgements