<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged gen-interface</title>
<link>https://ask.clojure.org/index.php/tag/gen-interface</link>
<description></description>
<item>
<title>Declare an interface with gen-interface that throws an Exception ?</title>
<link>https://ask.clojure.org/index.php/8738/declare-interface-with-gen-interface-that-throws-exception</link>
<description>&lt;p&gt;I'm trying to replicate a Java interface using gen-interface, which has some Java classes implementing it where they define their overrides as &lt;code&gt;throws Exception&lt;/code&gt;. But I do not know how in Clojure to specify that in the signature?&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class Someclass implements MyInterface {
  public void perform(CommandLine line) throws Exception {
     ...
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;-&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(gen-interface
 :name some.place.MyInterface
 :methods [[perform [org.apache.commons.cli.CommandLine] void]])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This fails with in javac with: &lt;code&gt;overridden method does not throw Exception&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Is there any way to create an interface which declares a throws clause on the methods in Clojure using gen-interface?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8738/declare-interface-with-gen-interface-that-throws-exception</guid>
<pubDate>Sat, 19 Oct 2019 01:15:07 +0000</pubDate>
</item>
</channel>
</rss>