Open jbactual opened 1 month ago
Summary: The user is experiencing a Stack Overflow error when attempting to use the []=
operator to modify the x
and y
properties of a Point
object. The issue arises from a recursive call within the []=
operator definition, leading to an infinite loop.
You are calling the operator function []=
itself inside this function:
void operator []=(Object key, Object value) {
this[key] = value; // no lint error
}
Where this[key]
points to the exact same operator function you are trying to define. So since the operator calls itself infinite amount of times while growing the stack, you will get a StackOverflow exception at some point.
What is the purpose of this issue? If you are asking for the linter to notice this mistake, I don't really think this kind of mistake happens enough times for being worth putting resources into this. Especially since it can sometimes be lot more complicated code that results in this issue and where the linter most likely will not be able to identify the issue.
I do read this as a request for an analyzer warning, perhaps on unguarded self-recursion.