Java Reference
In-Depth Information
Fo r ex a m p l e :
inspection.exe myProject.ipr
c:\idea\config\inspection\offline_profile.xml
result.xml -v2
You can use offline code inspections for a number of different purposes, many of
which we hope will become more evident as you learn more about their capabili-
ties. For example, you might run the inspector every night to look for missing
JavaDoc code.
You can easily create an Ant task to run the code inspector, just as you
would to run any other application through Ant. Just remember to add
the IDEA JAR s to the Classpath.
TIP
9.2.2
Specifying inspections to perform
IDEA 's code inspector can detect and alert you to a wide variety of problems.
Many of these problems are design related; these should be treated as warnings,
because they may not affect the actual operation of your programs. However,
other conditions detected by IDEA could point to real problems. Each of the
inspection types can be selected independently, and many of them contain addi-
tional options that fine-tune the analysis to your liking. All of these inspections
are well documented in the inspection dialog, but we'll discuss some of the most
interesting ones.
Unused declarations
The Unused declaration inspection finds methods, fields, and classes that
apparently aren't referenced from anywhere in your project. We say “apparently”
because although IDEA can identify direct code references from both Java sources
and JSP files, the inspector can't spot usages that involve reflection; so, be on your
toes before you start deleting declarations.
It's also important that you set the entry point options associated with this
inspection. An entry point defines the start of a code path and gives IDEA some
insight into how the code will ultimately be run. You can tell IDEA to use a num-
ber of different types of entry points such as servlets, applets, and unit tests.
IDEA uses the code paths specified with entry points to determine the actual
usage. If a method is never called during the course of one of these code paths,
IDEA considers it unused, even if it's called by other methods. When examining
the results of a code inspection, you can specify more specific entry points to
refine the analysis.
 
 
 
 
Search WWH ::




Custom Search