You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reference Implementation scope. I propose that it should be as narrow as possible. It should not be a production-ready static analysis tool. Probably it should be limited to a library + testcases which 1) provides a set of model classes to represent new types, similar to the corresponding Javac classes (probably extending them), 2) provides a way to get a type of given code element (field, method, parameter), 3) for two given types A and B checks whether A is a subtype of B. This is enough to make unambiguous interpretation of annotations. Producing actual warnings should be out of scope of RI, thus we should not care whether method call changes field or not, how we should treat synchronization, object initialization, etc. This could be a part of errorprone, as a separate Google project which could depend on RI library. Otherwise it would be too much for our purposes.
I don't think the RI should provide extensions to the Java language model, implement ways to query for a type, etc.
Two things can be enforced:
All annotations are used in meaningful ways, e.g. forbid @Nullable @NotNull and any annotation on primitives. Enforce TYPE_USE restrictions listed in Issue TYPE_USE locations and their semantics for nullness #17. TODO: produce full list of these consistency checks.
Behavioral subtyping, that is, annotations on an override are consistent with the super method.
In particular, we should refrain from prescribing when nullness errors should be raised in expressions. Different static analysis tools will provide additional refinement, e.g. pre-condition annotations, that refine a field that is declared nullable to be not-null.
We should also not guarantee that all dereferences of something @NotNull will be allowed - e.g. the Checker Framework provides fine-grained initialization checking that makes sure uninitialized fields aren't used. This will result in errors for uses of a not-null field.
Activity
wmdietlGC commentedon Jan 10, 2019
I don't think the RI should provide extensions to the Java language model, implement ways to query for a type, etc.
Two things can be enforced:
@Nullable @NotNulland any annotation on primitives. Enforce TYPE_USE restrictions listed in Issue TYPE_USE locations and their semantics for nullness #17. TODO: produce full list of these consistency checks.In particular, we should refrain from prescribing when nullness errors should be raised in expressions. Different static analysis tools will provide additional refinement, e.g. pre-condition annotations, that refine a field that is declared nullable to be not-null.
We should also not guarantee that all dereferences of something
@NotNullwill be allowed - e.g. the Checker Framework provides fine-grained initialization checking that makes sure uninitialized fields aren't used. This will result in errors for uses of a not-null field.kevinb9n commentedon Jun 17, 2019
Narrow works for us.
kevinb9n commentedon May 20, 2020
By #92 there won't be an RI.