Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324869

Summary: JavaScript Generics: @returns {Array<Type>}
Product: [WebTools] JSDT Reporter: domcap <dominic.chambers>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: RESOLVED WONTFIX QA Contact: Nitin Dahyabhai <thatnitind>
Severity: enhancement    
Priority: P3 CC: philippe.marschall
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description domcap CLA 2010-09-09 12:28:30 EDT
Build Identifier: 20100617-1415

The content assist in Eclipse works really well until you hit a method that returns arrays, at which point there is no way to inform Eclipse which type of object the array consists of. I'd like to propose the following (Java Generics style) notation for allowing this:

  @returns {Array<Type>} comment

This would work immediately in jsdoc-toolkit and jsdoc.pl since it will just be interpreted as a string, but could also be supported more thourougly later, allowing hyperlinking of the type within the angle brackets.


Reproducible: Always
Comment 1 Philippe Marschall CLA 2011-04-16 18:12:18 EDT
jsdoc-toolkit seems to use the following notation 

@returns {Type[]}

http://code.google.com/p/jsdoc-toolkit/wiki/TagParam#Parameter_Type_Information
Comment 2 Nitin Dahyabhai CLA 2011-06-30 17:28:03 EDT
As linked in comment 1, there's a set format for the documentation we support.  We're not going to invent/extend one and make people use it.  Recommend advocating for something like this in JSDoc 3 (or 4?) and then we'll look into using it.
Comment 3 Philippe Marschall CLA 2011-07-01 03:00:09 EDT
I'm a bit confused, it's in JSDoc 2
http://code.google.com/p/jsdoc-toolkit/wiki/TagParam#Parameter_Type_Information
so I'm not sure why there is a need to advocate this in JSDoc 3 (or 4).
Comment 4 domcap CLA 2011-07-01 04:23:03 EDT
@Nittin
You've closed this bug as won't fix but you also don't support the jsdoc array notation that other people have mentioned on this issue. Should I raise another issue for that instead?

@Philippe
I assume the reason Nittin is saying that I should ask for it in jsdoc v3 (or v4) is that the notation I was suggesting was more powerful as it allows typed maps too. As it happens, I didn't know about the jsdoc array notation since I'm still using jsdoc-pl (rather than jsdoc-toolkit), which doesn't have support for either notation.