On 06/22/2011 09:55 AM, Heiko W.Rupp wrote:
So I am seeing those errors in server log a lot when e.g. scheduling
operations:
Caused by: java.lang.IllegalArgumentException: Argument 0 for @NotNull
parameter of org/rhq/core/domain/resource/Resource.setName must not
be null
at org.rhq.core.domain.resource.Resource.setName(Resource.java)
While I am not sure who or what is adding that crazy check to my classes,
I really think it must be IntelliJ. They are JetBrains annotations, so
I'd be surprised if things like the maven compiler plugin recognized them.
from the following code:
public void setName(@NotNull String name) {
this.name = name;
}
I think as we do obviously have code parts in the Configuration world that seem
to call this setter with a null argument, we should either
- remove that annotation, as reality has proven that it is wrong
or
- fix the code that is calling this setter with a null argument
Agreed. That's the main point of those annotations - to define a
method's contract regarding null parameters, and when the IDE catches
callers not following the contract, either change the callers or change
the contract.