Skip to content

Add rule to prevent calls to Objects.requireNonNull() #41603

@wilkinsona

Description

@wilkinsona

From @mhalbritter in spring-io/spring-javaformat#339:

We should add a rule preventing calls to Objects.requireNonNull(), instead we should use Assert.notNull() from Spring Framework. Objects.requireNonNull() throws a NullPointerException, while Assert.notNull() throws a IllegalArgumentException.

Checkstyle can't do this accurately. We can do it in our own build instead using ArchUnit by adding a rule to the ArchitectureCheck task.

Metadata

Metadata

Assignees

Labels

status: supersededAn issue that has been superseded by anothertype: taskA general task

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions