[YANGTOOLS-458] Binding DTOs: fix binary-derived constructor Created: 22/May/15  Updated: 10/Apr/22  Resolved: 05/Jun/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Robert Varga Assignee: Jan Hajnar
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 3336

 Description   

Eclipse can be configured to warn about useless null pointer checks, which triggers on:

package org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731;
import java.io.Serializable;
import java.beans.ConstructorProperties;
import com.google.common.base.Preconditions;
import java.util.Arrays;
import com.google.common.io.BaseEncoding;

public class Metadata
implements Serializable {
private static final long serialVersionUID = -1641905433045568824L;
private final byte[] _value;

@ConstructorProperties("value")
public Metadata(byte[] _value)

{ Preconditions.checkNotNull(_value, "Supplied value may not be null"); this._value = _value == null ? null : _value.clone(); }

Given that we already have a precondition in place, we can remove the null check.



 Comments   
Comment by Jan Hajnar [ 02/Jun/15 ]

Patch:
https://git.opendaylight.org/gerrit/#/c/21560/

Generated at Wed Feb 07 20:53:18 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.