Skip to content

Revise nullability of getMessage() in ParameterResolutionException #5451

@wimdeblauwe

Description

@wimdeblauwe

The ParameterResolutionException class is part of a @NullMarked package. The constructors currently look like this:

	public ParameterResolutionException(String message) {
		super(message);
	}

	public ParameterResolutionException(String message, Throwable cause) {
		super(message, cause);
	}

To align with the JUnitException it extends from, this should be changed to:

	public ParameterResolutionException(@Nullable String message) {
		super(message);
	}

	public ParameterResolutionException(@Nullable String message, @Nullable Throwable cause) {
		super(message, cause);
	}

In my project NullAway gives an error for this construct:

    } catch (Exception e) {
      throw new ParameterResolutionException(e.getMessage(), e);
    }

Because e.getMessage() can return null, but ParameterResolutionException now claims it does not accept null.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions