Martin Wiesner created OPENNLP-1646:
---------------------------------------
Summary: Remove compiler warnings in AbstractDL and inheriting
classes
Key: OPENNLP-1646
URL: https://issues.apache.org/jira/browse/OPENNLP-1646
Project: OpenNLP
Issue Type: Improvement
Components: Deep Learning
Affects Versions: 2.5.0
Reporter: Martin Wiesner
Assignee: Martin Wiesner
Fix For: 2.5.1
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)