8000 Documentation Error: Expiry.toSharpTime(long) doesn't throw exception · Issue #207 · cache2k/cache2k · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Documentation Error: Expiry.toSharpTime(long) doesn't throw exception #207
Open
@yigithanbalci

Description

@yigithanbalci

In the JavaDoc of org.cache2k.expiry.Expiry.toSharpTime(long millis) method says the method throws IllegalArgumentException - if the time value is negative. However, in the code, it returns the already negative value as negative and does not throw an exception.
From line 35 to 51 as follows:

/**
   * Convert the time value to a time representing a sharp expiry.
   * This essentially negates the time value and is provided for a more speaking coding style.
   *
   * @param millis expiry time since the milliseconds since epoch or {@link #ETERNAL} if no
   *               expiry is requested.
   * @throws IllegalArgumentException if the time value is negative
   */
  public static long toSharpTime(long millis) {
    if (millis == ETERNAL) {
      return ETERNAL;
    }
    if (millis < 0) {
      return millis;
    }
    return -millis;
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0