Open GoogleCodeExporter opened 9 years ago
Thanks for the bug report!
The issue is that field "value" is private. When you make the field
default/public, you get the expected error message:
Issue391.java:14: error: [contracts.precondition.not.satisfied] the called
method 'a.getValue()' has a precondition 'a.value' that is not satisfied
a.getValue();
The problem is that when the field is private, the caller doesn't know about
the field and has no way of setting it. So at the moment we don't issue errors
for such fields.
We should discuss the interaction between visibility and pre/post-conditions,
which has been on our list.
Original comment by wdi...@gmail.com
on 11 Jan 2015 at 3:20
A simple approach is to treat that all private fields and methods as
spec-public.
(I thought this was already how the Checker Framework behaved.) I think this
is a reasonable tradeoff between complexity and expressiveness.
I do think it's important that a checker should issue a warning even when the
field is private.
Original comment by michael.ernst@gmail.com
on 12 Jan 2015 at 11:31
Thank you very much for your replies.
Since I would love to have @RequiresNonNull and @EnsuresNonNull* working with
private fields I had a look at the classes in package
org.checkerframework.checker.nullness for a place where I could modify the code
to obtain the desired effect but I couldn't find anything.
So, provided it's a small change, I'd like to have a hint on where to look.
This way if you decide that it's not appropriate to change the framework I can
still use a patched version.
Original comment by karlsand...@gmail.com
on 12 Jan 2015 at 12:03
Original comment by mcart...@cs.washington.edu
on 15 Jan 2015 at 4:25
Original comment by jtha...@cs.washington.edu
on 8 Apr 2015 at 9:10
Original issue reported on code.google.com by
karlsand...@gmail.com
on 11 Jan 2015 at 9:22Attachments: