-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSpecify and annotated packages option #574
Comments
I started adopting JSpecify annotations in a 20K LOC code base. In line with the recommendations in the JSpecify user guide, I planned to annotate one package after another, adding Having learned that NullAway does not yet support Regarding configuration, I share @msridhar's concerns about just making I suggest adding a second option to control this behavior. It could be called e.g.
|
@bannmann NullAway should support |
Regarding your suggested configurations options @bannmann I like them! We are going to have a messy and probably somewhat lengthy transition over to JSpecify checking, with an unfortunate amount of configuration, in order to not break existing users. I think your options fit well with such a transition plan. If, in your experimentation, it would be beneficial to have a flag that forbids |
@pemistahl @beatbrot continuing from #1042, see the discussion above. We now have a JSpecify mode flag, and we also support @pemistahl if you are seeing a case where Note that we still require the Any thoughts? |
Yeah, I agree with your take @msridhar :) At my company, we have several hundreds of packages and annotating each with Some parts of our codebase however is exported as API. And for this small part, we want to use Edit: Also, I don't see us ever adopting Modules, so while the idea is nice to NullMark a module, it won't help us :) |
Exactly, that's what I have in mind, too. I want to be able to decide whether to check on package level or on class level. We have an application with a very large code base without any static null checks. We would like to gradually add static null checks to this application but we don't want to be enforced to do this for an entire package at a time. Class by class would be much more feasible for us. @msridhar Can you please make this possible? |
This should already be possible.
This issue is about getting rid of 1 and instead providing an option explicitly indicating you don't want to use @pemistahl if the above does not work, could you please file a separate issue, ideally with a standalone reproducer? We will take a look. EDIT: also note that you should not need to pass the JSpecify mode flag for the above to work; |
You are right @msridhar, it works to set |
@msridhar The Spring team is interested by this issue as currently we annotate only packages where null-safety is defined with Configuring We would also be ok with enabling |
This commit replaces NullAway package configuration by package-level `@NullMarked` detection by configuring `NullAway:AnnotatedPackages` to an empty string. NullAway configuration should be refined to use a proper flag instead once uber/NullAway#574 is fixed. See spring-projectsgh-28797
@sdeleuze thanks for the feedback. I can prioritize adding a flag like |
Once we land support for
@NullMarked
, it seems the AnnotatedPackages option would no longer be absolutely necessary. If we end up adding a flag for "JSpecify mode", we could say that at least one of the JSpecify or AnnotatedPackages options should be given (and giving both would of course be supported). We could instead just make AnnotatedPackages optional, but I'm concerned that could lead to confusion for users who are also not using@NullMarked
.The text was updated successfully, but these errors were encountered: