| OLD | NEW |
| (Empty) |
| 1 /** | |
| 2 * @constructor | |
| 3 */ | |
| 4 Base = function() {} | |
| 5 | |
| 6 /** | |
| 7 * @constructor | |
| 8 * @extends {Base} | |
| 9 */ | |
| 10 DerivedNoProto = function() {} | |
| 11 | |
| 12 /** | |
| 13 * @constructor | |
| 14 * @extends {Base} | |
| 15 */ | |
| 16 DerivedBadProto = function() {} | |
| 17 | |
| 18 DerivedBadProto.prototype = { | |
| 19 __proto__: Base | |
| 20 } | |
| 21 | |
| 22 /** | |
| 23 * @interface | |
| 24 */ | |
| 25 InterfaceWithProto = function() {} | |
| 26 | |
| 27 InterfaceWithProto.prototype = { | |
| 28 __proto__: Base.prototype | |
| 29 } | |
| 30 | |
| 31 /** | |
| 32 * @constructor | |
| 33 */ | |
| 34 ProtoNoExtends = function() {} | |
| 35 | |
| 36 ProtoNoExtends.prototype = { | |
| 37 __proto__: Base.prototype | |
| 38 } | |
| 39 | |
| 40 /** | |
| 41 * @constructor | |
| 42 * @extends {Base} | |
| 43 */ | |
| 44 ProtoNotSameAsExtends = function() {} | |
| 45 | |
| 46 ProtoNotSameAsExtends.prototype = { | |
| 47 __proto__: Object.prototype | |
| 48 } | |
| 49 | |
| 50 /** | |
| 51 * @constructor | |
| 52 * @extends {Base} | |
| 53 */ | |
| 54 ProtoNotObjectLiteral = function() {} | |
| 55 | |
| 56 ProtoNotObjectLiteral.prototype = Object; | |
| 57 | |
| 58 /** | |
| 59 * @constructor | |
| 60 * @extends {Base} | |
| 61 */ | |
| 62 DerivedNoSuperCall = function() { | |
| 63 } | |
| 64 | |
| 65 DerivedNoSuperCall.prototype = { | |
| 66 __proto__: Base.prototype | |
| 67 } | |
| 68 | |
| 69 /** | |
| 70 * @constructor | |
| 71 * @extends {Base} | |
| 72 */ | |
| 73 DerivedBadSuperCall = function() { | |
| 74 Base.call(1); | |
| 75 } | |
| 76 | |
| 77 DerivedBadSuperCall.prototype = { | |
| 78 __proto__: Base.prototype | |
| 79 } | |
| 80 | |
| 81 /** | |
| 82 * @extends {Base} | |
| 83 */ | |
| 84 GoodDerived = function() { | |
| 85 Base.call(this); | |
| 86 } | |
| 87 | |
| 88 GoodDerived.prototype = { | |
| 89 __proto__: Base.prototype | |
| 90 } | |
| 91 | |
| 92 /** | |
| 93 * @constructor | |
| 94 * @template T | |
| 95 */ | |
| 96 var Set = function() {} | |
| 97 | |
| 98 Set.prototype = { | |
| 99 add: function(item) {}, | |
| 100 remove: function(item) {}, | |
| 101 /** @return {boolean} */ | |
| 102 contains: function(item) { return true; } | |
| 103 } | |
| 104 | |
| 105 /** | |
| 106 * @constructor | |
| 107 * @extends {Set.<T>} | |
| 108 * @template T | |
| 109 */ | |
| 110 var GoodSetSubclass = function() | |
| 111 { | |
| 112 Set.call(this); | |
| 113 } | |
| 114 | |
| 115 GoodSetSubclass.prototype = { | |
| 116 __proto__: Set.prototype | |
| 117 } | |
| 118 | |
| 119 /** | |
| 120 * @constructor | |
| 121 * @extends {Set.<T>} | |
| 122 * @template T | |
| 123 */ | |
| 124 var BadSetSubclass = function() | |
| 125 { | |
| 126 } | |
| 127 | |
| 128 BadSetSubclass.prototype = { | |
| 129 } | |
| 130 | |
| 131 var NS = {}; | |
| 132 | |
| 133 /** | |
| 134 * @constructor | |
| 135 * @extends {Base} | |
| 136 */ | |
| 137 NS.BadSubClass = function() {} | |
| OLD | NEW |