Nullness checker problem with @Nullable arrays and inheritance

2 views
Skip to first unread message

Piotr Zielinski

unread,
Nov 16, 2009, 11:55:15 AM11/16/09
to Type annotations (JSR 308) discussions
I'd like to report a potential regression. The following used to work
in previous versions of the nullness checker:

interface TestA {
public char /*@Nullable*/ [] getChars();
}

class TestB implements TestA {
@Override public char /*@Nullable*/ [] getChars() { return null; }
}

In javac 1.7.0-jsr308-1.0.1, it fails with

getChars() in TestB cannot override getChars() in TestA; attempting to
use an incompatible return type
@Override public char /*@Nullable*/ [] getChars() { return null; }
^
found : @NonNull char @Nullable []
required: @NonNull char @NonNull []

Thanks,
Piotr

Michael Ernst

unread,
Nov 16, 2009, 4:52:31 PM11/16/09
to jsr308-...@googlegroups.com, piotr.z...@gmail.com
Piotr-

> I'd like to report a potential regression.

This looks like a bug. Thanks for letting us know, and for providing a
simple test case. We appreciate it.

I've added your test case to our test suite, so this will be fixed before
the next release of the Checker Framework.

Let us know if you have any other problems.

-Mike

PS: The best way to report a Checker Framework bug is to use the issue
tracker at http://code.google.com/p/checker-framework/issues/list . If you
prefer to use email, you can use either the public list
checker-fram...@googlegroups.com or contact only the developers
at checker-fr...@googlegroups.com. But the issue tracker tends to
be most useful to us.

Reply all
Reply to author
Forward
0 new messages