2

I would like to have return type annotations on method that enable the static analysis of the return type to assure that it is within a set of allowed sub-types. E.g. method returns View and I would like to have something that does something like:

@CheckReturnType(TextView.class, Button.class)
public View getView() {
    return (ImageView) findViewById(R.id.image_view);
}

This would be similar to the recently released Android support annotations for resource type analysis (@LayoutRes, @StringRes, etc.)

Are there any libraries / tutorials that might help in doing this ?

Saad Farooq
  • 13,172
  • 10
  • 68
  • 94

0 Answers0