I'm trying to extend JButton with Clojure, but I ran into a problem when I try to create my own constructors. Whenever I use :constructors
with :gen-class
I keep getting a "ClassFormatError: Duplicate field name&signature" message when I try to instantiate my class.
I think I'm following the Clojure docs properly. Am I doing something wrong?
Example:
(ns test.gui.button
(:gen-class
:extends javax.swing.JButton
:constructors {[] [String]}
:init init))
(defn -init []
[["Click Me"] nil])
JButton
extendsjavax.swing.AbstractButton
which already has a protectedinit
method. If you rename your Clojure-init function to, e.g.,my-init
the problem is gone: