When I type something like Integer.toString and press "Ctrl+Space", it gives me the completion hint of Integer.toString(int arg0, int arg1), but I want it to write Integer.toString(int i, int radix) so that I know that the first argument is the number and the second one is the radix. Can you install some plugin that does that, instead of showing these unintuitive "arg0", "arg1" parameter names?
As daniu pointed out in the comments, Eclipse uses the javadoc to get the information. The argument names simply don't exist in the compiled JRE. I can confirm that in my workspace, javadoc is attached but no sources and the completion shows the correct names.
Eclipse should add the information on it's own, but if it does not for some reason, you can add it yourself.
In your project folder, you will see "JRE System Library [your Java version]". Inside that, there are a bunch of jars. Right click on each one and got to Properties -> Javadoc Location. There you can input the javadoc location for the jar. In the case of Java 8, this is https://docs.oracle.com/javase/8/docs/api/ for all of them. If you use a different version, use a search engine of your choice to find the correct javadoc.
Related
I am using eclipse helio with java.
The watch expression option is not working for me when debugging my code
If I am doing a watch on variable, I cant see the value of that variable in the watch view
if i hoover with my mouse over the variable in the code i can see its value
if I check the variable in the variables view I can see its value
but in the watch expressions window i cant see its value (and its a problem if i try to watch expressions for example)
did anyone encounter this problem
(it used to work fine and show values but then suddenly it stopped and i have no idea why)
thanks
For me the problem had to do with a bad source path configuration for the project. There's a bunch of different ways to fix this, but one is to right-click on the thread while paused in the debugger, select "Edit Source Lookup...", and fiddle around with the paths specified there (see below).
In my case the problem was that I had specified the source lookup path as a "File System Directory". I was able to get my Expressions view working again by removing the "File System Directory" path and adding the source lookup as a "Java Project" instead.
You can check whether the problem is your source lookup path by opening the Debug -> Display view, and trying to evaluate a Java expression there. If you see a message like this, then your source lookup path is bad:
To perform an evaluation, an expression must be compiled in the context of a Java project's build path. The current execution context is not associated with a Java project in the workspace.
Typically (at least for simple cases) the expression view works. But sometimes it indeed stops showing the values.
Usually refresh and clean of project + (sometimes) restart of eclipse help.
If you are able to see simple values and cannot see expression it sometimes because the class that is returned by expression does not appear in import list of current class. In this case I often try to write explicit cast to class into the watch expression and sometimes it helps.
Good luck.
In my case, while debugging against wildfly, my workspace somehow got corrupted after I opened as a maven project the sources of eclipselink 2.6.4.
After having open this maven project - that has all sort of dependencies you can image on oracle libraries - within my workspace the expressions and display view simply did not work any more. The variables view, while debugging continue to work as well as all the mouse overs.
I then created a fresh new empty worksapace.
Imported only the project I wanted to debug.
Reconfigured wildfly server.
And voila, expressions and display were back to work.
So, I have no idea what what happened to my eclipse... but it appears to be related to the metadata in my workspace being fundamentally broken.
Therefore, if you get the feeling that out of the blue lose the ability to properly debug in your workspace, it might be that your worksapce got hammered.
This appears to be what has happened to me. Finally, I am now back to being able to use the expressions on this new workspace.
I want to get warnings at compile time for every public thing (class, interface, field, method) which doesn't have a Javadoc comment.
How can I enable this in Eclipse?
Based on your tag, I'll assume that you mean in Eclipse. To do so, Open the Window -> Preferences Menu Item, and then Under Java -> Compiler -> Javadoc, there will be a dropdown that will either let you treat missing javadoc tags as Error, Warning, or Ignore.
This answer was for the latest version of eclipse, but if you search for javadoc in the preferences search you should be able to find it easily enough.
When using the standard api, for example the collections library, the predictive text options windows also shows the comments on class/methods.
however when I do the same style comments on my own code - the open project I am working on (code completion works correctly, just no comments appear), and then reference it later. These comments are not displayed. I get the correct code completion options, just none of the associated comments/documentation. They are not in jar, they are source files, that are built using maven into a war file.
Is there a setting I need to enable in eclipse, or do I need to set up javadoc or something ?
How embarassing, you to have to specify double asterix at the begininng of comment to create a javdoc comment
/**
* read the documentation before asking questions on stackoverlow
*/
If the class is part of a jar you need to associate the javadoc jar or path. You can right click on the jar in eclipse and specify the path in the properties dialog.
How do I access the index that eclipse uses to do Java search, import, etc?
This old thread (for eclipse2!) mentioned:
In the meantime if you feel like indexes are not complete (open type doesn't show you a type which it should), you can workaround by:
exiting Eclipse,
find the index files in the metadata, and discard them all.
Restart Eclipse,
and activate the open-type dialog which will trigger proper reindexing.
Index files are located in:
<workspace>/.metadata/.plugins/org.eclipse.jdt.core/, you want to get rid of all '*.index' files in the doubt + 'savedIndexNames.txt'.
I just checked with my current Eclipse Helios 3.6.1, and those files are still around.
More generally (and programmatically), the SearchParticipant API is involved with those files, ans mentioned in bug 308402
SearchParticipant has the method #selectIndexes and part of its documentation
says "An index location represents a path in the file system to a file that
holds index information." and to that effect we store our .index files in our
own location and return those when the #selectIndexes method is called using
the BasicSearchEngine.
You can see an example here.
Is it possible to set up Intellij to generate javadoc for methods and classes, automatically, with #author and #since date? I had this feature in Eclipse.
I know that the files have templates and also I can manually semi-automatically add javadoc to selected method/class. But I want the generation to be automatic for every generated method/class/enum/interface/field etc.
This is useful for e.g. "extract method", "override/implement", "create getter/setter" etc. This would save hundreds of manual actions.
I'm using IntelliJ Idea 9.0 BETA Community Edition, #IC-90.96.
For IntelliJ 12:
Position caret above a method name, type /** and press Enter to let
IntelliJ IDEA automatically generate JavaDoc stubs for this method.
See here
For newer versions of IntelliJ (2018+), you can use this solution:
Typing /** + then pressing Enter above a method signature will create Javadoc stubs for you.
It's not possible at the moment. You may want to Vote for IDEABKL-1787.
for generate javadoc in intellij Idea go to Tools->Generate JavaDoc (4th option) click it and give path to save your Document
Now there is a new plugin available for that.
It works great, you can generate javadoc with alt+insert.
It's called "javaDoc", it's available directly in the plugin section.
The documentation is here : https://github.com/setial/intellij-javadocs/wiki
I have given up on hoping that IntelliJ will be able to do this.
I now open my project in Eclipse, go to the desired files and invoke JAutoDoc.
There is JavaDoc Sync Plugin 8. http://plugins.intellij.net/plugin/?idea&id=3403
Generates javadoc for all methods in class. Works in Idea 10.
Actually it's now possible, you can simply go to "Settings/Editor/File and Code Templates".
There, you can edit the template which is used to create classes, enums, interfaces etc.
My Intellij version is 2019.2.3 and on linux.
An easy option is to access Find Action menu (Macs: Cmd+Shift+A | Win: Ctrl+Shift+A) and type any part of the Generate JavaDoc action.
Once you found and clicked on that , an option menu for generation of JavaDocs is opened , containing a wide range of options and scopes.
Reference -> https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html