Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-1646

Remove compiler warnings in AbstractDL and inheriting classes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.5.0
    • 2.5.1
    • Deep Learning
    • None

    Description

      Starting with OPENNLP-1618, AbstractDL implements AutoClosable. However, the close method allows to throw any type inheriting from Exception. This, however, leads to a bunch of compiler warnings being issued:

      AbstractDL.java:[37,17] auto-closeable resource opennlp.dl.AbstractDL has a member method close() that could throw InterruptedException

      ...

      during compilation, for all classes that inherit from or use AbstractDL.

      The fix is simple:
      Override the throws Exception declaration with more specific exceptions, for instance: throws OrtException, IllegalStateException that can be thrown in this case. Thus, InterruptedException is not declared / possible and javac is happy again.

      Let's cure this.

      Attachments

        Activity

          People

            mawiesne Martin Wiesner
            mawiesne Martin Wiesner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: