[ 
https://issues.apache.org/jira/browse/FLINK-36029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

LEE SOMANG updated FLINK-36029:
-------------------------------
    Description: 
The current ValueState#value method has the following description

 
{code:java}
/**
* Returns the current value for the state. When the state is not partitioned 
the returned value
* is the same for all inputs in a given operator instance. If state 
partitioning is applied,
* the value returned depends on the current operator input, as the operator 
maintains an
* independent state for each partition.
*
* <p>If you didn't specify a default value when creating the 
ValueStateDescriptor this will
* return {@code null} when no value was previously set using {@link 
#update(Object)}.
*
* @return The state value corresponding to the current input.
* @throws IOException Thrown if the system cannot access the state.
*/
@Nullable
T value() throws IOException; {code}
 

The method description says that null can be returned, but the method does not 
have the @Nullable annotation.

So it seems reasonable to add the @Nullable annotation to make it easier for 
the IDE to find the NPE.

  was:
The current ValueState#value method has the following description

 

```java
/**
* Returns the current value for the state. When the state is not partitioned 
the returned value
* is the same for all inputs in a given operator instance. If state 
partitioning is applied,
* the value returned depends on the current operator input, as the operator 
maintains an
* independent state for each partition.
*
* <p>If you didn't specify a default value when creating the 
ValueStateDescriptor this will
* return \{@code null} when no value was previously set using \{@link 
#update(Object)}.
*
* @return The state value corresponding to the current input.
* @throws IOException Thrown if the system cannot access the state.
*/
@Nullable
T value() throws IOException;
```

 

The method description says that null can be returned, but the method does not 
have the @Nullable annotation.

So it seems reasonable to add the @Nullable annotation to make it easier for 
the IDE to find the NPE.


> Add @Nullable Annotation to ValueState's Value Method Return Type
> -----------------------------------------------------------------
>
>                 Key: FLINK-36029
>                 URL: https://issues.apache.org/jira/browse/FLINK-36029
>             Project: Flink
>          Issue Type: Improvement
>            Reporter: LEE SOMANG
>            Priority: Minor
>
> The current ValueState#value method has the following description
>  
> {code:java}
> /**
> * Returns the current value for the state. When the state is not partitioned 
> the returned value
> * is the same for all inputs in a given operator instance. If state 
> partitioning is applied,
> * the value returned depends on the current operator input, as the operator 
> maintains an
> * independent state for each partition.
> *
> * <p>If you didn't specify a default value when creating the 
> ValueStateDescriptor this will
> * return {@code null} when no value was previously set using {@link 
> #update(Object)}.
> *
> * @return The state value corresponding to the current input.
> * @throws IOException Thrown if the system cannot access the state.
> */
> @Nullable
> T value() throws IOException; {code}
>  
> The method description says that null can be returned, but the method does 
> not have the @Nullable annotation.
> So it seems reasonable to add the @Nullable annotation to make it easier for 
> the IDE to find the NPE.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to