Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Failing to use bounded wildcards ("? extends T" or "? super T") can reduce the usefulness of generic classes and force clients to develop clumsy workarounds to use such classes. Bounded wildcards improve code flexibility, but are often not used because they are perceived as unnecessaryGeneric code is free to be used with raw types, preserving the compatibility of non-generic legacy code and newer generic code. However, using raw types with generic code will cause the java compiler to issue "unchecked" warnings. When generic and non-generic code are used correctly together these warnings are no threat, but the same warnings are issued when unsafe operations are performed. If generic and non-generic code must be used together these warnings should not be simply ignored.

Noncompliant Code Example

TODO

Code Block
bgColor#FFCCCC
 TODO

Compliant Solution

TODO

Code Block
bgColor#ccccff
 TODO

Risk Assessment

TODO

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

MSC10-J

---

---

Automated Detection

TODO

Related Vulnerabilities

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

References

TODO