Mandatory method not called after object creation Info

Object creation must be followed by mandatory methods that must be called on the created object.

Detector ID
java/mandatory-methods@v1.0
Category
Common Weakness Enumeration (CWE) external icon

Noncompliant example

1public void checkParameterDescriptionAllCallNoncompliant() {
2    // Noncompliant: does not call mandatory methods on the object after its creation.
3    PutParameterRequest putParameterRequest = new PutParameterRequest();
4    putParameterRequest.setName("parameterName");
5}

Compliant example

1public void checkParameterDescriptionAllCallCompliant() {
2    // Compliant: calls the mandatory methods on the objects after its creation.
3    PutParameterRequest putParameterRequest = new PutParameterRequest();
4    putParameterRequest.setDescription("Description");
5    putParameterRequest.setName("parameterName");
6}