Community
Participate
Working Groups
Build Identifier: M20110210-1200 In js.browserWindow file, setTimeout function is defined: /** * function setTimeout(arg1, arg2) * @param {Object} arg1 * @param {Number} arg2 * @memberOf Window * @returns {Object} */ Window.prototype.setTimeout=function(arg1, arg2){return new Object();}; However, the return type of setTimeout function is a number, as seen using the test code: var test = window.setTimeout(function(){}, 1); alert(typeof test); Tested on Firefox 4, Safari 5 and Opera 11. Reproducible: Always Steps to Reproduce: In eclipse preferences go to: JavaScript > Validator > Error/Warnings and enable JavaScript semantic validation. Now in a javascript file, enter the following code: var test = { to : -1 }; test.to = window.setTimeout(function(){}, 1); Second line now throws a warning: cannot convert from Object to Number
Created attachment 198042 [details] Patch
I suspect the JSDoc is overriding what the InferEngine would do with the returned value itself, because I'd expect it to need to return a number rather than Number itself.
Yeah....I think the JSdoc takes over....it still should return just a "1" or something like that to keep it simple.
I think the same should be applied to window.setInterval() as well
Created attachment 198103 [details] patch
Lalit, please incorporate Chris' feedback from comment 3. The function contents should return *a* number, not Number itself.
Created attachment 198190 [details] updated patch
Good to go as soon as we get Nitin's "+".
Checked into HEAD and 3.2.5.