This pages sums up the different validations (static analysis) implemented by the Spoon-VSuite Spoonlets. More validations and tests will come as many contributors are working on specific ideas.
VSuite-Common (spoon.vsuite.common)
This Spoonlet provides a set of very common validations.
Exception management-related tests
Bad finally block detection (BadFinallyProcessor)
This validation reports a warning when a finally block uses return or throw statements.
Empty catch detection (EmptyCatchProcessor)
This validation reports warnings at empty catches.
Bad exception forwarding detection (BadExceptionForwardingProcessor)
This validation reports warnings when an exception 'e' is forwarded as: new SomeException(e.getMessage()).
State manipulation tests
Final field detection (CouldBeFinalFieldProcessor)
This validation finds fields that are never modified and reports warnings to suggest that they could be made final.
Static method detection (CouldBeStaticMethodProcessor)
This validation finds non-static methods that do not access the instance's state and reports warning to suggest that they could be made static.
No side effect detection (NoSideEffectInvocationProcessor)
This validation reports warnings when a method with no-side effect's result is not used, so that the invocation has no impact on the program.
Unused variable detection (UnusedVariableProcessor)
This validation reports warnings when a declared variable is never used in the source code.
Properties:
- ignoreStaticFinalVariables (default="false")
- ignoreLocalVariables (default="true")
- ignorePrivateVariables (default="true").
Dangerous constructor detection (DangerousConstructorProcessor)
This validation reports warnings if a method invocation uses a this within a constructor, since it could work on a not completely initialized instance.
Common coding conventions
Non-documented element detection (DocProcessor)
This validation reports warnings if an element that should be documented has no javadoc comment.
Empty executable detection (EmptyExecutableProcessor)
This validation reports warnings when a method or contructor's body is empty.
If with no blocks detection (IfProcessor)
This validation reports warnings when an if statement does not enclose its then or else part within blocks, or when an if has no then part.
VSuite-Findbugs (spoon.vsuite.findbugs)
This Spoonlet provides some validations from the well-known Findbugs tool.
DLS
Overwritten increment (DLS_OVERWRITTEN_INCREMENT)
The code performs an increment operation (e.g., i++) and then immediately overwrites it. For example, i = i++ immediately overwrites the incremented value with the original value.
CN
Class implements Cloneable but does not define or use clone method (CN_IDIOM)
Class implements Cloneable but does not define or use the clone method.
BIT
Incompatible bit masks (BIT_AND_ZZ)
This method compares an expression of the form (a & 0) to 0, which will always compare equal. This may indicate a logic error or typo.
Incompatible bit masks (BIT_AND)
This method compares an expression of the form (a & C) to D, which will always compare unequal due to the specific values of constants C and D. This may indicate a logic error or typo.
Incompatible bit masks (BIT_IOR)
This method compares an expression of the form (a | C) to D. which will always compare unequal due to the specific values of constants C and D. This may indicate a logic error or typo. Typically, this bug occurs because the code wants to perform a membership test in a bit set, but uses the bitwise OR operator ("|") instead of bitwise AND ("&").
Bitwise OR of signed byte value (BIT_IOR_OF_SIGNED_BYTE)
Loads a value from a byte array and performs a bitwise OR with that value. Values loaded from byte arrays are signed bytes, and thus this may not give the desired results.
DMI
Invocation of substring(0), which returns the original value (DMI_USELESS_SUBSTRING)
This code invokes substring(0) on a String, which returns the original value.
DM
Method invokes System.exit(...) (DM_EXIT)
Invoking System.exit shuts down the entire Java virtual machine. This should only been done when it is appropriate. Such calls make it hard or impossible for your code to be invoked by other code. Consider throwing a RuntimeException instead.
Method invokes dubious Boolean constructor; use Boolean.valueOf(...) instead (DM_BOOLEAN_CTOR)
Creating new instances of java.lang.Boolean wastes memory, since Boolean objects are immutable and there are only two useful values of this type. Use the Boolean.valueOf() method to create Boolean objects instead.
Method invokes runFinalizersOnExit, one of the most dangerous methods in the Java libraries. (DM_RUN_FINALIZERS_ON_EXIT)
Never call System.runFinalizersOnExit or Runtime.runFinalizersOnExit for any reason: they are among the most dangerous methods in the Java libraries. -- Joshua Bloch
Can't use reflection to check for presense of annotation with default retention (DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION)
Unless an annotation has itself been annotated with a @Retention other than the default of source-only retention, the annotation isn't retained in the classfile and can't be observed using reflection (e.g., by using the isAnnotationPresent method).
Method invokes dubious String.toUpperCase() or String.toLowerCase; use the Locale parameterized version instead (DM_CONVERT_CASE)
A String is being converted to upper or lowercase, using the platform's default encoding. This may result in improper conversions when used with international characters. Use the String.toUpperCase( Locale l ) String.toLowerCase( Locale l ) versions instead.
INT
Integer remainder modulo 1 (INT_BAD_REM_BY_1)
Any expression (exp % 1) is guaranteed to always return zero. Did you mean (exp & 1) or (exp % 2) instead?

