Java Utility

From HaFrWiki
Revision as of 12:10, 8 December 2012 by Hjmf (talk | contribs) (External Links)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Utilities for Java are meant to be used for Java QA Tools. This means that IDEs, build tools and deployment tools are not mentioned here, but are part of Java Development. The Quality Tools named can be used for Code Reviews, but also as plugins to help the programmers creating maintaining their code.

CheckStyle for Java

CheckStyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.

CheckStyle is highly configurable and can be made to support almost any coding standard. An example configuration file is supplied supporting the Sun Code Conventions. As well, other sample configuration files are supplied for other well known conventions.

Checkstyle has checks for:

Javadoc Comments Naming Conventions Headers Imports
Size Violations Whitespace Modifiers Block Checks
Coding Class Design Duplicate Code Metrics
BooleanExpressionComplexity ClassDataAbstractionCoupling ClassFanOutComplexity CyclomaticComplexity
NPathComplexity JavaNCSS Miscellaneous J2EE Checks


FindBugs™ (a trademark of the university of Maryland) looks for bugs in Java programs. It is based on the concept of bug patterns. A bug pattern is a code idiom that is often an error. Bug patterns arise for a variety of reasons:

  • Difficult language features
  • Misunderstood API methods
  • Misunderstood invariants when code is modified during maintenance
  • Garden variety mistakes: typos, use of the wrong boolean operator

FindBugs uses static analysis to inspect Java bytecode for occurrences of bug patterns. Because the analysis is sometimes imprecise, FindBugs can report false warnings. FindBugs uses BCEL to analyse java bytecode and dom4j for XML manipulation. To view the FindBug Bugs Descriptions reported by FindBugs


JavaNCSS (Non Commenting Source Statements) is a simple command line utility which measures two standard source code metrics for the Java programming language. The metrics are collected globally, for each class and/or for each function. Next to NCSS avaNCSS produces also CCN (Cyclomatic Complexity Number).

Lint for Java (Util4J)

Lint4j ("Lint for Java") is a static Java source and byte code analyzer that detects locking and threading issues, performance and scalability problems, and checks complex contracts such as Java serialization by performing type, data flow, and lock graph analysis.


PMD does not have a known name, but stands for Pretty Much Done, Project Mess Detector, Project Monitoring Directives, Project Meets Deadline, Programming Mistake Detector, Pounds Mistakes Dead, PMD Meaning Discovery (recursion, hooray!). Make your choice.
Programs of Mass Destruction 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 could be while loops
  • Duplicate code - copied/pasted code means copied/pasted bugs, CPD report (Copt Paste Detection)



Simian (Similarity Analyser) identifies duplication in Java, C#, C, C++, COBOL, Ruby, JSP, ASP, HTML, XML, Visual Basic source code and even plain text files. In fact, simian can be used on any human readable files such as ini files, deployment descriptors, you name it. Simian can be used in the following ways:

Command Line Ant task CheckStyle plugin IntelliJ integration
Programmtic Interface Maven Eclipse pluging WSAD plugin

See also


External Links