Need Groovy-like parseClass

Greetings,

I just discovered Kotlin and think it may fill a need I have.  Groovy has the ability (essentially) to load a Groovy source file into a Java Class object and then execute it via getMethod/invoke -  all at runtime.  (I understand it compiles it to JVM code on the fly.)  This is imprtant to me for two reasons:

1.  My system has 15,000 classes.  It takes a while to boot, and it takes a lot of memory to run even though one particular user may only use a small subset of its functionality.  By dynamically loading the classes I need as I need them, I can speed boot time and only have to load the classes that are actually being used.  This saves time and very important memory.

2.  This is a production web app.  Using the dynamic loading I can cause the system (when I choose) to re-load the source (re-compile the source file into JIT JVM code) file while the system is running.  This allows me to modify a running system (without have to reboot the server).

(I know I can compile the Kotlin to a class file, hide the class file from the boot, dynamically load the class file when needed, and even reload it - but I’d still rather (essentially) load the source instead.)

I have Groovy doing this just fine, but I am curious about using Kotlin.  Kotlin may have things I am interested in.

Thanks!

Blake McBride

For now wee don't have such capabilities. In the future we may support something like this, though.

Out of curiosity:
For your point 1: Why doesn’t Java’s normal lazy class loading help you here?

I am running it inside tomcat.  Since it takes over 1GB to boot, I presume it is loading the whole thing.  (Of course, I have a lot of Hibernate beans which have to get loaded at boot time, and there is a lot of this-calls-that stuff too.)  Do you think it is lazy-loading the rest of the classes?

Thanks!

To help clarify:  of the 15,000 classes a chunk is the Hibernate code that must load at boot time.  The majority of the code are web services. The stuff in between those two is minimal   I guess that tomcat loads the web service code at boot time.