Joel
Joel

Reputation:

Autocomplete Parameter names in Eclipse Without Source

I am working with a proprietary library that has JavaDocs, but no source code. I've attached the JavaDocs to the library's jar, but I still can't get useful parameter names auto-completed (they are named arg0, arg1, arg2, etc). Is there any way to fix this without source code?

Upvotes: 4

Views: 1759

Answers (5)

Csaba_H
Csaba_H

Reputation: 8245

I think Eclipse have this feature from version 3.2 (see this bug). I have just tried with Oracle's jdbc driver (no source but javadoc). Before attaching the javadoc to the jar I have only arg1,... for parameter completing. After attaching the javadoc I have both javadoc and correct parameter name completing.

But... this only works if you attach the javadoc as a "javadoc in archive", and does not work when you use javadoc URL.

Upvotes: 0

user171941
user171941

Reputation:

I would recommend installing JD-Eclipse:

It is a Java Decompiler and allows you to peek into the classes you don't have the source/JavaDoc of. Looking at the source may allow you to determine what the unnamed parameters are used for.

Upvotes: 0

I do not believe that Eclipse can do much more with attached javadocs than point a browser at the right page.

I would suggest looking for a program which can recreate a source jar (just the stubs) from JavaDoc files, and then attach that to your proprietary file. Eclipse should then pick up the information you want from that.

Upvotes: 1

Tim Frey
Tim Frey

Reputation: 9941

Parameter names, like local variables, are removed when the source code gets compiled down to byte-code. Even if you have @param elements in the Javadoc, they aren't guaranteed to be in any order and some can even be missing. I don't think there is a reliable way for the IDE to reconstruct which @param maps to which parameter using the Javadoc alone.

Upvotes: 1

Nick Holt
Nick Holt

Reputation: 34321

No, the variable names are lost during compilation.

Upvotes: 0

Related Questions