1*f1fbf3c2SXin Li<H2>Class Evolution</H2> 2*f1fbf3c2SXin Li 3*f1fbf3c2SXin Li<P>This is a demonstration of the class evolution mechanism 4*f1fbf3c2SXin Liimplemented with Javassist. This mechanism enables a Java program to 5*f1fbf3c2SXin Lireload an existing class file. Although the reloaded class file is 6*f1fbf3c2SXin Linot applied to exiting objects (the old class file is used for those 7*f1fbf3c2SXin Liobjects), it is effective in newly created objects. 8*f1fbf3c2SXin Li 9*f1fbf3c2SXin Li<P>Since the reloading is transparently executed, no programming 10*f1fbf3c2SXin Liconvention is needed. However, there are some limitations on possible 11*f1fbf3c2SXin Lichanges of the class definition. For example, the new class definition 12*f1fbf3c2SXin Limust have the same set of methods as the old one. These limitations are 13*f1fbf3c2SXin Linecessary for keeping the type system consistent. 14*f1fbf3c2SXin Li 15*f1fbf3c2SXin Li 16*f1fbf3c2SXin Li<H3><a href="java.html">Run WebPage.show()</a></H3> 17*f1fbf3c2SXin Li 18*f1fbf3c2SXin Li<P>The web server creates a new <code>WebPage</code> object and 19*f1fbf3c2SXin Licalls <code>show()</code> on that object. This method works as 20*f1fbf3c2SXin Liif it is a CGI script or a servlet and you will see the html file 21*f1fbf3c2SXin Liproduced by this method on your browser. 22*f1fbf3c2SXin Li 23*f1fbf3c2SXin Li<H3><a href="update.html">Change WebPage.class</a></H3> 24*f1fbf3c2SXin Li 25*f1fbf3c2SXin Li<P>The web server overwrites class file <code>WebPage.class</code> 26*f1fbf3c2SXin Lion the local disk. Then it signals that <code>WebPage.class</code> 27*f1fbf3c2SXin Limust be reloaded into the JVM. If you run <code>WebPage.show()</code> 28*f1fbf3c2SXin Liagain, you will see a different page on your browser. 29*f1fbf3c2SXin Li 30*f1fbf3c2SXin Li<H3>Source files</H3> 31*f1fbf3c2SXin Li 32*f1fbf3c2SXin Li<P>Web server: <A HREF="DemoServer.java"><code>DemoServer.java</code></A> 33*f1fbf3c2SXin Li 34*f1fbf3c2SXin Li<P>WebPage: <A HREF="WebPage.java"><code>WebPage.java</code></A> and 35*f1fbf3c2SXin Lianother <A HREF="sample/evolve/WebPage.java"><code>WebPage.java</code></A> 36*f1fbf3c2SXin Li 37*f1fbf3c2SXin Li<P>Class loader: <A HREF="DemoLoader.java"><code>DemoLoader.java</code></A>, 38*f1fbf3c2SXin Li <A HREF="Evolution.java"><code>Evolution.java</code></A>, and 39*f1fbf3c2SXin Li <A HREF="VersionManager.java"><code>VersionManager.java</code></A>. 40