Java tools: source code optimization and Analysis

Source: Internet
Author: User
Tags apache tomcat netbeans

Below is a list of some tools that can help you examine your Java source code for potential problems:


1. pMD from http://pmd.sourceforge.net/

License: PMD is licensed under a "BSD-style" License

PMD scans Java source code and looks for potential problems like:

* Possible bugs-Empty try/catch/finally/switch statements
* Dead Code-unused local variables, parameters and private methods
* Suboptimal code-Wasteful string/stringbuffer usage
* Overcomplicated expressions-unnecessary if statements, for loops that cocould be while Loops
* Duplicate code-copied/pasted code means copied/pasted bugs

You can download everything from here, and you can get an overview of all the rules at the rulesets index page.

PMD is integrated with jdeveloper, Eclipse, jedit, JBuilder, bluej, codeguide, netbeans/Sun Java Studio Enterprise/creator, intellij idea, textpad, Maven, ant, gel, jcreator, and Emacs.

2. findbugfrom http://findbugs.sourceforge.net/

License: L-GPL

Findbugs, a program which uses static analysis to look for bugs in Java code. and since this is a project from my alumni University (IEEE-University of Maryland, College Park-bill Put), I have to definitely add this contribution to this list.

3. Clover from http://www.cenqua.com/clover/

License: free for Open Source (more like a GPL)

Measures statement, method, and branch coverage and has XML, HTML, and GUI reporting. and comprehensive plug-ins for major ides.

* Improve test quality
* Increase testing productivity
* Keep team on track

Fully integrated plugins for netbeans, Eclipse, intellij idea, JBuilder and jdeveloper. These plugins allow you to measure and inspect coverage results without leaving the IDE.

Seamless Integration with projects using Apache ant and maven. * easy integration into legacy build systems with command line interface and API.

Fast, accurate, retriable, detailed coverage reporting of method, statement, and branch coverage.

Rich reporting in HTML, PDF, XML or a swing Gui

Precise Control over the coverage gathering with source-level filtering.

Historical charting of code coverage and other metrics.

Fully compatible with JUnit 3.x & 4.X, testng, jtiger and other testing frameworks. can also be used with manual, functional or integration testing.

4. Macer from http://innig.net/macker/

License: GPL

Macer is a build-time processing tural Rule Checking utility for Java developers. it's meant to model the specified tural ideals programmers always dream up for their projects, and then break -- it helps keep code clean and consistent. you can tailor a rules file to suit a specific project's structure, or write some general "Good Practice" Rules for your code. macer doesn't try to shove anybody else's rules down your throat; It's flexible, and writing a rules file is part of the development process for each unique project.

5 Emma from http://emma.sourceforge.net/

License: Emma is distributed under the terms of common public license V1.0 and is thus free for both open-source and commercial development.

Reports on class, method, basic block, and line coverage (text, HTML, and XML ).

Emma can instrument classes for coverage either offline (before they are loaded) or on the fly (using an instrumenting application classloader ).

Supported coverage types: Class, method, line, basic block. Emma can detect when a single source code line is covered only partially.

Coverage stats are aggregated at method, class, package, and "all classes" levels.

Output report types: plain text, HTML, XML. All report types support drill-down, to a user-controlled detail depth. The HTML report supports source code linking.

Output reports can highlight items with coverage levels below user-provided thresholds.

Coverage data obtained in different instrumentation or test runs can be merged together.

Emma does not require access to the source code and degrades gracefully with decreasing amount of debug information available in the input classes.

Emma can instrument individial. class files or entire. jars (in place, if desired). Efficient coverage subset filtering is possible, too.

Makefile and ant build integration are supported on equal footing.

Emma is quite fast: The runtime overhead of added instrumentation is small (5-20%) and the bytecode instrumentor itself is very fast (mostly limited by file I/O speed ). memory overhead is a few hundred bytes per Java class.

Emma is 100% pure Java, has no external library dependencies, and works in any Java 2 JVM (even 1.2.x ).

6. xradar from http://xradar.sourceforge.net/

License: BSD (Me thinks)

The xradar is an open extensible code report tool currently supporting all Java based systems. the batch-Processing Framework produces html/svg reports of the systems current state and the development over time-all presented in sexy tables and graphs.

The xradar gives measurements on standard software metrics such as package metrics and dependencies, code size and complexity, code duplications, coding violations and code-style violations.

7. hammurapi from hammurapi Group

License: (if anyone knows the license for this email, let us know)

Hammurapi is a tool for execution of automatic inspection of Java program code. following the example of 282 rules of Hammurabi's code, we are offered over 120 Java classes, the so-called inspectors, which can, at three levels (source code, packages, repository of java files), state whether the analyzed source code contains violations of commonly accepted standards of coding.

Relevant links:

Http://en.sdjournal.org/products/articleInfo/93

Http://wiki.hammurapi.biz/index.php? Title = hammurapi_4_quick_start

8. Relief from http://www.workingfrog.org/

License: GPL

Relief is a design tool providing a new look on Java projects. relying on our ability to deal with real objects by examining their shape, size or relative place in space it gives a "physical" View on Java packages, types and fields and their relationships, making them easier to handle.

9. Hudson from http://hudson-ci.org/

License: MIT

Hudson is a continuous integration (CI) tool written in Java, which runs in a servlet container, such as Apache Tomcat or the glassfish application server. it supports SCM tools including CVs, subversion, git and clearcase and can execute Apache ant and Apache Maven based projects, as well as arbitrary shell scripts and Windows batch commands.

10. cobertura from http://cobertura.sourceforge.net/

License: GNU GPL

Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.

11. sonarsource from http://www.sonarsource.org/

License: lgpl

Sonar is an open platform to manage code quality. As such, it covers the 7 axes of code quality:

Architecture & design, duplications, unit tests, complexity, potential bugs, coding rules, comments.

Feel free to suggest your own tools in the comments section.

Reference:Java tools for source code optimization and analysis from our jcg partnerAt theour tech stop blog.

Related Articles:
    • Using findbugs to produce substantially less buggy code
    • Why automated tests boost your development speed
    • Not doing code reviews? What's your excuse?
    • Save money from agile development
    • Top 25 most dangerous softwares-2011

http://www.javacodegeeks.com/2011/07/java-tools-source-code-optimization-and.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.