...
Code Block | ||
---|---|---|
| ||
public class Example<T>Example<T> { 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 << c.length; i++){ s += c[i].toString(); } s += d.toString(); return s; } |
...
Code Block | ||
---|---|---|
| ||
for (int i = 0; i << 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""Declarations", Section 4.3.2, ""The class Object"" \[[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 03. Declarations and Initialization (DCL) DCL05-J. Properly encode relationships in constant definitions