I'm running IntelliJ's Code Analyzer (IntelliJ 11.1.4) on a class and am getting this warning:
Unchecked assignment: 'java.util.List' to 'java.util.List '
The code it complains about is:
List<String> targetDocumentIds = pepperWorkflowInstance.getTargetDocumentIds();
For reference:
public class PepperWorkflowInstance<T extends PepperWorkflowInstanceData> implements Serializable {
private List<String> targetDocumentIds = new ArrayList<String>();
...
public List<String> getTargetDocumentIds() {
return targetDocumentIds;
}
...
}
So the types match... so why would I need to 'check' the assignment?
The general reason to check for self-assignment is because you destroy your own data before copying in the new one. This assignment operator structure is also not strongly exception safe.
You can overload the assignment operator (=) just as you can other operators and it can be used to create an object just like the copy constructor.
Overloading assignment operator in C++ The compiler generates the function to overload the assignment operator if the function is not written in the class. The overloading assignment operator can be used to create an object just like the copy constructor.
Make sure that pepperWorkflowInstance
has parameter:
pepperWorkflowInstance = new PepperWorkflowInstance<SomeClass>();
See IDEA-6254.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With