Skip to content

Reference implementation scope #11

Closed

Description

@dzharkov

The question was initially raised by @amaembo:

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.

Activity

  1. wmdietlGC commented on Jan 10, 2019

    @wmdietlGC
    Collaborator

    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.

  2. kevinb9n commented on Jun 17, 2019

    @kevinb9n
    Collaborator

    Narrow works for us.

  3. kevinb9n commented on May 20, 2020

    @kevinb9n
    Collaborator

    By #92 there won't be an RI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions