Greetings Piotr,
I want to thank you again for your continues feed of input! Please
keep it coming!
I admit that generics rules are a bit tricky to implement in many
cases. I'm pushing fixes to both of your issues (which are indeed
bugs!) soon. Sorry got busy with the holidays to fix them promptly.
As for determining whether a behavior is a bug or not; feel free to
email the mailing list or file a bug. Filing a bug would help us
manage the responses probably better, but discussing it over the
mailing lists may add value to the rest of the observers. It's your
call.
However, the rule of thumb for the checker is that if any code
violates the promise of the checker, it is a bug. For example, the
rule of Nullness Checker is that provided a properly type-checked
annotated code with no nullness suppress warnings, a null pointer
exception cannot be thrown at runtime. With `test2`, it is possible
to get a NullPointerException:
static <F extends @Nullable Object> void test2(Collection<F> col) {
col.add(null); }
...
List<@NonNull Object> list = new ArrayList<@NonNull Object>();
test2(list);
list.get(0).toString(); // throws NullPointerException
Hence it's a bug!
Sometimes this gets a bit tricky, like in the other example you provided.
Regards,
Mahmood
On Thu, Dec 3, 2009 at 11:28 AM, Piotr Zielinski