Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

PDT Analysis

Revision as of 11:15, 24 June 2007 by Unnamed Poltroon (Talk) (J2SE Best Practices for PDT)

J2SE Best Practices for PDT

Static analysis

  1. Static code analysis is the analysis of computer software that is performed without actually executing programs built from that software. Objective: find properties on a given program.
  2. Step after semantic analysis
  3. Usages: compiler optimization like constant propagation, reachability. More: detecting logical errors
  4. The idea: build CFG [1] then run in “abstract mode” and do conservative operations to a least fixed point.
  5. Another tool is to check for best practices on the users code

Methods of usage

  1. Evaluating a 3rd party code
  2. Code Review
  3. Bug fixes
  4. Development

Using TPTP analysis tool

  1. Launch
  2. Launch Configuration
  3. Results
  4. Auto- fix (Ctrl + 1)
  5. Nightly reports - http://download.eclipse.org/tools/pdt/downloads/reports/ANALYSIS-php.html

Rules for example

  1. Severe: Override both hashCode() and equals()
  2. Warning: Always use break; in a case branch of a switch statement
  3. Recommendation: Using an if/else statement instead of a ternary operator makes code longer than necessary

Write your own rule

  1. Preferences-> Analysis ->Add Custom Rule
  2. Implement the Rule class
	/**
	 * Run the analysis portion 
	 * @param history	A reference to the history record 
	 */
	public void analyze( AnalysisHistory history);

Back to the top