Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by sciSpider Java v3.0

...

Code Block
bgColor#FFcccc
public class Example<T>Example&lt;T&gt; {
  private T a, b, c[], d;

  public Example(T in){
    a = in;
    b = in;
    c = (T[]) new Object[10];
    d = in;
  }
}

...

Code Block
// Correct functional implementation
public String toString(){
  String s = a.toString() + b.toString();
  for(int i = 0; i <&lt; c.length; i++){
    s += c[i].toString();
  }
  s += d.toString();
  return s;
}

...

Code Block
bgColor#ccccff
for (int i = 0; i <&lt; mx; ++i ) {
  /* ... */
}

Risk Assessment

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

References

Wiki Markup
\[[JLS 05|AA. Java References#JLS 05]\] Section 6.1, "Declarations"&quot;Declarations&quot;, Section 4.3.2, "&quot;The class Object"&quot;
\[[ESA 05|AA. Java References#ESA 05]\] Rule 9: Put single variable definitions in separate lines.
\[[Conventions 09|AA. Java References#Conventions 09]\] 6.1 Number Per Line

...

DCL03-J. Use meaningful symbolic constants to represent literal values in program logic      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;03. Declarations and Initialization (DCL)      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DCL05-J. Properly encode relationships in constant definitions