Java Code Metrics
Rules available in this category:
- Maximum_complexity
- Maximum_number_of_fields
- Maximum_number_of_casts_to_concrete_collection_types
- Maximum_number_of_init_and_update_statements_in_for
- Maximum_number_of_return_statements
- Maximum_number_of_non_final_static_variables
- Maximum_number_of_methods
- Nested_if_depth
- Nested_try_depth
- Nested_loop_depth
- Reduce_boolean_expression_complexity
- Reduce_coupling_between_objects
- Avoid_excessive_public_count
- Maximum_number_of_parameters
- Maximum_cases
- Maximum_number_of_constructors
- Maximum_number_of_imports
- Ensure_java_files_follow_the_limit_for_percentage_of_Javadoc_comments
- Maximum_number_of_method_calls
- Maximum_number_of_statements_in_method
- Maximum_number_of_nested_control_statements
- Maximum_number_of_nested_method_invocations
- Maximum_number_of_chained_method_invocations
- Maximum_number_of_distinct_variables_and_return_types
- Maximum_number_of_statements_in_switch_case
- Maximum_number_of_statements_in_class
- Maximum_number_of_statements_in_anonymous_class
- Maximum_number_of_exceptions_in_throws
Rule 1: Maximum_complexity
Severity:
Medium
Rule:
Complexity is too high.
Reason:
Complexity is too high.
Usage Example:
package com.rule;
public class Maximum_complexity_violation
{
int i, j, k, l;
public void decisionMaker()
{
1 if (i == j)
{
2 if (i == 0)
{
//.....
}
3 else if (i > 0)
{
//.....
}
else
{
//.....
}
}
4 else if (k == 0)
{
5 while (k < 10)
{
k++;
//.....
}
}
6 else if (l == 10)
{
7 for (int n = 0; n < l; n++) // VIOLATION (complexity is more than 6)
{
//.....
}
}
}
}
Should be written as:
Reduce the Complexity of the method.
Reference:
http://www.onjava.com/pub/a/onjava/2004/06/16/ccunittest.html
Rule 2: Maximum_number_of_fields
Severity:
Medium
Rule:
The number of fields in a class indicates the amount of data the class must maintain in order to carry out its responsibilities
Reason:
The number of fields in a class indicates the amount of data the class must maintain in order to carry out its responsibilities
Usage Example:
No example available.
Should be written as:
No example available.
Reference:
Mark Schroeder: A Practical Guide to Object-Oriented Metrics
Rule 3: Maximum_number_of_casts_to_concrete_collection_types
Severity:
Medium
Rule:
Having too many casts to concrete implementations will make it difficult to switch to another concrete implementation in the future.
Reason:
Having too many casts to concrete implementations will make it difficult to switch to another concrete implementation in the future.
Usage Example:
import java.util.*;
public class Test
{
public void method(Object o)
{
Iterator iter= ((ArrayList)o).iterator(); // VIOLATION
}
}
Should be written as:
import java.util.*;
public class Test
{
public void method(Object o)
{
Iterator iter= ((Collection)o).iterator(); // FIXED
}
}
Reference:
Not available.
Rule 4: Maximum_number_of_init_and_update_statements_in_for
Severity:
Medium
Rule:
Having too many statements in the initialization or update part of a for statement can make the code difficult to read.
Reason:
Having too many statements in the initialization or update part of a for statement can make the code difficult to read.
Usage Example:
public class Test
{
for(i=0, j=0, k=0, l=0; i<10; i++, j++, k++, l++) // VIOLATION
{
i++;
}
}
Should be written as:
public class Test
{
l= 0;
for(i=0, j=0, k=0; i<10; i++, j++, k++) // FIXED
{
i++;
l++;
}
}
Reference:
http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html
Rule 5: Maximum_number_of_return_statements
Severity:
Medium
Rule:
Large number of return statements increase code complexity.
Reason:
Large number of return statements increase code complexity.
Usage Example:
public class MyClass
{
public boolean isNull ( Object s ) // VIOLATION
{
if ( s == null )
{
return true;
}
return false;
}
}
Should be written as:
public class MyClass
{
public boolean isNull ( Object s) // CORRECTION
{
return s == null ? true : false;
}
}
Reference:
No references available.
Rule 6: Maximum_number_of_non_final_static_variables
Severity:
Medium
Rule:
Static variables make methods more context-dependent, hide possible side-effects, sometimes present synchronized access problems. and are the source of fragile, non-extensible constructions.
Reason:
Static variables make methods more context-dependent, hide possible side-effects, sometimes present synchronized access problems. and are the source of fragile, non-extensible constructions.
Usage Example:
public class MyClass
{
private static int s_size;
public static int s_count;
static String s_title; // VIOLATION
static void setFields (int size, String title)
{
s_size = size;
s_title = title;
s_count++;
}
}
Should be written as:
Try to minimize non-"final" "static" fields if possible.
Reference:
http://g.oswego.edu/dl/html/javaCodingStd.html
Rule 7: Maximum_number_of_methods
Severity:
Medium
Rule:
The number of methods in a class indicates the amount of functionality implemented by a class.
Reason:
The number of methods in a class indicates the amount of functionality implemented by a class.
Usage Example:
No Example Available.
Should be written as:
No Example Available.
Reference:
Mark Schroeder: A Practical Guide to Object-Oriented Metrics.
Rule 8: Nested_if_depth
Severity:
Medium
Rule:
Avoid nesting if..then statements.
Reason:
Avoid nesting if..then statements.
Usage Example:
public class AvoidNestedIfs
{
public void aMethod()
{
if(someCondition)
{
if(someCondition)
{
if(someCondition) // VIOLATION
}
}
}
}
Should be written as:
Keep the nested if depth maximum to parameter value set (default is 1).
Reference:
http://xsun.sdct.itl.nist.gov/HHRFdata/Artifacts/ITLdoc/235/chaptera.htm
Rule 9: Nested_try_depth
Severity:
Medium
Rule:
Avoid nesting try statements.
Reason:
Avoid nesting try statements.
Usage Example:
public class MyClass
{
public void myMethod(int i)
{
try
{
//...
try
{
//...
try // VIOLATION
{
}
catch (NoSuchElementException e)
{
//...
}
}
catch (FileNotFoundException e)
{
//...
}
}
catch (IOException e)
{
//...
}
}
}
Should be written as:
public class MyClass
{
public void myMethod(int i)
{
try //FIXED
{
//...
//...
//...
}
catch (NoSuchElementException e)
{
//...
}
catch (FileNotFoundException e)
{
//...
}
catch (IOException e)
{
//...
}
}
}
Reference:
No references available.
Rule 10: Nested_loop_depth
Severity:
Medium
Rule:
Avoid nesting loop statements.
Reason:
Avoid nesting loop statements.
Usage Example:
public class AvoidNestedLoops
{
public void aMethod()
{
for ( ... )
for ( ... )
for ( ... ) // VIOLATION
}
}
Should be written as:
Reference:
No references available.
Rule 11: Reduce_boolean_expression_complexity
Severity:
Medium
Rule:
Reduce complexity of boolean expression.
Reason:
Reduce complexity of boolean expression.
Usage Example:
public class ReduceBooleanExpDepth
{
public void aMethod()
{
if(someCondition && (someCondition || someCondition)
&& someCondition && someCondition) // VIOLATION
{
//...
}
}
}
Should be written as:
Reduce the number of boolean expression in order to reduce complexity.
Reference:
No references available.
Rule 12: Reduce_coupling_between_objects
Severity:
Medium
Rule:
Reduce coupling between objects.
Reason:
Reduce coupling between objects.
Usage Example:
package com.rule;
public class Reduce_coupling_between_objects_violation // Violation. ( When threshold value is 4.)
{
int i;
double d;
String str = "AppPerfect";
boolean status = true;
short s ;
public void method(int a,String str)
{
}
public int method1(int b)
{
int i = 10 + b ;
return i;
}
}
Should be written as:
Reference:
Reference not available.
Rule 13: Avoid_excessive_public_count
Severity:
Medium
Rule:
Avoid having excessive public count.
Reason:
Avoid having excessive public count.
Usage Example:
package com.rule;
public class Avoid_excessive_public_count_violation // Violation. ( When threshold value is 10.)
{
public int i;
public double d;
public String str = "AppPerfect";
public boolean status = true;
public short s ;
public void method()
{
}
public void method1()
{
}
public void method2()
{
}
public void method3()
{
}
public void method4()
{
}
public void method5()
{
}
}
Should be written as:
Reference:
Reference not available.
Rule 14: Maximum_number_of_parameters
Severity:
Medium
Rule:
The number of parameters in a method / constructor indicates the amount of functionality implemented by it.
Reason:
The number of parameters in a method / constructor indicates the amount of functionality implemented by it.
Usage Example:
package com.rule;
public class Maximum_number_of_parameters_violation
{
public Maximum_number_of_parameters_violation(int param1, int param2, int param3, int param4, int param5, int param6) // VIOLATION
{
}
public void method1(int param1, int param2, int param3, int param4, int param5, int param6) // VIOLATION
{
}
public void method2(int param1, int param2, int param3, int param4, int param5)
{
}
}
Should be written as:
Try to separate out the functionality of the method such that it will reduce the number of parameters passed to any of the methods.
Reference:
No reference available.
Rule 15: Maximum_cases
Severity:
Medium
Rule:
Number of cases should not be more than the specified value.
Reason:
Number of cases should not be more than the specified value.
Usage Example:
package com.rule;
public class Maximum_cases_violation
{
public void method(int key)
{
switch (key)
{ // contains 257 cases (including "default")
case 1 :
break;
case 2 :
case 3 :
break;
case 4 :
{
}
break;
case 5 :
{
break;
}
case 6 :
{
}
case 7 :
default:
{
}
case 8 : { break; }
case 9 : { break; }
case 10 : { break; }
case 11 : { break; }
case 12 : { break; }
case 13 : { break; }
case 14 : { break; }
case 15 : { break; }
case 16 : { break; }
case 17 : { break; }
case 18 : { break; }
case 19 : { break; }
case 20 : { break; }
case 21 : { break; }
case 22 : { break; }
case 23 : { break; }
case 24 : { break; }
case 25 : { break; }
case 26 : { break; }
case 27 : { break; }
case 28 : { break; }
case 29 : { break; }
case 30 : { break; }
case 31 : { break; }
case 32 : { break; }
case 33 : { break; }
case 34 : { break; }
case 35 : { break; }
case 36 : { break; }
case 37 : { break; }
case 38 : { break; }
case 39 : { break; }
case 40 : { break; }
case 41 : { break; }
case 42 : { break; }
case 43 : { break; }
case 44 : { break; }
case 45 : { break; }
case 46 : { break; }
case 47 : { break; }
case 48 : { break; }
case 49 : { break; }
case 50 : { break; }
case 51 : { break; }
case 52 : { break; }
case 53 : { break; }
case 54 : { break; }
case 55 : { break; }
case 56 : { break; }
case 57 : { break; }
case 58 : { break; }
case 59 : { break; }
case 60 : { break; }
case 61 : { break; }
case 62 : { break; }
case 63 : { break; }
case 64 : { break; }
case 65 : { break; }
case 66 : { break; }
case 67 : { break; }
case 68 : { break; }
case 69 : { break; }
case 70 : { break; }
case 71 : { break; }
case 72 : { break; }
case 73 : { break; }
case 74 : { break; }
case 75 : { break; }
case 76 : { break; }
case 77 : { break; }
case 78 : { break; }
case 79 : { break; }
case 80 : { break; }
case 81 : { break; }
case 82 : { break; }
case 83 : { break; }
case 84 : { break; }
case 85 : { break; }
case 86 : { break; }
case 87 : { break; }
case 88 : { break; }
case 89 : { break; }
case 90 : { break; }
case 91 : { break; }
case 92 : { break; }
case 93 : { break; }
case 94 : { break; }
case 95 : { break; }
case 96 : { break; }
case 97 : { break; }
case 98 : { break; }
case 99 : { break; }
case 100 : { break; }
case 101 : { break; }
case 102 : { break; }
case 103 : { break; }
case 104 : { break; }
case 105 : { break; }
case 106 : { break; }
case 107 : { break; }
case 108 : { break; }
case 109 : { break; }
case 110 : { break; }
case 111 : { break; }
case 112 : { break; }
case 113 : { break; }
case 114 : { break; }
case 115 : { break; }
case 116 : { break; }
case 117 : { break; }
case 118 : { break; }
case 119 : { break; }
case 120 : { break; }
case 121 : { break; }
case 122 : { break; }
case 123 : { break; }
case 124 : { break; }
case 125 : { break; }
case 126 : { break; }
case 127 : { break; }
case 128 : { break; }
case 129 : { break; }
case 130 : { break; }
case 131 : { break; }
case 132 : { break; }
case 133 : { break; }
case 134 : { break; }
case 135 : { break; }
case 136 : { break; }
case 137 : { break; }
case 138 : { break; }
case 139 : { break; }
case 140 : { break; }
case 141 : { break; }
case 142 : { break; }
case 143 : { break; }
case 144 : { break; }
case 145 : { break; }
case 146 : { break; }
case 147 : { break; }
case 148 : { break; }
case 149 : { break; }
case 150 : { break; }
case 151 : { break; }
case 152 : { break; }
case 153 : { break; }
case 154 : { break; }
case 155 : { break; }
case 156 : { break; }
case 157 : { break; }
case 158 : { break; }
case 159 : { break; }
case 160 : { break; }
case 161 : { break; }
case 162 : { break; }
case 163 : { break; }
case 164 : { break; }
case 165 : { break; }
case 166 : { break; }
case 167 : { break; }
case 168 : { break; }
case 169 : { break; }
case 170 : { break; }
case 171 : { break; }
case 172 : { break; }
case 173 : { break; }
case 174 : { break; }
case 175 : { break; }
case 176 : { break; }
case 177 : { break; }
case 178 : { break; }
case 179 : { break; }
case 180 : { break; }
case 181 : { break; }
case 182 : { break; }
case 183 : { break; }
case 184 : { break; }
case 185 : { break; }
case 186 : { break; }
case 187 : { break; }
case 188 : { break; }
case 189 : { break; }
case 190 : { break; }
case 191 : { break; }
case 192 : { break; }
case 193 : { break; }
case 194 : { break; }
case 195 : { break; }
case 196 : { break; }
case 197 : { break; }
case 198 : { break; }
case 199 : { break; }
case 200 : { break; }
case 201 : { break; }
case 202 : { break; }
case 203 : { break; }
case 204 : { break; }
case 205 : { break; }
case 206 : { break; }
case 207 : { break; }
case 208 : { break; }
case 209 : { break; }
case 210 : { break; }
case 211 : { break; }
case 212 : { break; }
case 213 : { break; }
case 214 : { break; }
case 215 : { break; }
case 216 : { break; }
case 217 : { break; }
case 218 : { break; }
case 219 : { break; }
case 220 : { break; }
case 221 : { break; }
case 222 : { break; }
case 223 : { break; }
case 224 : { break; }
case 225 : { break; }
case 226 : { break; }
case 227 : { break; }
case 228 : { break; }
case 229 : { break; }
case 230 : { break; }
case 231 : { break; }
case 232 : { break; }
case 233 : { break; }
case 234 : { break; }
case 235 : { break; }
case 236 : { break; }
case 237 : { break; }
case 238 : { break; }
case 239 : { break; }
case 240 : { break; }
case 241 : { break; }
case 242 : { break; }
case 243 : { break; }
case 244 : { break; }
case 245 : { break; }
case 246 : { break; }
case 247 : { break; }
case 248 : { break; }
case 249 : { break; }
case 250 : { break; }
case 251 : { break; }
case 252 : { break; }
case 253 : { break; }
case 254 : { break; }
case 255 : { break; }
case 256 : { break; }
}
}
}
Should be written as:
Avoid using too many cases.
Reference:
No Reference available.
Rule 16: Maximum_number_of_constructors
Severity:
Medium
Rule:
The number of constructors in a class indicate the amount of functionality implemented by a class.
Reason:
The number of constructors in a class indicate the amount of functionality implemented by a class.
Usage Example:
package com.rule;
public class Maximum_number_of_constructors_violation // VIOLATION
{
private int ID;
private String sName;
private boolean bFlag;
public Maximum_number_of_constructors_violation()
{
this(-1, null, false);
}
public Maximum_number_of_constructors_violation(int id)
{
this(id, null, false);
}
public Maximum_number_of_constructors_violation(String name)
{
this(-1, name, false);
}
public Maximum_number_of_constructors_violation(int id, String name)
{
this(id, name, false);
}
public Maximum_number_of_constructors_violation(String name, boolean flag)
{
this(-1, name, flag);
}
public Maximum_number_of_constructors_violation(int id, String name, boolean flag)
{
ID = id;
sName = name;
bFlag = flag;
}
}
Should be written as:
Try to reduce the number of constructors.
Reference:
No reference available.
Rule 17: Maximum_number_of_imports
Severity:
Low
Rule:
A file with many import statements could indicate highcoupling within an object.
Reason:
A file with many import statements could indicate highcoupling within an object.
Usage Example:
//VIOLATION, more than 20 import statements
import java.util.Vector;
import java.util.Set;
import java.util.ArrayList;
//... 20+ more imports (some unused)
public class Test
{
// ...
}
Should be written as:
Reorganized imports by removing unused import statements
Reference:
No references available.
Rule 18: Ensure_java_files_follow_the_limit_for_percentage_of_Javadoc_comments
Severity:
Low
Rule:
Every class, interface, method and field should have a Javadoc comment associated with it.
Reason:
Every class, interface, method and field should have a Javadoc comment associated with it.
Usage Example:
/**
* @author AppPerfect Corp.
*
*/
public class MyClass // VIOLATION
/**
* Field stores some value
*/
public int field1;
public int field2;
/**
* This method performs some calculation
*/
public void method1()
{
//...
}
public void method2()
{
//....
}
class Inner
{
//....
}
}
Should be written as:
Ensure that the percentage of Javadoc comments is within the specified limits.
Reference:
By Mark Schroeder "A Practical Guide to Object-Oriented Metrics" IT Pro, November/December, 1999.
Rule 19: Maximum_number_of_method_calls
Severity:
Medium
Rule:
The number of method calls in a method indicates the amount of functionality implemented by a class.
Reason:
The number of method calls in a method indicates the amount of functionality implemented by a class.
Usage Example:
No Example Available.
Should be written as:
Avoid too many method calls.
Reference:
Reference not available.
Rule 20: Maximum_number_of_statements_in_method
Severity:
Medium
Rule:
The number of statements in a method indicates the amount of functionality implemented by a method.
Reason:
The number of statements in a method indicates the amount of functionality implemented by a method.
Usage Example:
No example available.
Should be written as:
Avoid too many statements.
Reference:
Reference not available.
Rule 21: Maximum_number_of_nested_control_statements
Severity:
Medium
Rule:
Deeply nesting control statements make the code complicated and as a result of which increases the chances of it being error-prone.
Reason:
Deeply nesting control statements make the code complicated and as a result of which increases the chances of it being error-prone.
Usage Example:
public class Test
{
public static int getNonVowelCount(String string)
{
int count= 0;
if (string!= null) // VIOLATION
{
string= string.trim();
for (int i= 0; i< string.length(); i++)
{
char currentChar= string.charAt(i);
if (currentChar!= 'a')
{
if (currentChar!= 'e')
{
if (currentChar!= 'i')
{
if (currentChar!= 'o')
{
if (currentChar!= 'u')
{
count++;
}
}
}
}
}
}
}
return count;
}
}
Should be written as:
public class Test
{
public static int getNonVowelCount(String string)
{
int count= 0;
if (string== null) // FIXED
{
return count;
}
for (int i= 0; i< string.length(); i++) // FIXED
{
if (!isVowel(string.charAt(i)))
{
count++;
}
}
return count;
}
public static boolean isVowel(char character)
{
return character== 'a'
|| character== 'e'
|| character== 'i'
|| character== 'o'
|| character== 'u';
}
}
Reference:
Not available.
Rule 22: Maximum_number_of_nested_method_invocations
Severity:
Medium
Rule:
Nested method invocations could be hard to read and debug.
Reason:
Nested method invocations could be hard to read and debug.
Usage Example:
public class Test
{
public static String getStringStartsWithChar(String string, Character character)
{
return string.substring(string.indexOf(character.charValue())); // VIOLATION
}
}
Should be written as:
public class Test
{
public static String getStringStartsWithChar(String string, Character character)
{
int charIndex= string.indexOf(character.charValue()); // FIXED
if (charIndex!= -1)
{
return string.substring(charIndex); // FIXED
}
return null;
}
}
Reference:
http://xp.c2.com/CodeSmell.html
Rule 23: Maximum_number_of_chained_method_invocations
Severity:
Medium
Rule:
Chained method invocations could be hard to read and debug.
Reason:
Chained method invocations could be hard to read and debug.
Usage Example:
public class Test
{
public static boolean isFlagTrue(String flagName)
{
return System.getProperty(flagName).trim().toLowerCase().equals("true"); // VIOLATION
}
}
Should be written as:
public class Test
{
public static boolean isFlagTrue(String flagName)
{
String flagValue= System.getProperty(flagName); // FIXED
if (flagValue!= null)
{
flagValue= flagValue.trim().toLowerCase();
return flagValue.equals("true");
}
return false;
}
}
Reference:
Not available.
Rule 24: Maximum_number_of_distinct_variables_and_return_types
Severity:
Medium
Rule:
Too many distinct types used indicate tight coupling between classes.
Reason:
Too many distinct types used indicate tight coupling between classes.
Usage Example:
import java.util.*;
public class Test // VIOLATION- Class uses 21 different types.
{
Formatter var19;
public HashMap method(GregorianCalendar p1)
{
AbstractCollection var1;
AbstractList var2;
AbstractMap var3;
AbstractQueue var4;
AbstractSequentialList var5;
AbstractSet var6;
ArrayList var7;
Arrays var8;
BitSet var9;
Calendar var10;
Collections var11;
Date var12;
Dictionary var13;
EnumMap var14;
EnumSet var15;
EventListenerProxy var16;
EventObject var17;
FormattableFlags var18;
EventObject var19;
FormattableFlags[] var21;
FormattableFlags[][] var20;
List var22;
return new HashMap();
}
}
Should be written as:
Use interface instead of class types for variables and return types to follow
the coding practice of "loose coupling". This makes the code less dependent on specific implementations. Also, consider breaking up the class into multiple
classes if it is too long or too complex.
Reference:
Not available.
Rule 25: Maximum_number_of_statements_in_switch_case
Severity:
Medium
Rule:
A large switch-case could promote erroneous and unreadable code.
Reason:
A large switch-case could promote erroneous and unreadable code.
Usage Example:
public class MyClass
{
public void aMethod( int i )
{
switch ( i )
{
case 0: // VIOLATION
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("Hello World");
System.out.println("end");
case 1:
System.out.println("Hello World");
System.out.println("Hello World");
default:
System.out.println("Hello World");
}
}
}
Should be written as:
public class MyClass
{
public void aMethod( int i )
{
switch ( i )
{
case 0: // FIXED
printHelloWord();
case 1:
System.out.println("Hello World");
System.out.println("Hello World");
default:
System.out.println("Hello World");
}
}
public void printHelloWord()
{
for ( int i = 0; i < 11; ++i)
{
System.out.println("Hello World");
}
System.out.println("end");
}
}
Reference:
No references available.
Rule 26: Maximum_number_of_statements_in_class
Severity:
Medium
Rule:
The number of statements in a class indicates the amount of work done by a class.
Reason:
The number of statements in a class indicates the amount of work done by a class.
Usage Example:
No example available.
Should be written as:
Avoid too many statements in class.
Reference:
Reference not available.
Rule 27: Maximum_number_of_statements_in_anonymous_class
Severity:
Medium
Rule:
The number of statements in an anonymous class indicates the amount of work done by the class.
Reason:
The number of statements in an anonymous class indicates the amount of work done by the class.
Usage Example:
public class SomeClass
{
Object obj= new Object() //VIOLATION
{
public void toString()
{
/*
...
...
...
code more than 30 lines
*/
}
//end of anonymous class declaration
};
}
Should be written as:
public class SomeClass
{
Object obj= new MyClass(); // CORRECTION
class MyClass {
public void toString()
{
/*
...
...
...
code more than 30 lines
*/
}
//end of MyClass declaration
}
}
Reference:
No references available.
Rule 28: Maximum_number_of_exceptions_in_throws
Severity:
Medium
Rule:
The number of exceptions in throws clause indicates possible exception paths out of the method.
Reason:
The number of exceptions in throws clause indicates possible exception paths out of the method.
Usage Example:
package com.rule;
public class Maximum_number_of_exceptions_in_throws_violation
{
public void method() throws IOException,FileNotFoundException // Violation
{
// Some Code.
}
}
Should be written as:
Try to reduce the number of exceptions in throws clause.
Reference:
Reference not available.