Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1726

ExceptionUtils.asRuntimeException is not a good replacement for deprecated ExceptionUtils.rethrow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.14.0
    • 3.15.0
    • lang.exception.*
    • None

    Description

      I have been doing pass over deprecated warning in our code and one of them is that org.apache.commons.lang3.exception.ExceptionUtils#rethrow is deprecated. Its comment says "Use asRuntimeException(Throwable)." However, asRuntimeException() is not a good replacement. It lacks the generic type parameter R that the rethrow method has. In fact, the comment that says...

      Returns:
      Never actually returned, this generic type matches any type which the calling site requires. [..]
      

      ...is lying.

      Attachments

        Activity

          People

            Unassigned Unassigned
            wilx Václav Haisman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: