Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-458

Binding DTOs: fix binary-derived constructor

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jhajnar@cisco.com Jan Hajnar
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: