flow icon indicating copy to clipboard operation
flow copied to clipboard

ValueContext constructors javadoc does not agree with code

Open tepi opened this issue 2 years ago • 0 comments

Description of the bug

In ValueContext class, there's some disagreement between javadoc and code in the constructors.

Javadoc states component can be null, but code does a null check anyway:

    /**
     * Constructor for {@code ValueContext}.
     *
     * @param component
     *            The component related to current value. Can be null. If the
     *            component implements {@link HasValue}, it will be returned by
     *            {@link #getHasValue()} as well.
     */
    public ValueContext(Component component) {
        Objects.requireNonNull(component,
                "Component can't be null in ValueContext construction");

Same issue exists for the constructor with signature public ValueContext(Component component, HasValue<?, ?> hasValue).

However the last constructor (public ValueContext(Component component, HasValue<?, ?> hasValue, Locale locale)) has no null check for component parameter.

Expected behavior

Expect these to be consistent.

Minimal reproducible example

n/a

Versions

  • Flow version: 24.4-SNAPSHOT, probably older versions as well.

tepi avatar Apr 19 '24 08:04 tepi