Using Eclipse Helios:
If I define a simple Javascript function
/**
* @returns {Number}
* @param {String} arg
*/
function test(arg)
{
return 1;
}
- the tags were those automatically added by Alt-Shift0J - then the inferred type for the function is:
Number test(any arg) Parameters: {String} arg @returns {Number}
Note the "any arg", despite also Eclipse also recognising the parameter is "{String} arg" later.
Nothing I've tried get the inferred type of the arg to be开发者_开发百科 anything other than "any". This means calling the function with a non-String isn't detected, which is a pity.
So, is this a bug? Not supposed to work? Something I'm doing wrong?
Actually the JsDoc annotations in JSDT/Eclipse are meant for primarily two reasons(as per my comprehension, do correct me if its not the same)
For generation of documentation and
To let eclipse-JSDT-engine help the developer with auto suggest(case-specific).
so the eclipse-developers are not just cross-checking the annotation bindings with your actual code implementation until you run the js file. And again, while you run the javascript. at run time the the javadoc annotations are overlooked as mere comments.
精彩评论