Googled and asked on the IRC channel, but I can't find a solution. Maybe someone here can help :)
I'm trying to generate nested/inner classes with gen-class. I can't just write the classes in Java because I'm generating them off of data structures declared in Clojure. For context, I'm taking an Avro schema with arbitrarily nested records and building a Java API for working with objects to be (de-)serialized. I can hack around the problem by generating a bunch of classes at the top level, but since the nested records aren't needed elsewhere, inner classes make the most sense. Basically, I have this: {:name "foo.Bar" :type "record" :fields [ {:name "Baz" :type "record" :fields [ {:name "quux" :type "int"}]}]} and I want to walk it and generate a class that can be used as if it were written in Java as: package foo; public class Bar { class Baz { private int quux; public int getQuux() { return quux; } public void setQuux(int quux) { this.quux = quux; } } private Baz baz; public Bar() { this.baz = new Baz(); } public Baz getBaz() { return baz; } public void setBaz(Baz baz) { this.baz = baz; } } I can do this except for the inner class bit (I would really like to load the class immediately, but gen-and-load-class seems to have disappeared leaving only gen-class :-/ ) I can generate foo.Bar and foo.BarBaz, but that seems awkward and unnecessary if I could generate the inner class. This seems to compile in a file by itself: (gen-class 'foo.Bar$Baz ; ... stuff ... ) But when another file references it: (ns whatever (:import foo.Bar$Baz)) clojure asplodes, even when manually AOT compiling the files in order. Any solution? Thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en