typetools / typetools/checker-framework

Should the default stub of JUnit asserts like assertNotNull really be NotNull?

Open
#6,475 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

I am aware of checker/src/main/java/org/checkerframework/checker/nullness/permit-nullness-assertion-exception.astub

But I have to seriously wonder why the default is not the above particularly since JUnit does not actually throw NPE on assertNotNull but rather a junit specific assertion exception?

It seems like this would hurt uptake of the library and doesn't really offer any advantage. I also could not find the junit4 astub so is this a blanket of all methods named assertNotNull?

I have feeling this has probably been discussed before but I just could not find it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with checker/src/main/java/org/checkerframework/checker/nullness/permit-nullness-assertion-exception.astub and trace how JUnit assertion stubs are selected, including whether the rule applies to JUnit 4. Compare the current default with the proposed nullness behavior; done requires a maintainer-agreed decision and corresponding implementation or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
49/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.