Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Eclipse issue w/Java imports, doc comment links, and type parameters

Reply
Thread Tools

Eclipse issue w/Java imports, doc comment links, and type parameters

 
 
Twisted
Guest
Posts: n/a
 
      12-04-2006
This is unexpected behavior and a problem:

I have a sourcefile where one of the doc comments contains:

{@link ETF#getIteratorInstance(Options, Parameters)
ETF.getIteratorInstance}

It's impossible to "organize imports" in Eclipse when editing this file
now. It highlights Parameters in this doc comment and wants me to pick
either java.security.Policy.Parameters or
javax.security.auth.login.Configuration.Parameters , and does not
provide the option to skip doing so but still import whatever else
(e.g. HashSet) has been referenced and needs importing.

The code itself does not actually reference Options or Parameters,
which are actually type parameters to the class ETF. It is only this
one @link doc tag that references them as part of the signature of the
linked-to method. Neither of the Parameters classes suggested as
imports are at all useful or relevant here.

This is a significant wart, though not a showstopper. Organize imports
should, it seems to me, limit itself to what's actually used by the
Java code, and if javadoc needs this to find them, types actually
linked to in comments (in this case ETF but not Options or Parameters).

This looks likely to be a result of the relatively recent introduction
of generics. Let's hope this sort of thing is smoothed out in the next
version of Eclipse (and, if partially responsible, javac and/or
javadoc)...

 
Reply With Quote
 
 
 
 
Twisted
Guest
Posts: n/a
 
      12-04-2006
Twisted wrote:
[snip]

P.S. it seems that Java's generics, though less complex or
well-developed than C++ templates owing to the need for backward
class-file compatibility, are nonetheless sufficient in capability to
enable type-parameter spaghetti. Perhaps even more so than
templates, since javac is much smarter about resolving backward
references and coping with the circular referencing of types without
having to declare everything once and then define everything
once...OTOH, *nothing* compares to the #include spaghetti that any
substantial circularly-referenced group of C++ classes forces on the
poor benighted coder who has to write the header files!

 
Reply With Quote
 
 
 
 
Twisted
Guest
Posts: n/a
 
      12-04-2006
Twisted wrote:
> This is unexpected behavior and a problem:
>
> I have a sourcefile where one of the doc comments contains:
>
> {@link ETF#getIteratorInstance(Options, Parameters)
> ETF.getIteratorInstance}


I've got some more information now. It's actually the *autocomplete* in
Eclipse that is stuffing this up. It should really be filling this in
with ETF#getIteratorInstance(Object, Object) with these type
parameters, and more generally, with whatever the type parameter
extends, rather than
the name of the type parameter itself. Manually changing
type-parametrized @link and @see references to replace type parameter
names with the erased types is needed to make the links work in the
compiled javadocs too.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need create RTF-type file and DOC-type file keal Ruby 1 01-05-2006 04:12 PM
? ELSE Conditional Comment / Using Conditional Comments Inside Other Tags To Comment Out Attributes Alec S. HTML 10 04-16-2005 02:21 AM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
Converting a org.jdom DOC to org.w3c DOC Praveen Chhangani XML 2 08-07-2003 08:22 AM
Parsing MS Word client doc into server-side doc... John Wallace ASP .Net 0 07-22-2003 06:49 PM



Advertisments