java - @NonNull triggers warning in Eclispse although constant value used -
i have got following method definition:
public static @nullable string getfile(@nonnull final path path, @nonnull final charset charset) and invoking method somewhere else following statement:
final string filestring = fileutil.getfile(filepath, standardcharsets.utf_8); however, i'm using import org.eclipse.jdt.annotation.nonnull annotation eclipse triggers warning:
why warning triggered although i'm using constant (i.e. standardcharsets.utf8)?
the declaration standardcharsets.utf_8 is:
public static final charset utf_8 = charset.forname("utf-8"); as far eclipse null analysis concerned possible charset.forname might return null @notnull can't guaranteed.

Comments
Post a Comment