Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-12511

Fix misleading javadoc.

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.9
    • None
    • None

    Description

      The interface IgniteBinary has method:

      /**
           * Converts provided object to instance of {@link org.apache.ignite.binary.BinaryObject}.
           *
           * @param obj Object to convert.
           * @return Converted object.
           * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
           */
          public <T> T toBinary(@Nullable Object obj) throws BinaryObjectException;
      

      As can be seen from the method signature, the value of the parameter value can be null.
      But, the documentation does not say what the behavior of the method will be in this case.

      /**
           * Gets type ID for given type name.
           *
           * @param typeName Type name.
           * @return Type ID.
           */
          public int typeId(String typeName);
      

      It is not clear from the documentation of this method what the behavior of the method will be if:

      1. typeName is null?
      2. for typeName there is no* type id*?

      The class Marshaller has methods:

      public interface Marshaller {
          ....
          /**
           * Marshals object to the output stream. This method should not close
           * given output stream.
           *
           * @param obj Object to marshal.
           * @param out Output stream to marshal into.
           * @throws IgniteCheckedException If marshalling failed.
           */
          public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException;
              /**
           * Marshals object to byte array.
           *
           * @param obj Object to marshal.
           * @return Byte array.
           * @throws IgniteCheckedException If marshalling failed.
           */
          public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException;
      }
      

      The method signature has the annotation @Nullable.
      But, from the documentation it is completely incomprehensible:

      1. what happens as a result of calling the method with the passed null value at the input - will be thrown IgniteCheckedException exception or NullPointerException or something else
      2. what's the point of allowing null value?

      Attachments

        Issue Links

          Activity

            People

              amashenkov Andrey Mashenkov
              amashenkov Andrey Mashenkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m