Class CheckPrototypeProperties

  • All Implemented Interfaces:
    CompilerPass, NodeTraversal.Callback

    public final class CheckPrototypeProperties
    extends java.lang.Object
    implements CompilerPass, NodeTraversal.Callback
    Checks when a mutable property is assigned to a prototype. This is generally undesirable because it can lead to the following unexpected situation.
     /** @constructor * /
     function MyClass() {}
     MyClass.prototype.prop = [];
     x = new MyClass;
     y = new MyClass;
     x.prop.push(1);
     console.log(y.prop) // [1]