This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Generating arbitrary Java classes at run time with Kawa


On 11/08/2012 11:56 PM, Vladimir Tsichevski wrote:
Hi Per,

thank you for the quick reply. Unfortunately, anonymous classes is not
what I need. My goal is to produce a set of ~150 Java classes (in the
form of class files or a JAR). These classes shall be annotated POJOs to
form Hibernate interface to a legacy DB. These classes are to be used in
systems which do not include Kawa runtime. So for this very task I plan
to use Kawa as a developer tool only.

Do you think that is possible?

Probably not, except perhaps in very special cases. Note that you can certainly use define-simple-class in an eval to generate classes at runtime. But these classes are not written to a file - they're just local to the JVM. You could modify the compile-file function so it takes a string or S-expression (like eval) and writes to a file.

However, that still leaves the problem that the Kawa compiler generates
code that assumes the Kawa runtime is available - at least part of the
runtime is going to be needed.  (The kawart,jar is meant to contain
only classes needed at runtime, but it's hard to trim it that far.)
In certain special cases it might be possible to restrict yourself to
Scheme code that won't need the Kawa runtime, but probably not without
compiler changes.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]