Is there a way to reverse the default assumption about nullability?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.1k
- Forks
- 370
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 68
Description
Couldn't find this anywhere in the doco, so I'm assuming no... but thought I'd ask the question. I have a couple of quite large code bases that pretty much assume all fields and parameters are nullable. Eg they have null checks already for everything. There have lots of hibernate and json model objects while have to have empty constructors and null initialised fields.
For these existing code bases, it seems it would be a lot less annotation effort to reverse the assumption and assume @Nullable by default. Then the checker would pick up non checked uses straight away, and we could gradually add @NonNull annotations.
As it is, its going to be too big a task (currently 5k+ combined NullAway and ErrorProne warnings on one of the code bases) to get this happening.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing NullAway's nullability configuration and the interaction with ErrorProne, since no specific file or entry point is identified in the issue. Consider how a nullable-by-default mode would affect Hibernate and JSON model objects, then define the expected behavior and validation needed for a complete proposal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100