because this is actually a very common situation.
but in jsr305 we can only have nullable, or nonnull, means a return value shall be either nullable or nonnull. but life always happened like this:(code from maven if you ask)

@Nullable
public static org.apache.maven.artifact.Artifact toArtifact(@Nullable Dependency dependency) {
if (dependency == null) {
return null;
}
org.apache.maven.artifact.Artifact result = toArtifact(dependency.getArtifact());
result.setScope(dependency.getScope());
result.setOptional(dependency.isOptional());
return result;
}
what we really want to mark is , [if the param dependency be null, then return value be null,otherwise if the param dependency be notnull, then the return value is nonnull].
but what we get is we can only mark it as [the param dependency can be null; and the return value can be null]
the coresponse meaning is lost...
so is there any ideas for this situations?
I know there be a way that to split another function named [toArtifactNonNull] or something, and mark it as nonnull in, nonnull out, yes it can work, though complex and somehow ugly.
we want to have something like @Nullable(expression="isNullable(dependency)") or something...