Vim Java code completion? - java

Is there something equivalent to OmniCppComplete for java in vim ?
I know of eclim but I think it is overkill for such a simple feature.

See http://www.vim.org/scripts/script.php?script_id=1785

Also found VJDE - http://www.vim.org/scripts/script.php?script_id=1213 - Need to evaluate which one is better/more up-to-date

Seems you have some options for code-completion above.
I would recommend also grabbing a copy of TagList, which provides a sidebar displaying the structure of your current file.
The ctags which TagList uses can also be used for fast navigation in Vim. Ctrl+] over the text "curiousMethod()" should take you to the definition of that method.

Related

Is there a way to leave notes in library code in eclipse?

due to reasons I am working with undocumented java library code that I cannot alter in any way or write into. Im using eclipse 2020-06 and I would like to leaves some notes for myself to make things easier. Is there a way to do that? or maybe an eclipse extension?
You can use bookmarks. They work somewhat similarly to breakpoints, without pausing execution when you're debugging.
You can add them via the context menu.
If I recall, you're a bit limited by the amount of information you can add. It's basically just a single text box.
See the help section on bookmarks
Maybe there's some plugins which extend the functionality (e.g. this one for adding keyboard shortcuts)

Add copyright at the end of Java class while writing documentation?

I'm writing documentation for my java file. In that documentation, I want to add some html links at the end of each generated file. For that, what I have to use while writing java documentation?
If you are using Eclipse as IDE, you can use the plugin JAutodoc:
http://jautodoc.sourceforge.net/
To add a default text at the beggining of each text file.
According to the javadoc manual (can't find a newer version right now), you should use -footer when you generate your java API documentation from the CLI, for instance:
javadoc -footer "<b>Copyright 2015 Lakshmi Prasanna</b><br>" com.mypackage
Here's a similar example, but that uses -header instead.
Now, if you use a good IDE, at the very least it should allow you to type that somewhere in the project settings. Back in the day Eclipse wasn't very flexible, so I had to make an Ant script (yuck).
EDIT:
One limitation with this approach is that the CLI -options depend on the tool. This works with the standard javadoc command but might not work with another vendor's doclet. However I'm not sure there's a universal way to achieve what the OP asked.
Anyway, it seems to be: NOT -footer but -bottom.

Java eclipse highlight missing brackets

I just can't find the option anywhere. Is there some way in eclipse to warn about stuff like this? if(a==b)continue; instead of if(a==b){continue;}
Or can maybe the format function fix this?
Window-->Preferences--> Java > Editor > Save Actions-->Additional actions-->Configure-->Code Style--> Use blocks in if/while... here you can configure the style you want.
CheckStyle is a nice tool which can also be used as a plugin for eclipse. You can specify different kinds of coding styles you want to enforce on you / your team, by configuring rules in this tool. This could help you create your custom check.

Replacement for deprecated items in java

I am currently on a task, where I need to fix the deprecated items in the existing projects. I mean I have to replace the deprecated items with the corresponding replacing items as given in javadocs,
Eg: java.util.Date.setSeconds(int): Instead of this deprecated method, we need to use Calendar.set(Calendar.SECOND, int seconds).
I need to automate this using java code in eclipse IDE, by giving a project name in the workspace as input.
Kindly suggest me in doing this.
Thanks in advance.
I would go with the search & replace functionality of your IDE, by utilizing regex. (your parameter values should be captured with regex)
There isn't any specific utility to replace deprecated code, because it is not always that case that there is a straightforward replacement. Sometimes there is not replacement, and in other cases there is a completely different approach.
If the project is not really big probably easiest way is to do this by hand. It also handles the situations where there is no direct replacement.
Alternative (and definitely more interesting) way would be to write an eclipse plugin that extends eclipses JDT. Also if you are on Java 6 one possibility is to use Java compiler API.

linux tool to list all functions in a source file?

I am looking for a command line utility on *nix, that can dump the names of all the functions, classes etc. defined in a file(C/C++/Java)
ctags can give you that (and much more). It is included with most Linux distributions...
http://ctags.sourceforge.net/whatis.html
It is not clear which language you refer to: if:
complied elf file then you have readelf utility providing that you compiled file with debug information "-g"
Not sure if it would be useful for your exact purpose, but take a look at GCC-XML
You might also want to take a look at cscope which is similar to ctags suggested in the accepted answer. It creates its own symbol database. It provides a nice interface for you, enabling search of a given symbol/inclusion/file/declaration within your project.
You can try Doxygen to list all your functions (see also XML output possibility)
http://www.doxygen.nl/

Categories