Summary: To work on my Google Closure Compiler (GCC) based code, the JSDoc tags that are lacking are @interface, @implements, and @inheritDoc. There is also a conflict with using the goog.scope feature of GCC.
Thanks Jeff for the tip about putting the union into parenthesis. That worked and I was able to generate docs for my trial package of 18 javascript files.
The biggest issue preventing me using JSDoc now is that interfaces seem to be ignored. I'm currently converting a 100,000 line project from Java to Javascript (I'm about halfway thru). GCC has proven to be invaluable. I use interfaces heavily, and most of the documentation is in the interface files.
I notice that the error message I got previously lists "interface" and "implements" among the strings that it was looking for, which gives me hope. Ominously, it is not looking for "inheritDoc".
Are there any plans to add the tags @interface, @implements, @inheritDoc to JSDoc3? Or is this something I should try to do on my own?
Of lesser importance is the conflict with the goog.scope feature. I'll describe the issue because anyone else trying to use JSDoc with GCC will likely encounter this problem as well.
The goog.scope function allows using just the name of a class (or interface) without the full package name prefix. For example, I can use the name "DoubleRect", instead of "myphysicslab.lab.util.DoubleRect". I give an example of using goog.scope at the end of this message.
As an experiment, I added the full package-path-prefix to all the methods and fields of the classes in my trial package of 18 javascript files -- and this works. Without doing that, JSDoc fails to produce the method or field documentation.
I can see some ways to work around the goog.scope issue. But without the @interface tags I can't see a way to use JSDoc on my GCC code.
Best regards,
--ErikN
Here is an example usage of goog.scope:
goog.provide('myphysicslab.lab.util.DoubleRect');
goog.require('myphysicslab.lab.util.Vector');
goog.require('myphysicslab.lab.util.UtilityCore');
goog.scope(function() {
var Vector = myphysicslab.lab.util.Vector;
var UtilityCore = myphysicslab.lab.util.UtilityCore;
var NF5 = myphysicslab.lab.util.UtilityCore.NF5;
/**
@param {!(DoubleRect | Vector | number)} arg1 left edge,
or center of rect, or entire DoubleRect to copy
@param {number=} arg2 right edge, or width (when arg1 is center)
@param {number=} arg3 bottom edge or height (when arg1 is center)
@param {number=} arg4 top edge
@constructor
*/
myphysicslab.lab.util.DoubleRect = function(arg1, arg2, arg3, arg4) {
.... constructor code here ...
};
var DoubleRect = myphysicslab.lab.util.DoubleRect;
/**
* @return {number}
*/
DoubleRect.prototype.getLeft = function() {
return this.left_;
};
/**
* @return {!Vector}
*/
DoubleRect.prototype.getCenter = function() {
return new Vector(this.getCenterX(), this.getCenterY());
};
/** Returns a copy of this rectangle translated by the given amount.
@param {!(number|Vector)} x horizontal amount to translate by, or Vector to translate by
@param {number=} y vertical amount to translate by
@return {!DoubleRect} a copy of this rectangle translated by the given amount
*/
DoubleRect.prototype.translate = function(x, y) {
if (x instanceof Vector) {
y = x.getY();
x = x.getX();
}
if (!goog.isDef(y))
throw new Error();
return new DoubleRect(this.left_ + x, this.right_ + x,
this.bottom_ + y, this.top_ + y);
};
... other methods omitted ...
}); // end goog.scope