Analyzing and tyding Java code

M

Mike Landis

Hello,

Are there any Open Source based tool that could
analyze Java source code?

If Java sourcecode contains a lots of e.g. unnessary
if else switch cases etc. that tool could for example tidy
or suggest lines that would need some tiding.

br

Mike
 
J

Jos A. Horsmeier

Mike Landis said:
Hello,

Are there any Open Source based tool that could
analyze Java source code?

If Java sourcecode contains a lots of e.g. unnessary
if else switch cases etc. that tool could for example tidy
or suggest lines that would need some tiding.

I'm not an IDE fan/user per se, buy may I suggest www.eclipse.org
It's free, and it does quite a good job at looking over your
shoulder; its suggestions for 'improvements' while it's inspecting
your source code are quite sensible. I especially like its
refactoring capabilities.

kind regards,

Jos
 
M

Michael Borgwardt

Jos said:
I'm not an IDE fan/user per se, buy may I suggest www.eclipse.org
It's free, and it does quite a good job at looking over your
shoulder; its suggestions for 'improvements' while it's inspecting
your source code are quite sensible.

It just protests a (small) number of things that are formally
allowed but considered "bad style", like accessing a static method
through an instance.

Mike seems to be more interested in stuff that's not as formally
classifiable: what exactly is an "unnecessary" if statement??
That's all but impossible to determine (let alone fix)
programmatically, except for the (rare) case where the condition
is always trivially wrong or false.

I've seen an eclipse plugin that computes metrics on your code,
like cyclomatic complexity, number of statements in a method, etc.
and gives warnings where these numbers exceed certain thresholds.
That might be what Mike wants.
 
R

Robert Olofsson

Mike Landis ([email protected]) wrote:
: Are there any Open Source based tool that could
: analyze Java source code?

Depends on what type of analasis you want...

: If Java sourcecode contains a lots of e.g. unnessary
: if else switch cases etc. that tool could for example tidy
: or suggest lines that would need some tiding.

I would suggest that you look at findbugs it is a lint-program
for java that seems to catch a lot of errors. It does not clean
the code up by itself though.

http://www.cs.umd.edu/~pugh/java/bugs/

/robo
 
C

Christopher Dean

Mike said:
Hello,

Are there any Open Source based tool that could
analyze Java source code?

If Java sourcecode contains a lots of e.g. unnessary
if else switch cases etc. that tool could for example tidy
or suggest lines that would need some tiding.

br

Mike
Check out sourceforge there are a couple products such as PMD and
checkstyle which will analyze your code and give you information on
complexity, unused variables, unnecessary imports, short variable names,
long methods, etc. etc. I automatically run these on my daily builds
and use the results to check quality and adherence to code guidelines.
If that is what you are looking for.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top