view hotswap.patch @ 516:4cd7d914b0e3

rebase to current hsx/hotspot-comp
author jrose
date Sun, 06 Oct 2013 23:32:13 -0700
parents 4f9420785686
children
line wrap: on
line source
diff -r f5603a6e5042 .hgignore
--- a/.hgignore	Wed Nov 17 22:42:08 2010 -0800
+++ b/.hgignore	Fri Dec 17 13:23:04 2010 +0100
@@ -1,7 +1,27 @@
-^build/
-^dist/
-/nbproject/private/
-^src/share/tools/hsdis/build/
-^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
-^src/share/tools/IdealGraphVisualizer/build/
-^src/share/tools/IdealGraphVisualizer/dist/
+^build/
+^work/
+^work64/
+^java/
+^java64/
+^dist/
+^make/
+build/
+/nbproject/private/
+^src/share/tools/hsdis/build/
+private/
+dist/
+.toc$
+.ps$
+.dvi$
+.aux$
+.swp$
+.dll$
+.dylib$
+.so$
+.bak$
+.orig$
+~$
+hotspot.log$
+^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
+^src/share/tools/IdealGraphVisualizer/build/
+^src/share/tools/IdealGraphVisualizer/dist/
diff -r f5603a6e5042 .hgtags
--- a/.hgtags	Wed Nov 17 22:42:08 2010 -0800
+++ b/.hgtags	Fri Dec 17 13:23:04 2010 +0100
@@ -131,3 +131,7 @@
 806d0c037e6bbb88dac0699673f4ba55ee8c02da jdk7-b117
 698b7b727e12de44139d8cca6ab9a494ead13253 jdk7-b118
 3ef7426b4deac5dcfd4afb35cabe9ab3d666df91 hs20-b02
+946201493cab53f518c55272b6f27517a0ba4e0e build 0.1-b01
+4425fe0d7f0ec7f8583ae687f7eb1b4a3e94ea09 build 0.1-b02
+0c5e4a085baa8aaa9aed55b20810de4bdc2d6548 build 0.2-b01
+34520cf6c532e28f529340f66f71855aadf83d95 build 0.2-b02
diff -r f5603a6e5042 build.cmd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.cmd	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,12 @@
+set HotSpotMksHome=C:\Cygwin\bin
+set path=%JAVA_HOME%;C:\Cygwin\bin
+call "%VS_VCVARS%\vsvars32.bat"
+
+set OrigPath=%cd%
+cd make\windows
+
+call build.bat product compiler1 %OrigPath% %JAVA_HOME%
+call build.bat fastdebug compiler1 %OrigPath% %JAVA_HOME%
+
+cd %OrigPath%
+pause
diff -r f5603a6e5042 create.cmd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/create.cmd	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,12 @@
+set HotSpotMksHome=C:\Cygwin\bin
+set path=%JAVA_HOME%\bin;C:\Cygwin\bin
+call "%VS_VCVARS%\vsvars32.bat"
+
+set OrigPath=%cd%
+cd make\windows
+
+mkdir %OrigPath%\work
+call create.bat %OrigPath% %OrigPath%\work %OrigPath%\java
+
+cd %OrigPath%
+pause
diff -r f5603a6e5042 create64.cmd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/create64.cmd	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,14 @@
+set HotSpotMksHome=C:\cygwin\bin
+set JAVA_HOME=%cd%\java64
+set ORIG_PATH=%PATH%
+set path=%JAVA_HOME%\bin;%path%;C:\cygwin\bin
+
+set OrigPath=%cd%
+cd make\windows
+
+mkdir %OrigPath%\work64
+call create.bat %OrigPath% %OrigPath%\work64 %OrigPath%\java64
+
+set PATH=%ORIG_PATH%
+cd %OrigPath%
+pause
diff -r f5603a6e5042 create_installers.cmd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/create_installers.cmd	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,11 @@
+copy hotswapinstaller\Installer\dist\Installer.jar dcevm-mac.jar
+jar uvf dcevm-mac.jar -C hotswapbinaries\mac\ .
+jar uvf dcevm-mac.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
+
+copy hotswapinstaller\Installer\dist\Installer.jar dcevm-win.jar
+jar uvf dcevm-win.jar -C hotswapbinaries\win\ .
+jar uvf dcevm-win.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
+
+copy hotswapinstaller\Installer\dist\Installer.jar dcevm-linux.jar
+jar uvf dcevm-linux.jar -C hotswapbinaries\linux\ .
+jar uvf dcevm-linux.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
\ No newline at end of file
diff -r f5603a6e5042 create_installers.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/create_installers.sh	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,11 @@
+cp hotswapinstaller/Installer/dist/Installer.jar dcevm-mac.jar
+jar uvf dcevm-mac.jar -C hotswapbinaries/mac/ .
+jar uvf dcevm-mac.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
+
+cp hotswapinstaller/Installer/dist/Installer.jar dcevm-win.jar
+jar uvf dcevm-win.jar -C hotswapbinaries/win/ .
+jar uvf dcevm-win.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
+
+cp hotswapinstaller/Installer/dist/Installer.jar dcevm-linux.jar
+jar uvf dcevm-linux.jar -C hotswapbinaries/linux/ .
+jar uvf dcevm-linux.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
diff -r f5603a6e5042 create_patch_vm_only.cmd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/create_patch_vm_only.cmd	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,1 @@
+hg diff -r 2039 -X hotswapdoc -X hotswaptest -X hotswapinstaller -X create_patch.cmd -X create_patch_vm_only.cmd >hotswapping_patch_vm_only
\ No newline at end of file
diff -r f5603a6e5042 hotswapbinaries/README
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapbinaries/README	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,18 @@
+The binary files are not stored in the mercurial repository, because they would bloat the repository size. The expected files in this subdirectory are:
+
+==========================================
+Windows
+win/data/64/bin/server/jvm.dll
+win/data/bin/client/jvm.dll
+win/data/bin/server/jvm.dll
+
+==========================================
+Mac
+mac/data/lib/i386/client/libjvm.dylib
+mac/data/lib/i386/server/libjvm.dylib
+
+==========================================
+Linux
+linux/data/64/lib/amd64/server/libjvm.so
+linux/data/lib/i386/client/libjvm.so
+linux/data/lib/i386/server/libjvm.so
diff -r f5603a6e5042 hotswapinstaller/Installer/build.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/build.xml	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="Installer" default="default" basedir=".">
+    <description>Builds, tests, and runs the project Installer.</description>
+    <import file="nbproject/build-impl.xml"/>
+    <target name="-post-compile">
+        <property name="hotswapvm.dir" value="${build.classes.dir}/../../../.."/>
+          <!--
+          <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/bin/client/jvm.dll" tofile="${build.classes.dir}/data/bin/client/jvm.dll"/>
+          <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/bin/server/jvm.dll" tofile="${build.classes.dir}/data/bin/server/jvm.dll"/>
+          <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/64/bin/server/jvm.dll" tofile="${build.classes.dir}/data/64/bin/server/jvm.dll"/>
+          <copy file="${hotswapvm.dir}/hotswapbinaries/mac/data/lib/i386/client/libjvm.dylib" tofile="${build.classes.dir}/data/lib/i386/client/libjvm.dylib"/>
+          <copy file="${hotswapvm.dir}/hotswapbinaries/mac/data/lib/i386/server/libjvm.dylib" tofile="${build.classes.dir}/data/lib/i386/server/libjvm.dylib"/>     
+-->
+
+
+        <jar destfile="dist/data/dcevm.jar">
+            <manifest>
+                <attribute name="Premain-Class" value="at.ssw.mixin.MixinAgent"/>
+                <attribute name="Can-Retransform-Classes" value="true"/>
+            </manifest>
+            <zipfileset src="${hotswapvm.dir}/hotswaptest/HotSwapTool/dist/HotSwapTool.jar" />
+            <zipfileset src="${hotswapvm.dir}/../Mixin/Mixin/dist/Mixin.jar" />
+            <zipfileset src="${hotswapvm.dir}/../Mixin/Mixin/dist/lib/asm-all-3.3.jar" />
+        </jar>
+
+    </target>
+    <!--
+
+    There exist several targets which are by default empty and which can be 
+    used for execution of your tasks. These targets are usually executed 
+    before and after some main targets. They are: 
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported 
+    nbproject/build-impl.xml file. 
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are: 
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar-with-manifest:    JAR building (if you are using a manifest)
+      -do-jar-without-manifest: JAR building (if you are not using a manifest)
+      run:                      execution of project 
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    An example of overriding the target for project execution could look like this:
+
+        <target name="run" depends="Installer-impl.jar">
+            <exec dir="bin" executable="launcher.exe">
+                <arg file="${dist.jar}"/>
+            </exec>
+        </target>
+
+    Notice that the overridden target depends on the jar target and not only on 
+    the compile target as the regular run target does. Again, for a list of available 
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file. 
+
+    -->
+</project>
diff -r f5603a6e5042 hotswapinstaller/Installer/manifest.mf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/manifest.mf	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/build-impl.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/nbproject/build-impl.xml	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,883 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+  - initialization
+  - compilation
+  - jar
+  - execution
+  - debugging
+  - javadoc
+  - junit compilation
+  - junit execution
+  - junit debugging
+  - applet
+  - cleanup
+
+        -->
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Installer-impl">
+    <fail message="Please build using Ant 1.7.1 or higher.">
+        <condition>
+            <not>
+                <antversion atleast="1.7.1"/>
+            </not>
+        </condition>
+    </fail>
+    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
+    <!-- 
+                ======================
+                INITIALIZATION SECTION 
+                ======================
+            -->
+    <target name="-pre-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init" name="-init-private">
+        <property file="nbproject/private/config.properties"/>
+        <property file="nbproject/private/configs/${config}.properties"/>
+        <property file="nbproject/private/private.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private" name="-init-user">
+        <property file="${user.properties.file}"/>
+        <!-- The two properties below are usually overridden -->
+        <!-- by the active platform. Just a fallback. -->
+        <property name="default.javac.source" value="1.4"/>
+        <property name="default.javac.target" value="1.4"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
+        <property file="nbproject/configs/${config}.properties"/>
+        <property file="nbproject/project.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
+        <available file="${manifest.file}" property="manifest.available"/>
+        <available file="${application.splash}" property="splashscreen.available"/>
+        <condition property="main.class.available">
+            <and>
+                <isset property="main.class"/>
+                <not>
+                    <equals arg1="${main.class}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class">
+            <and>
+                <isset property="manifest.available"/>
+                <isset property="main.class.available"/>
+            </and>
+        </condition>
+        <condition property="do.mkdist">
+            <and>
+                <isset property="libs.CopyLibs.classpath"/>
+                <not>
+                    <istrue value="${mkdist.disabled}"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class+mkdist.available">
+            <and>
+                <istrue value="${manifest.available+main.class}"/>
+                <isset property="do.mkdist"/>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
+            <and>
+                <istrue value="${manifest.available+main.class+mkdist.available}"/>
+                <istrue value="${splashscreen.available}"/>
+            </and>
+        </condition>
+        <condition property="do.archive">
+            <not>
+                <istrue value="${jar.archive.disabled}"/>
+            </not>
+        </condition>
+        <condition property="do.archive+manifest.available">
+            <and>
+                <isset property="manifest.available"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available+main.class">
+            <and>
+                <istrue value="${manifest.available+main.class}"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available+main.class+mkdist.available">
+            <and>
+                <istrue value="${manifest.available+main.class+mkdist.available}"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
+            <and>
+                <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="have.tests">
+            <or>
+                <available file="${test.src.dir}"/>
+            </or>
+        </condition>
+        <condition property="have.sources">
+            <or>
+                <available file="${src.dir}"/>
+            </or>
+        </condition>
+        <condition property="netbeans.home+have.tests">
+            <and>
+                <isset property="netbeans.home"/>
+                <isset property="have.tests"/>
+            </and>
+        </condition>
+        <condition property="no.javadoc.preview">
+            <and>
+                <isset property="javadoc.preview"/>
+                <isfalse value="${javadoc.preview}"/>
+            </and>
+        </condition>
+        <property name="run.jvmargs" value=""/>
+        <property name="javac.compilerargs" value=""/>
+        <property name="work.dir" value="${basedir}"/>
+        <condition property="no.deps">
+            <and>
+                <istrue value="${no.dependencies}"/>
+            </and>
+        </condition>
+        <property name="javac.debug" value="true"/>
+        <property name="javadoc.preview" value="true"/>
+        <property name="application.args" value=""/>
+        <property name="source.encoding" value="${file.encoding}"/>
+        <property name="runtime.encoding" value="${source.encoding}"/>
+        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
+            <and>
+                <isset property="javadoc.encoding"/>
+                <not>
+                    <equals arg1="${javadoc.encoding}" arg2=""/>
+                </not>
+            </and>
+        </condition>
+        <property name="javadoc.encoding.used" value="${source.encoding}"/>
+        <property name="includes" value="**"/>
+        <property name="excludes" value=""/>
+        <property name="do.depend" value="false"/>
+        <condition property="do.depend.true">
+            <istrue value="${do.depend}"/>
+        </condition>
+        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
+        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
+            <length length="0" string="${endorsed.classpath}" when="greater"/>
+        </condition>
+        <property name="javac.fork" value="false"/>
+        <property name="jar.index" value="false"/>
+        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
+    </target>
+    <target name="-post-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
+        <fail unless="src.dir">Must set src.dir</fail>
+        <fail unless="test.src.dir">Must set test.src.dir</fail>
+        <fail unless="build.dir">Must set build.dir</fail>
+        <fail unless="dist.dir">Must set dist.dir</fail>
+        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
+        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
+        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
+        <fail unless="dist.jar">Must set dist.jar</fail>
+    </target>
+    <target name="-init-macrodef-property">
+        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute name="name"/>
+            <attribute name="value"/>
+            <sequential>
+                <property name="@{name}" value="${@{value}}"/>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <attribute default="${javac.processorpath}" name="processorpath"/>
+            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="${empty.dir}" name="sourcepath"/>
+            <attribute default="${empty.dir}" name="gensrcdir"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.dir}/empty" name="empty.dir"/>
+                <mkdir dir="${empty.dir}"/>
+                <mkdir dir="@{apgeneratedsrcdir}"/>
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <compilerarg line="${javac.compilerargs}"/>
+                    <compilerarg value="-processorpath"/>
+                    <compilerarg path="@{processorpath}:${empty.dir}"/>
+                    <compilerarg line="${ap.processors.internal}"/>
+                    <compilerarg line="${annotation.processing.processor.options}"/>
+                    <compilerarg value="-s"/>
+                    <compilerarg path="@{apgeneratedsrcdir}"/>
+                    <compilerarg line="${ap.proc.none.internal}"/>
+                    <customize/>
+                </javac>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <attribute default="${javac.processorpath}" name="processorpath"/>
+            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="${empty.dir}" name="sourcepath"/>
+            <attribute default="${empty.dir}" name="gensrcdir"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.dir}/empty" name="empty.dir"/>
+                <mkdir dir="${empty.dir}"/>
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <compilerarg line="${javac.compilerargs}"/>
+                    <customize/>
+                </javac>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
+        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <sequential>
+                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                </depend>
+            </sequential>
+        </macrodef>
+        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <sequential>
+                <fail unless="javac.includes">Must set javac.includes</fail>
+                <pathconvert pathsep="," property="javac.includes.binary">
+                    <path>
+                        <filelist dir="@{destdir}" files="${javac.includes}"/>
+                    </path>
+                    <globmapper from="*.java" to="*.class"/>
+                </pathconvert>
+                <delete>
+                    <files includes="${javac.includes.binary}"/>
+                </delete>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-junit">
+        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="**" name="testincludes"/>
+            <sequential>
+                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
+                    <batchtest todir="${build.test.results.dir}">
+                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+                            <filename name="@{testincludes}"/>
+                        </fileset>
+                    </batchtest>
+                    <classpath>
+                        <path path="${run.test.classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="test-sys-prop."/>
+                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <formatter type="brief" usefile="false"/>
+                    <formatter type="xml"/>
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                </junit>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
+        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="name"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <attribute default="" name="stopclassname"/>
+            <sequential>
+                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                </nbjpdastart>
+            </sequential>
+        </macrodef>
+        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${build.classes.dir}" name="dir"/>
+            <sequential>
+                <nbjpdareload>
+                    <fileset dir="@{dir}" includes="${fix.classes}">
+                        <include name="${fix.includes}*.class"/>
+                    </fileset>
+                </nbjpdareload>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-debug-args">
+        <property name="version-output" value="java version &quot;${ant.java.version}"/>
+        <condition property="have-jdk-older-than-1.4">
+            <or>
+                <contains string="${version-output}" substring="java version &quot;1.0"/>
+                <contains string="${version-output}" substring="java version &quot;1.1"/>
+                <contains string="${version-output}" substring="java version &quot;1.2"/>
+                <contains string="${version-output}" substring="java version &quot;1.3"/>
+            </or>
+        </condition>
+        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
+            <istrue value="${have-jdk-older-than-1.4}"/>
+        </condition>
+        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
+            <os family="windows"/>
+        </condition>
+        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
+            <isset property="debug.transport"/>
+        </condition>
+    </target>
+    <target depends="-init-debug-args" name="-init-macrodef-debug">
+        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${main.class}" name="classname"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg line="${debug-args-line}"/>
+                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
+                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-java">
+        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="classname"/>
+            <attribute default="${run.classpath}" name="classpath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-copylibs">
+        <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+                <pathconvert property="run.classpath.without.build.classes.dir">
+                    <path path="${run.classpath}"/>
+                    <map from="${build.classes.dir.resolved}" to=""/>
+                </pathconvert>
+                <pathconvert pathsep=" " property="jar.classpath">
+                    <path path="${run.classpath.without.build.classes.dir}"/>
+                    <chainedmapper>
+                        <flattenmapper/>
+                        <globmapper from="*" to="lib/*"/>
+                    </chainedmapper>
+                </pathconvert>
+                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
+                <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
+                    <fileset dir="${build.classes.dir}"/>
+                    <manifest>
+                        <attribute name="Class-Path" value="${jar.classpath}"/>
+                        <customize/>
+                    </manifest>
+                </copylibs>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-presetdef-jar">
+        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
+                <j2seproject1:fileset dir="${build.classes.dir}"/>
+            </jar>
+        </presetdef>
+    </target>
+    <target name="-init-ap-cmdline-properties">
+        <property name="annotation.processing.enabled" value="true"/>
+        <property name="annotation.processing.processors.list" value=""/>
+        <property name="annotation.processing.processor.options" value=""/>
+        <property name="annotation.processing.run.all.processors" value="true"/>
+        <property name="javac.processorpath" value="${javac.classpath}"/>
+        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
+        <condition property="ap.supported.internal" value="true">
+            <not>
+                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
+            </not>
+        </condition>
+    </target>
+    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
+        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
+            <isfalse value="${annotation.processing.run.all.processors}"/>
+        </condition>
+        <condition else="" property="ap.proc.none.internal" value="-proc:none">
+            <isfalse value="${annotation.processing.enabled}"/>
+        </condition>
+    </target>
+    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
+        <property name="ap.cmd.line.internal" value=""/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
+    <!--
+                ===================
+                COMPILATION SECTION
+                ===================
+            -->
+    <target name="-deps-jar-init" unless="built-jar.properties">
+        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
+        <delete file="${built-jar.properties}" quiet="true"/>
+    </target>
+    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
+        <echo level="warn" message="Cycle detected: Installer was already built"/>
+    </target>
+    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
+        <mkdir dir="${build.dir}"/>
+        <touch file="${built-jar.properties}" verbose="false"/>
+        <property file="${built-jar.properties}" prefix="already.built.jar."/>
+        <antcall target="-warn-already-built-jar"/>
+        <propertyfile file="${built-jar.properties}">
+            <entry key="${basedir}" value=""/>
+        </propertyfile>
+    </target>
+    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
+    <target depends="init" name="-check-automatic-build">
+        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
+    </target>
+    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
+        <antcall target="clean"/>
+    </target>
+    <target depends="init,deps-jar" name="-pre-pre-compile">
+        <mkdir dir="${build.classes.dir}"/>
+    </target>
+    <target name="-pre-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-depend">
+        <pathconvert property="build.generated.subdirs">
+            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="*"/>
+            </dirset>
+        </pathconvert>
+        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
+        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
+        <copy todir="${build.classes.dir}">
+            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target if="has.persistence.xml" name="-copy-persistence-xml">
+        <mkdir dir="${build.classes.dir}/META-INF"/>
+        <copy todir="${build.classes.dir}/META-INF">
+            <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
+        </copy>
+    </target>
+    <target name="-post-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
+    <target name="-pre-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile/>
+        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
+    </target>
+    <target name="-post-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
+    <!--
+                ====================
+                JAR BUILDING SECTION
+                ====================
+            -->
+    <target depends="init" name="-pre-pre-jar">
+        <dirname file="${dist.jar}" property="dist.jar.dir"/>
+        <mkdir dir="${dist.jar.dir}"/>
+    </target>
+    <target name="-pre-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
+        <j2seproject1:jar/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
+        <j2seproject1:jar manifest="${manifest.file}"/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
+        <j2seproject1:jar manifest="${manifest.file}">
+            <j2seproject1:manifest>
+                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
+            </j2seproject1:manifest>
+        </j2seproject1:jar>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <pathconvert property="run.classpath.with.dist.jar">
+            <path path="${run.classpath}"/>
+            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
+        </pathconvert>
+        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
+        <basename file="${application.splash}" property="splashscreen.basename"/>
+        <mkdir dir="${build.classes.dir}/META-INF"/>
+        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
+        <j2seproject3:copylibs>
+            <customize>
+                <attribute name="Main-Class" value="${main.class}"/>
+                <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
+            </customize>
+        </j2seproject3:copylibs>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <echo>java -jar "${dist.jar.resolved}"</echo>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
+        <j2seproject3:copylibs>
+            <customize>
+                <attribute name="Main-Class" value="${main.class}"/>
+            </customize>
+        </j2seproject3:copylibs>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <echo>java -jar "${dist.jar.resolved}"</echo>
+    </target>
+    <target name="-post-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
+    <!--
+                =================
+                EXECUTION SECTION
+                =================
+            -->
+    <target depends="init,compile" description="Run a main class." name="run">
+        <j2seproject1:java>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <target name="-do-not-recompile">
+        <property name="javac.includes.binary" value=""/>
+    </target>
+    <target depends="init,compile-single" name="run-single">
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+        <j2seproject1:java classname="${run.class}"/>
+    </target>
+    <target depends="init,compile-test-single" name="run-test-with-main">
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
+    </target>
+    <!--
+                =================
+                DEBUGGING SECTION
+                =================
+            -->
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
+        <j2seproject1:nbjpdastart name="${debug.class}"/>
+    </target>
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
+    </target>
+    <target depends="init,compile" name="-debug-start-debuggee">
+        <j2seproject3:debug>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
+        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
+    </target>
+    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+        <j2seproject3:debug classname="${debug.class}"/>
+    </target>
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
+    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
+    </target>
+    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
+    <target depends="init" name="-pre-debug-fix">
+        <fail unless="fix.includes">Must set fix.includes</fail>
+        <property name="javac.includes" value="${fix.includes}.java"/>
+    </target>
+    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
+        <j2seproject1:nbjpdareload/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
+    <!--
+                ===============
+                JAVADOC SECTION
+                ===============
+            -->
+    <target depends="init" if="have.sources" name="-javadoc-build">
+        <mkdir dir="${dist.javadoc.dir}"/>
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
+            <classpath>
+                <path path="${javac.classpath}"/>
+            </classpath>
+            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+                <filename name="**/*.java"/>
+            </fileset>
+            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="**/*.java"/>
+            </fileset>
+        </javadoc>
+    </target>
+    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
+        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
+    </target>
+    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
+    <!--
+                =========================
+                JUNIT COMPILATION SECTION
+                =========================
+            -->
+    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
+        <mkdir dir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-pre-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-test-depend">
+        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
+        <copy todir="${build.test.classes.dir}">
+            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target name="-post-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
+    <target name="-pre-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
+        <copy todir="${build.test.classes.dir}">
+            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target name="-post-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
+    <!--
+                =======================
+                JUNIT EXECUTION SECTION
+                =======================
+            -->
+    <target depends="init" if="have.tests" name="-pre-test-run">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
+        <j2seproject3:junit testincludes="**/*Test.java"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init" if="have.tests" name="test-report"/>
+    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
+    <target depends="init" if="have.tests" name="-pre-test-run-single">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
+        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+        <j2seproject3:junit excludes="" includes="${test.includes}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
+    <!--
+                =======================
+                JUNIT DEBUGGING SECTION
+                =======================
+            -->
+    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
+        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
+        <delete file="${test.report.file}"/>
+        <mkdir dir="${build.test.results.dir}"/>
+        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
+            <customize>
+                <syspropertyset>
+                    <propertyref prefix="test-sys-prop."/>
+                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                </syspropertyset>
+                <arg value="${test.class}"/>
+                <arg value="showoutput=true"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
+    </target>
+    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
+    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
+        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
+    <!--
+                =========================
+                APPLET EXECUTION SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" name="run-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject1:java classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <!--
+                =========================
+                APPLET DEBUGGING  SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject3:debug classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
+    <!--
+                ===============
+                CLEANUP SECTION
+                ===============
+            -->
+    <target name="-deps-clean-init" unless="built-clean.properties">
+        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
+        <delete file="${built-clean.properties}" quiet="true"/>
+    </target>
+    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
+        <echo level="warn" message="Cycle detected: Installer was already built"/>
+    </target>
+    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
+        <mkdir dir="${build.dir}"/>
+        <touch file="${built-clean.properties}" verbose="false"/>
+        <property file="${built-clean.properties}" prefix="already.built.clean."/>
+        <antcall target="-warn-already-built-clean"/>
+        <propertyfile file="${built-clean.properties}">
+            <entry key="${basedir}" value=""/>
+        </propertyfile>
+    </target>
+    <target depends="init" name="-do-clean">
+        <delete dir="${build.dir}"/>
+        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
+    </target>
+    <target name="-post-clean">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
+    <target name="-check-call-dep">
+        <property file="${call.built.properties}" prefix="already.built."/>
+        <condition property="should.call.dep">
+            <not>
+                <isset property="already.built.${call.subproject}"/>
+            </not>
+        </condition>
+    </target>
+    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
+        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
+            <propertyset>
+                <propertyref prefix="transfer."/>
+                <mapper from="transfer.*" to="*" type="glob"/>
+            </propertyset>
+        </ant>
+    </target>
+</project>
diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/project.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/nbproject/project.properties	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,63 @@
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/Installer.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.junit.classpath}:\
+    ${libs.junit_4.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
+main.class=at.ssw.hotswap.installer.Main
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/project.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/nbproject/project.xml	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+            <name>Installer</name>
+            <source-roots>
+                <root id="src.dir"/>
+            </source-roots>
+            <test-roots>
+                <root id="test.src.dir"/>
+            </test-roots>
+        </data>
+    </configuration>
+</project>
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installation.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installation.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Observable;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class Installation extends Observable {
+
+    private final File file;
+    private final boolean isJDK;
+    private final Installer installer;
+    private boolean installed;
+    private String version;
+    private String dceVersion;
+    private boolean is64Bit;
+
+    public Installation(File f, Installer i) throws InstallerException {
+        installer = i;
+        try {
+            file = f.getCanonicalFile();
+        } catch (IOException ex) {
+            throw new InstallerException(f.getAbsolutePath() + " is no JRE or JDK-directory.");
+        }
+        isJDK = installer.isJDK(file);
+        if (!isJDK && !installer.isJRE(file)) {
+            throw new InstallerException(f.getAbsolutePath() + " is no JRE or JDK-directory.");
+        }
+
+        version = installer.getJavaVersion(file);
+        update();
+    }
+
+    final public void update() throws InstallerException {
+        installed = installer.isDCEInstalled(file);
+        if (installed) {
+            dceVersion = installer.getDCEVersion(file);
+        }
+        is64Bit = installer.is64Bit(file);
+    }
+
+    public File getPath() {
+        return file;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public String getDCEVersion() {
+        return dceVersion;
+    }
+
+    public boolean isJDK() {
+        return isJDK;
+    }
+
+    public boolean is64Bit() {
+        return is64Bit;
+    }
+
+    public void installDCE() throws InstallerException {
+        try {
+            installer.install(file, is64Bit);
+        } catch (InstallerException ex) {
+            throw new InstallerException("Could not install DCE to " + file.getAbsolutePath() + ".", ex);
+        }
+        installed = true;
+        update();
+        setChanged();
+        notifyObservers();
+    }
+
+    public void uninstallDCE() throws InstallerException {
+        try {
+            installer.uninstall(file, is64Bit);
+        } catch (InstallerException ex) {
+            throw new InstallerException("Could not uninstall DCE to " + file.getAbsolutePath() + ".", ex);
+        }
+        installed = false;
+        update();
+        setChanged();
+        notifyObservers();
+    }
+
+    public boolean isDCEInstalled() {
+        return installed;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Installation other = (Installation) obj;
+        if (this.file != other.file && (this.file == null || !this.file.equals(other.file))) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 5;
+        hash = 97 * hash + (this.file != null ? this.file.hashCode() : 0);
+        return hash;
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installer.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installer.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public abstract class Installer {
+
+    public String getJREDirectory() {
+        return "jre";
+    }
+
+    public String getBackupLibraryName() {
+        return getLibraryName() + ".backup";
+    }
+
+    public String getTemporaryLibraryName() {
+        return getLibraryName() + ".temp";
+    }
+
+    public abstract String getClientDirectory();
+
+    public abstract String getServerDirectory(boolean is64bit);
+
+    public abstract String getLibraryName();
+
+    public abstract String getJavaExecutable();
+
+    public abstract List<Installation> listAllInstallations();
+
+    public static Installer create() throws InstallerException {
+
+        String os = System.getProperty("os.name").toLowerCase();
+
+        if (os.contains("windows")) {
+            return new WindowsInstaller();
+        } else if (os.contains("mac") || os.contains("darwin")) {
+            return new MacInstaller();
+        } else if (os.contains("unix") || os.contains("linux")) {
+            return new LinuxInstaller();
+        }
+        throw new InstallerException("Unknown OS is unsupported.");
+    }
+
+    final protected void extractFile(String jarpath, String dest) throws InstallerException {
+        boolean fileCreated = false;
+        FileOutputStream output = null;
+        InputStream in = Main.class.getClassLoader().getResourceAsStream(jarpath);
+        if (in == null) {
+            throw new InstallerException("Could not find " + jarpath + " in jar-file.");
+        }
+
+        boolean failure = false;
+        try {
+            output = new FileOutputStream(dest);
+            fileCreated = true;
+            int len = 0;
+            byte[] cur = new byte[102400];
+            while ((len = in.read(cur)) != -1) {
+                output.write(cur, 0, len);
+            }
+        } catch (Exception ex) {
+            failure = true;
+            throw new InstallerException("Could not extract file " + dest + ".", ex);
+        } finally {
+            if (output != null) {
+                try {
+                    output.close();
+                } catch (Exception e) {
+                }
+            }
+            if (failure && fileCreated) {
+                deleteFile(dest);
+            }
+        }
+    }
+
+    public void install(File dir, boolean bit64) throws InstallerException {
+        if (isJDK(dir)) {
+            dir = new File(dir, getJREDirectory());
+        }
+
+        String dcevm_jar = new File(dir, "lib" + File.separator + "ext" + File.separator + "dcevm.jar").getPath();
+        extractFile("data/dcevm.jar", dcevm_jar);
+
+        if (new File(dir, getServerDirectory(bit64)).exists()) {
+            installClientServer(dir, getServerDirectory(bit64), bit64);
+        }
+
+        if (new File(dir, getClientDirectory()).exists() && !bit64) {
+            try {
+                installClientServer(dir, getClientDirectory(), false);
+            } catch (InstallerException e) {
+                uninstallClientServer(dir, getServerDirectory(bit64));
+                throw e;
+            }
+        }
+    }
+
+    public void uninstall(File dir, boolean bit64) throws InstallerException {
+        if (isJDK(dir)) {
+            dir = new File(dir, getJREDirectory());
+        }
+
+        if (new File(dir, getServerDirectory(bit64)).exists()) {
+            uninstallClientServer(dir, getServerDirectory(bit64));
+        }
+
+        if (new File(dir, getClientDirectory()).exists() && !bit64) {
+            try {
+                uninstallClientServer(dir, getClientDirectory());
+            } catch (InstallerException e) {
+                if (new File(dir, getServerDirectory(bit64)).exists()) {
+                    installClientServer(dir, getServerDirectory(bit64), bit64);
+                }
+                throw e;
+            }
+        }
+
+        String dcevm_jar = new File(dir, "lib" + File.separator + "ext" + File.separator + "dcevm.jar").getPath();
+        try {
+            deleteFile(dcevm_jar);
+        } catch (InstallerException e) {
+            install(dir, bit64);
+            throw e;
+        }
+    }
+
+    private void installClientServer(File jreDir, String directory, boolean bit64) throws InstallerException {
+        String jarpath = "data/" + (bit64 ? "64/" : "") + directory.replace(File.separatorChar, '/') + "/" + getLibraryName();
+        File clientOrServerDir = new File(jreDir, directory);
+        String jvm_dll = new File(clientOrServerDir, getLibraryName()).getPath();
+        String jvm_dll_backup = new File(clientOrServerDir, getBackupLibraryName()).getPath();
+
+        renameFile(jvm_dll, jvm_dll_backup);
+
+        try {
+            extractFile(jarpath, jvm_dll);
+        } catch (InstallerException e) {
+            renameFile(jvm_dll_backup, jvm_dll);
+            throw e;
+        }
+    }
+
+    private void uninstallClientServer(File jreDir, String directory) throws InstallerException {
+        File clientOrServerDir = new File(jreDir, directory);
+        String jvm_dll = new File(clientOrServerDir, getLibraryName()).getPath();
+        String jvm_dll_backup = new File(clientOrServerDir, getBackupLibraryName()).getPath();
+        String jvm_dll_backup_temp = createTempFilename(clientOrServerDir, getBackupLibraryName() + "_", ".temp");
+
+        renameFile(jvm_dll_backup, jvm_dll_backup_temp);
+
+        try {
+            deleteFile(jvm_dll);
+        } catch (InstallerException e) {
+            renameFile(jvm_dll_backup_temp, jvm_dll_backup);
+            throw e;
+        }
+
+        try {
+            renameFile(jvm_dll_backup_temp, jvm_dll);
+        } catch (InstallerException e) {
+            throw new InstallerException("Warning: JVM directory is in an inconistent state.", e);
+        }
+    }
+
+    private String createTempFilename(File dir, String prefix, String suffix){
+        String filename;
+        int i=0;
+        
+        do
+        {
+            i++;
+            filename = prefix + i + suffix;
+        } while(new File(dir, filename).exists() && i<1000);
+
+        return new File(dir, filename).getPath();
+    }
+
+    private void deleteFile(String file) throws InstallerException {
+        File f = new File(file);
+
+        boolean succ = false;
+        try {
+            succ = f.delete();
+        } catch (Exception e) {
+            throw new InstallerException("Could not delete " + file + ".", e);
+        }
+
+        if (!succ) {
+            throw new InstallerException("Could not delete " + file + ".");
+        }
+    }
+
+    private void renameFile(String from, String to) throws InstallerException {
+        File ffr = new File(from);
+        File fto = new File(to);
+        if(!fto.isAbsolute()) fto = new File(ffr, to);
+
+        if (!ffr.exists()) {
+            throw new InstallerException("The file " + from + " does not exist.");
+        }
+
+        boolean succ = false;
+        try {
+            succ = ffr.renameTo(fto);
+        } catch (Exception e) {
+            throw new InstallerException("Could not rename " + from + " to " + to + ".", e);
+        }
+
+        if (!succ) {
+            throw new InstallerException("Could not rename " + from + " to " + to + ".");
+        }
+    }
+
+    public boolean isJRE(File directory) {
+        if (directory.isDirectory() && directory.getName().startsWith("jre")) {
+
+            String[] files = {getJavaExecutable()};
+            for (int i = 0; i < files.length; i++) {
+                if (!new File(directory, files[i]).exists()) {
+                    return false;
+                }
+            }
+
+            if (new File(directory, getClientDirectory()).exists()) {
+                if (!new File(directory, getClientDirectory() + File.separator + getLibraryName()).exists()) {
+                    return new File(directory, getClientDirectory() + File.separator + getBackupLibraryName()).exists();
+                }
+            }
+
+            if (new File(directory, getServerDirectory(true)).exists()) {
+                if (!new File(directory, getServerDirectory(true) + File.separator + getLibraryName()).exists()) {
+                    return new File(directory, getServerDirectory(true) + File.separator + getBackupLibraryName()).exists();
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
+    public boolean isJDK(File directory) {
+        if (directory.isDirectory()) {
+            File jreDir = new File(directory, getJREDirectory());
+            return isJRE(jreDir);
+        }
+        return false;
+    }
+
+    final public String executeJava(File jreDir, String... params) throws InstallerException {
+        File command = new File(jreDir, getJavaExecutable());
+        try {
+            StringBuilder result = new StringBuilder();
+            String line;
+            ArrayList<String> pp = new ArrayList<String>();
+            pp.add(command.getAbsolutePath());
+            pp.addAll(Arrays.asList(params));
+            Process p = Runtime.getRuntime().exec(pp.toArray(new String[0]));
+            BufferedReader input =
+                    new BufferedReader(new InputStreamReader(p.getErrorStream()));
+            while ((line = input.readLine()) != null) {
+                result.append(line);
+                result.append('\n');
+            }
+            input.close();
+            return result.toString();
+        } catch (Exception err) {
+            throw new InstallerException("Could not execute " + command + ".", err);
+        }
+    }
+
+    public boolean isDCEInstalled(File dir) throws InstallerException {
+        File jreDir;
+        if (isJDK(dir)) {
+            jreDir = new File(dir, "jre");
+        } else {
+            jreDir = dir;
+        }
+        File jvmDCEClientFile = new File(jreDir, getClientDirectory() + File.separator + getBackupLibraryName());
+        String serverDir = getServerDirectory(false);
+        if (!new File(jreDir, serverDir).exists()) {
+            serverDir = getServerDirectory(true);
+        }
+        File jvmDCEServerFile = new File(jreDir, serverDir + File.separator + getBackupLibraryName());
+
+        if (new File(jreDir, getClientDirectory()).exists() && new File(jreDir, serverDir).exists()) {
+            if (jvmDCEServerFile.exists() != jvmDCEClientFile.exists()) {
+                throw new InstallerException(jreDir.getAbsolutePath() + " has invalid state.");
+            }
+        }
+        return jvmDCEClientFile.exists() || jvmDCEServerFile.exists();
+    }
+
+    final public String getVersionString(File jreDir) throws InstallerException {
+        return executeJava(jreDir, "-version");
+    }
+
+    final public boolean is64Bit(File jreDir) throws InstallerException {
+        return getVersionString(jreDir).contains("64-Bit");
+    }
+
+    final public String getJavaVersion(File jreDir) throws InstallerException {
+        return getVersionHelper(jreDir, ".*java version.*\"(.*)\".*", true);
+    }
+
+    final public String getDCEVersion(File jreDir) throws InstallerException {
+        return getVersionHelper(jreDir, ".*Dynamic Code Evolution.*build ([^,]+),.*", false);
+    }
+
+    private String getVersionHelper(File jreDir, String regex, boolean javaVersion) throws InstallerException {
+        String version = getVersionString(jreDir);
+        version = version.replaceAll("\n", "");
+        Matcher matcher = Pattern.compile(regex).matcher(version);
+
+        if (!matcher.matches()) {
+            throw new InstallerException("Could not get " + (javaVersion ? "java" : "dce") + "version of " + jreDir.getAbsolutePath() + ".");
+        }
+
+        version = matcher.replaceFirst("$1");
+        return version;
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/InstallerException.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/InstallerException.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class InstallerException extends Exception {
+
+    InstallerException(String e) {
+        super(e);
+    }
+
+    InstallerException(String e, Throwable t) {
+        super(e, t);
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/LinuxInstaller.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/LinuxInstaller.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class LinuxInstaller extends Installer {
+
+    public String getClientDirectory() {
+        return "lib/i386/client";
+    }
+
+    public String getServerDirectory(boolean is64Bit) {
+        if (is64Bit) {
+            return "lib/amd64/server";
+        } else {
+            return "lib/i386/server";
+        }
+    }
+
+    public String getLibraryName() {
+        return "libjvm.so";
+    }
+
+    public String getJavaExecutable() {
+        return "bin/java";
+    }
+
+    @Override
+    public List<Installation> listAllInstallations() {
+        File dir = new File("/usr/java");
+
+        List<Installation> dirs = new ArrayList<Installation>();
+
+        if (dir.exists()) {
+            for (File f : dir.listFiles()) {
+                try {
+                    Installation i = new Installation(f.getCanonicalFile(), this);
+                    if (!dirs.contains(i)) {
+                        dirs.add(i);
+                    }
+                } catch (IOException ex) {
+                } catch (InstallerException ex) {
+                }
+            }
+        }
+
+        return dirs;
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MacInstaller.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MacInstaller.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class MacInstaller extends Installer {
+
+    @Override
+    public void install(File dir, boolean bit64) throws InstallerException {
+        if(bit64) throw new InstallerException("64 Bit Soylatte is not supported in this installer version.");
+        super.install(dir, bit64);
+    }
+
+    public String getClientDirectory() {
+        return "lib/i386/client";
+    }
+
+    public String getServerDirectory(boolean is64Bit) {
+        if (is64Bit) {
+            return "lib/amd64/server";
+        } else {
+            return "lib/i386/server";
+        }
+    }
+
+    public String getLibraryName() {
+        return "libjvm.dylib";
+    }
+
+    public String getJavaExecutable() {
+        return "bin/java";
+    }
+
+    @Override
+    public List<Installation> listAllInstallations() {
+        return new ArrayList<Installation>();
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Main.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Main.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ * @author Thomas Wuerthinger
+ */
+public class Main {
+
+    public static void main(String[] args) {
+        try {
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        } catch (UnsupportedLookAndFeelException e) {
+        } catch (ClassNotFoundException e) {
+        } catch (InstantiationException e) {
+        } catch (IllegalAccessException e) {
+        }
+
+        MainWindow w;
+        try {
+            Installer i = Installer.create();
+            w = new MainWindow(i);
+            w.setLocationRelativeTo(null);
+            w.setVisible(true);
+        } catch (InstallerException ex) {
+            JOptionPane.showMessageDialog(null, ex.getMessage(), ex.getMessage(), JOptionPane.ERROR_MESSAGE);
+        }
+
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MainWindow.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MainWindow.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.prefs.Preferences;
+import javax.imageio.ImageIO;
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class MainWindow extends JFrame {
+
+    private final InstallationsTableModel installations;
+    private final Installer installer;
+    private JTable table;
+
+    public MainWindow(Installer inst) {
+        super("Dynamic Code Evolution VM Installer");
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        installer = inst;
+        installations = new InstallationsTableModel();
+        for (Installation i : installer.listAllInstallations()) {
+            installations.add(i);
+        }
+        add(getBanner(), BorderLayout.NORTH);
+        add(getCenterPanel(), BorderLayout.CENTER);
+        add(getBottomPanel(), BorderLayout.SOUTH);
+
+        if (table.getRowCount() > 0) {
+            table.setRowSelectionInterval(0, 0);
+        }
+
+        pack();
+        setMinimumSize(getSize());
+    }
+
+    static void showInstallerException(InstallerException ex, Component parent) {
+        Throwable e = ex;
+        String error = e.getMessage();
+        e = e.getCause();
+
+        while (e != null) {
+            error += "\n" + e.getMessage();
+            e = e.getCause();
+        }
+
+        ex.printStackTrace();
+
+        error += "\nPlease ensure that no other Java applications are running and you have sufficient permissions.";
+        JOptionPane.showMessageDialog(parent, error, ex.getMessage(), JOptionPane.ERROR_MESSAGE);
+    }
+
+    private JComponent getBanner() {
+        try {
+            BufferedImage img = ImageIO.read(getClass().getResource("splash.png"));
+            JLabel title = new JLabel(new ImageIcon(img));
+            title.setPreferredSize(new Dimension(img.getWidth() + 10, img.getHeight()));
+            title.setOpaque(true);
+            title.setBackground(new Color(238, 238, 255));
+            return title;
+        } catch (IOException ex) {
+        }
+        return new JLabel();
+    }
+
+    private JComponent getCenterPanel() {
+        JPanel center = new JPanel(new BorderLayout());
+        center.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+        center.setBackground(Color.WHITE);
+        JTextArea license = new javax.swing.JTextArea();
+        license.setLineWrap(true);
+        license.setWrapStyleWord(true);
+        license.setEditable(false);
+        license.setFont(license.getFont().deriveFont(11.0f));
+        StringBuilder licenseText = new StringBuilder();
+        licenseText.append("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation.\n\nThis code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.");
+        licenseText.append("\n\n\nASM LICENSE TEXT:\nCopyright (c) 2000-2005 INRIA, France Telecom\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
+        license.setText(licenseText.toString());
+        JScrollPane licenses = new JScrollPane(license, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        licenses.setPreferredSize(new Dimension(150, 150));
+        center.add(licenses, BorderLayout.NORTH);
+        center.add(getChooserPanel(), BorderLayout.CENTER);
+        return center;
+    }
+
+    private JComponent getChooserPanel() {
+        JPanel p = new JPanel(new BorderLayout());
+        p.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
+        p.setOpaque(false);
+
+        JLabel l = new JLabel("Please choose installation directory:");
+        l.setVerticalAlignment(JLabel.NORTH);
+        l.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
+        p.add(l, BorderLayout.WEST);
+
+        table = new JTable(installations);
+        table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        table.setColumnSelectionAllowed(false);
+        table.setDefaultRenderer(Object.class, new InstallationTableCellRenderer());
+        table.getColumnModel().getColumn(0).setHeaderValue("Directory");
+        table.getColumnModel().getColumn(0).setPreferredWidth(300);
+        table.getColumnModel().getColumn(1).setHeaderValue("Java Version");
+        table.getColumnModel().getColumn(2).setHeaderValue("Type");
+        table.getColumnModel().getColumn(3).setHeaderValue("DCE");
+        JScrollPane lists = new JScrollPane(table);
+        lists.setPreferredSize(new Dimension(200, 200));
+        p.add(lists, BorderLayout.CENTER);
+
+        return p;
+    }
+
+    private JComponent getBottomPanel() {
+
+        JPanel left = new JPanel(new FlowLayout());
+        left.add(new JButton(new AddDirectoryAction(this, installations, installer)));
+
+        JPanel right = new JPanel(new FlowLayout());
+        right.add(new JButton(new TestAction(table, installer)));
+        right.add(new JButton(new InstallUninstallAction(false, table)));
+        right.add(new JButton(new InstallUninstallAction(true, table)));
+
+        JPanel bottom = new JPanel(new BorderLayout());
+        bottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+        bottom.add(left, BorderLayout.WEST);
+        bottom.add(right, BorderLayout.EAST);
+
+        return bottom;
+    }
+}
+
+class AddDirectoryAction extends AbstractAction {
+
+    private final Component parent;
+    private final InstallationsTableModel installations;
+    private final Installer installer;
+
+    public AddDirectoryAction(Component parent, InstallationsTableModel inst, Installer installer) {
+        super("Add installation directory...");
+        this.parent = parent;
+        installations = inst;
+        this.installer = installer;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        JFileChooser fc = new JFileChooser();
+        fc.setDialogTitle("Select a Java installation directory...");
+        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+        fc.setAcceptAllFileFilterUsed(false);
+        Preferences p = Preferences.userNodeForPackage(Installer.class);
+        final String prefID = "defaultDirectory";
+        fc.setCurrentDirectory(new File(p.get(prefID, ".")));
+
+        if (fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
+
+            File dir = fc.getSelectedFile();
+            p.put(prefID, dir.getParent());
+            try {
+                installations.add(new Installation(dir, installer));
+            } catch (InstallerException ex) {
+                MainWindow.showInstallerException(ex, parent);
+            }
+        }
+    }
+}
+
+class InstallUninstallAction extends AbstractAction implements ListSelectionListener, Observer {
+
+    private final JTable table;
+    private final boolean install;
+    private Installation installation;
+
+    public InstallUninstallAction(boolean install, JTable t) {
+        super(install ? "Install" : "Uninstall");
+        this.install = install;
+        setEnabled(false);
+        table = t;
+        t.getSelectionModel().addListSelectionListener(this);
+    }
+
+    private Installation getSelectedInstallation() {
+        InstallationsTableModel itm = (InstallationsTableModel) table.getModel();
+        int sel = table.getSelectedRow();
+        if (sel < 0) {
+            return null;
+        } else {
+            return itm.getInstallationAt(sel);
+        }
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        try {
+            if (install) {
+                getSelectedInstallation().installDCE();
+            } else {
+                getSelectedInstallation().uninstallDCE();
+            }
+        } catch (InstallerException ex) {
+            MainWindow.showInstallerException(ex, table);
+        }
+    }
+
+    private void setCurrentInstallation(Installation i) {
+        if (installation != null) {
+            installation.deleteObserver(this);
+        }
+        installation = i;
+        if (installation != null) {
+            installation.addObserver(this);
+        }
+        update();
+    }
+
+    public void valueChanged(ListSelectionEvent e) {
+        Installation i = getSelectedInstallation();
+        setCurrentInstallation(i);
+    }
+
+    private void update() {
+        if (install) {
+            setEnabled(installation != null && !installation.isDCEInstalled());
+        } else {
+            setEnabled(installation != null && installation.isDCEInstalled());
+        }
+    }
+
+    public void update(Observable o, Object arg) {
+        update();
+    }
+}
+
+class TestAction extends AbstractAction implements ListSelectionListener, Observer {
+
+    private final JTable table;
+    private Installation installation;
+    private final Installer installer;
+
+    public TestAction(JTable t, Installer i) {
+        super("Test Installation");
+        setEnabled(false);
+        table = t;
+        installer = i;
+        t.getSelectionModel().addListSelectionListener(this);
+    }
+
+    private Installation getSelectedInstallation() {
+        InstallationsTableModel itm = (InstallationsTableModel) table.getModel();
+        int sel = table.getSelectedRow();
+        if (sel < 0) {
+            return null;
+        } else {
+            return itm.getInstallationAt(sel);
+        }
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        File p = installation.getPath();
+        if(installation.isJDK()) p = new File(p, "jre");
+
+        String result = "";
+        try {
+            String agentparam = "-javaagent:" + p.getAbsolutePath() + "/lib/ext/dcevm.jar";
+            result = installer.executeJava(p, agentparam, "at.ssw.mixin.fasttest.FastTest");
+        } catch (InstallerException ex) {
+            MainWindow.showInstallerException(ex, table);
+        }
+
+        if(result.length()>0) {
+            String msg = "Tests failed:\n" + result;
+            JOptionPane.showMessageDialog(table.getTopLevelAncestor(), msg, "Error", JOptionPane.ERROR_MESSAGE);
+        } else {
+            JOptionPane.showMessageDialog(table.getTopLevelAncestor(), "All tests succeeded.", "Information", JOptionPane.INFORMATION_MESSAGE);
+        }
+    }
+
+    private void setCurrentInstallation(Installation i) {
+        if (installation != null) {
+            installation.deleteObserver(this);
+        }
+        installation = i;
+        if (installation != null) {
+            installation.addObserver(this);
+        }
+        update();
+    }
+
+    public void valueChanged(ListSelectionEvent e) {
+        Installation i = getSelectedInstallation();
+        setCurrentInstallation(i);
+    }
+
+    private void update() {
+        setEnabled(installation != null && installation.isDCEInstalled());
+    }
+
+    public void update(Observable o, Object arg) {
+        update();
+    }
+}
+
+class InstallationsTableModel extends AbstractTableModel implements Observer {
+
+    private final ArrayList<Installation> installations;
+
+    public InstallationsTableModel() {
+        installations = new ArrayList<Installation>();
+    }
+
+    public int getRowCount() {
+        return installations.size();
+    }
+
+    public int getColumnCount() {
+        return 4;
+    }
+
+    public Object getValueAt(int rowIndex, int columnIndex) {
+        return installations.get(rowIndex);
+    }
+
+    public Installation getInstallationAt(int row) {
+        return installations.get(row);
+    }
+
+    public void add(Installation i) {
+        installations.add(i);
+        i.addObserver(this);
+        fireTableDataChanged();
+    }
+
+    public void update(Observable o, Object arg) {
+        int row = installations.indexOf(o);
+        fireTableRowsUpdated(row, row);
+    }
+}
+
+class InstallationTableCellRenderer extends DefaultTableCellRenderer {
+
+    @Override
+    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+        Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+
+        if (c instanceof JLabel && value instanceof Installation) {
+            JLabel l = (JLabel) c;
+            Installation i = (Installation) value;
+
+            switch (column) {
+                case 0:
+                    l.setText(i.getPath().getAbsolutePath());
+                    break;
+                case 1:
+                    l.setText(i.getVersion());
+                    break;
+                case 2:
+                    l.setText(i.isJDK() ? "JDK" : "JRE");
+                    if (i.is64Bit()) {
+                        l.setText(l.getText() + " (64 Bit)");
+                    }
+                    break;
+                case 3:
+                    if (i.isDCEInstalled()) {
+                        l.setText("Yes (" + i.getDCEVersion() + ")");
+                    } else {
+                        l.setText("No");
+                    }
+                    break;
+            }
+        }
+
+        return c;
+    }
+
+    @Override
+    public void setText(String text) {
+        super.setText(text);
+        setToolTipText(text);
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/WindowsInstaller.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/WindowsInstaller.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.installer;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class WindowsInstaller extends Installer {
+
+    public String getClientDirectory() {
+        return "bin\\client";
+    }
+
+    public String getServerDirectory(boolean is64bit) {
+        return "bin\\server";
+    }
+
+    public String getJavaExecutable() {
+        return "bin\\java.exe";
+    }
+
+    public String getLibraryName() {
+        return "jvm.dll";
+    }
+
+    public List<Installation> listAllInstallations() {
+        List<Installation> installations = new ArrayList<Installation>();
+        String[] searchForJavaString = new String[]{
+            System.getenv("JAVA_HOME") + "\\..",
+            System.getenv("PROGRAMW6432") + "\\JAVA",
+            System.getenv("PROGRAMFILES") + "\\JAVA",
+            System.getenv("SYSTEMDRIVE") + "\\JAVA"};
+
+        for (String fileString : searchForJavaString) {
+            File javaDir = new File(fileString);
+
+            if (javaDir.exists() && javaDir.isDirectory()) {
+                for (File f : javaDir.listFiles()) {
+                    if (f.getName().startsWith("jdk") || f.getName().startsWith("jre")) {
+                        try {
+                            Installation i = new Installation(f, this);
+                            if (!installations.contains(i)) {
+                                installations.add(i);
+                            }
+                        } catch (InstallerException ex) {
+                        }
+                    }
+                }
+            }
+        }
+        return installations;
+    }
+
+    @Override
+    public boolean isJDK(File directory) {
+        if (directory.isDirectory() && directory.getName().startsWith("jdk")) {
+            File jreDir = new File(directory, "jre");
+            return isJRE(jreDir);
+        }
+        return false;
+    }
+}
diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/splash.png
Binary file hotswapinstaller/Installer/src/at/ssw/hotswap/installer/splash.png has changed
diff -r f5603a6e5042 hotswaptest/HotSwapTests/build.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/build.xml	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="HotSwapTests" default="default" basedir=".">
+    <description>Builds, tests, and runs the project HotSwapTests.</description>
+    <import file="nbproject/build-impl.xml"/>
+    <!--
+
+    There exist several targets which are by default empty and which can be
+    used for execution of your tasks. These targets are usually executed
+    before and after some main targets. They are:
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported
+    nbproject/build-impl.xml file.
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are:
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar-with-manifest:    JAR building (if you are using a manifest)
+      -do-jar-without-manifest: JAR building (if you are not using a manifest)
+      run:                      execution of project
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    An example of overriding the target for project execution could look like this:
+
+        <target name="run" depends="HotSwapTests-impl.jar">
+            <exec dir="bin" executable="launcher.exe">
+                <arg file="${dist.jar}"/>
+            </exec>
+        </target>
+
+    Notice that the overridden target depends on the jar target and not only on
+    the compile target as the regular run target does. Again, for a list of available
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file.
+
+    -->
+</project>
diff -r f5603a6e5042 hotswaptest/HotSwapTests/manifest.mf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/manifest.mf	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/build-impl.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/nbproject/build-impl.xml	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,1056 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+  - initialization
+  - compilation
+  - jar
+  - execution
+  - debugging
+  - javadoc
+  - junit compilation
+  - junit execution
+  - junit debugging
+  - applet
+  - cleanup
+
+        -->
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="HotSwapTests-impl">
+    <fail message="Please build using Ant 1.7.1 or higher.">
+        <condition>
+            <not>
+                <antversion atleast="1.7.1"/>
+            </not>
+        </condition>
+    </fail>
+    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
+    <!-- 
+                ======================
+                INITIALIZATION SECTION 
+                ======================
+            -->
+    <target name="-pre-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init" name="-init-private">
+        <property file="nbproject/private/config.properties"/>
+        <property file="nbproject/private/configs/${config}.properties"/>
+        <property file="nbproject/private/private.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private" name="-init-user">
+        <property file="${user.properties.file}"/>
+        <!-- The two properties below are usually overridden -->
+        <!-- by the active platform. Just a fallback. -->
+        <property name="default.javac.source" value="1.4"/>
+        <property name="default.javac.target" value="1.4"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
+        <property file="nbproject/configs/${config}.properties"/>
+        <property file="nbproject/project.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
+        <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
+        <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
+        <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
+        <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
+        <condition property="platform.javac" value="${platform.home}/bin/javac">
+            <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
+        </condition>
+        <property name="platform.javac" value="${platform.javac.tmp}"/>
+        <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
+        <condition property="platform.java" value="${platform.home}/bin/java">
+            <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
+        </condition>
+        <property name="platform.java" value="${platform.java.tmp}"/>
+        <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
+        <condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
+            <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
+        </condition>
+        <property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
+        <condition property="platform.invalid" value="true">
+            <or>
+                <contains string="${platform.javac}" substring="$${platforms."/>
+                <contains string="${platform.java}" substring="$${platforms."/>
+                <contains string="${platform.javadoc}" substring="$${platforms."/>
+            </or>
+        </condition>
+        <fail unless="platform.home">Must set platform.home</fail>
+        <fail unless="platform.bootcp">Must set platform.bootcp</fail>
+        <fail unless="platform.java">Must set platform.java</fail>
+        <fail unless="platform.javac">Must set platform.javac</fail>
+        <fail if="platform.invalid">
+ The J2SE Platform is not correctly set up.
+ Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. 
+ Either open the project in the IDE and setup the Platform with the same name or add it manually.
+ For example like this:
+     ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
+  or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used) 
+  </fail>
+        <available file="${manifest.file}" property="manifest.available"/>
+        <condition property="splashscreen.available">
+            <and>
+                <not>
+                    <equals arg1="${application.splash}" arg2="" trim="true"/>
+                </not>
+                <available file="${application.splash}"/>
+            </and>
+        </condition>
+        <condition property="main.class.available">
+            <and>
+                <isset property="main.class"/>
+                <not>
+                    <equals arg1="${main.class}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class">
+            <and>
+                <isset property="manifest.available"/>
+                <isset property="main.class.available"/>
+            </and>
+        </condition>
+        <condition property="do.mkdist">
+            <and>
+                <isset property="libs.CopyLibs.classpath"/>
+                <not>
+                    <istrue value="${mkdist.disabled}"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class+mkdist.available">
+            <and>
+                <istrue value="${manifest.available+main.class}"/>
+                <isset property="do.mkdist"/>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
+            <and>
+                <istrue value="${manifest.available+main.class+mkdist.available}"/>
+                <istrue value="${splashscreen.available}"/>
+            </and>
+        </condition>
+        <condition property="do.archive">
+            <not>
+                <istrue value="${jar.archive.disabled}"/>
+            </not>
+        </condition>
+        <condition property="do.archive+manifest.available">
+            <and>
+                <isset property="manifest.available"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available+main.class">
+            <and>
+                <istrue value="${manifest.available+main.class}"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available+main.class+mkdist.available">
+            <and>
+                <istrue value="${manifest.available+main.class+mkdist.available}"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
+            <and>
+                <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="have.tests">
+            <or/>
+        </condition>
+        <condition property="have.sources">
+            <or>
+                <available file="${src.dir}"/>
+            </or>
+        </condition>
+        <condition property="netbeans.home+have.tests">
+            <and>
+                <isset property="netbeans.home"/>
+                <isset property="have.tests"/>
+            </and>
+        </condition>
+        <condition property="no.javadoc.preview">
+            <and>
+                <isset property="javadoc.preview"/>
+                <isfalse value="${javadoc.preview}"/>
+            </and>
+        </condition>
+        <property name="run.jvmargs" value=""/>
+        <property name="javac.compilerargs" value=""/>
+        <property name="work.dir" value="${basedir}"/>
+        <condition property="no.deps">
+            <and>
+                <istrue value="${no.dependencies}"/>
+            </and>
+        </condition>
+        <property name="javac.debug" value="true"/>
+        <property name="javadoc.preview" value="true"/>
+        <property name="application.args" value=""/>
+        <property name="source.encoding" value="${file.encoding}"/>
+        <property name="runtime.encoding" value="${source.encoding}"/>
+        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
+            <and>
+                <isset property="javadoc.encoding"/>
+                <not>
+                    <equals arg1="${javadoc.encoding}" arg2=""/>
+                </not>
+            </and>
+        </condition>
+        <property name="javadoc.encoding.used" value="${source.encoding}"/>
+        <property name="includes" value="**"/>
+        <property name="excludes" value=""/>
+        <property name="do.depend" value="false"/>
+        <condition property="do.depend.true">
+            <istrue value="${do.depend}"/>
+        </condition>
+        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
+        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
+            <length length="0" string="${endorsed.classpath}" when="greater"/>
+        </condition>
+        <property name="jar.index" value="false"/>
+        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
+    </target>
+    <target name="-post-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
+        <fail unless="src.dir">Must set src.dir</fail>
+        <fail unless="build.dir">Must set build.dir</fail>
+        <fail unless="dist.dir">Must set dist.dir</fail>
+        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
+        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
+        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
+        <fail unless="dist.jar">Must set dist.jar</fail>
+    </target>
+    <target name="-init-macrodef-property">
+        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute name="name"/>
+            <attribute name="value"/>
+            <sequential>
+                <property name="@{name}" value="${@{value}}"/>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <attribute default="${javac.processorpath}" name="processorpath"/>
+            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="${empty.dir}" name="sourcepath"/>
+            <attribute default="${empty.dir}" name="gensrcdir"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.dir}/empty" name="empty.dir"/>
+                <mkdir dir="${empty.dir}"/>
+                <mkdir dir="@{apgeneratedsrcdir}"/>
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <compilerarg line="${javac.compilerargs}"/>
+                    <compilerarg value="-processorpath"/>
+                    <compilerarg path="@{processorpath}:${empty.dir}"/>
+                    <compilerarg line="${ap.processors.internal}"/>
+                    <compilerarg line="${annotation.processing.processor.options}"/>
+                    <compilerarg value="-s"/>
+                    <compilerarg path="@{apgeneratedsrcdir}"/>
+                    <compilerarg line="${ap.proc.none.internal}"/>
+                    <customize/>
+                </javac>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <attribute default="${javac.processorpath}" name="processorpath"/>
+            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="${empty.dir}" name="sourcepath"/>
+            <attribute default="${empty.dir}" name="gensrcdir"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.dir}/empty" name="empty.dir"/>
+                <mkdir dir="${empty.dir}"/>
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <compilerarg line="${javac.compilerargs}"/>
+                    <customize/>
+                </javac>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
+        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <sequential>
+                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                </depend>
+            </sequential>
+        </macrodef>
+        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <sequential>
+                <fail unless="javac.includes">Must set javac.includes</fail>
+                <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
+                    <path>
+                        <filelist dir="@{destdir}" files="${javac.includes}"/>
+                    </path>
+                    <globmapper from="*.java" to="*.class"/>
+                </pathconvert>
+                <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
+                <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
+                <delete>
+                    <files includesfile="${javac.includesfile.binary}"/>
+                </delete>
+                <delete file="${javac.includesfile.binary}"/>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-junit">
+        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="**" name="testincludes"/>
+            <sequential>
+                <property name="junit.forkmode" value="perTest"/>
+                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
+                    <batchtest todir="${build.test.results.dir}"/>
+                    <classpath>
+                        <path path="${run.test.classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="test-sys-prop."/>
+                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <formatter type="brief" usefile="false"/>
+                    <formatter type="xml"/>
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                </junit>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
+    <target name="-profile-pre-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target name="-profile-post-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target name="-profile-init-macrodef-profile">
+        <macrodef name="resolve">
+            <attribute name="name"/>
+            <attribute name="value"/>
+            <sequential>
+                <property name="@{name}" value="${env.@{value}}"/>
+            </sequential>
+        </macrodef>
+        <macrodef name="profile">
+            <attribute default="${main.class}" name="classname"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property environment="env"/>
+                <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
+                <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
+                    <jvmarg value="${profiler.info.jvmargs.agent}"/>
+                    <jvmarg line="${profiler.info.jvmargs}"/>
+                    <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+                    <arg line="${application.args}"/>
+                    <classpath>
+                        <path path="${run.classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
+        <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
+        <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
+    </target>
+    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
+        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="name"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <attribute default="" name="stopclassname"/>
+            <sequential>
+                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <bootclasspath>
+                        <path path="${platform.bootcp}"/>
+                    </bootclasspath>
+                </nbjpdastart>
+            </sequential>
+        </macrodef>
+        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${build.classes.dir}" name="dir"/>
+            <sequential>
+                <nbjpdareload>
+                    <fileset dir="@{dir}" includes="${fix.classes}">
+                        <include name="${fix.includes}*.class"/>
+                    </fileset>
+                </nbjpdareload>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-debug-args">
+        <exec executable="${platform.java}" outputproperty="version-output">
+            <arg value="-version"/>
+        </exec>
+        <condition property="have-jdk-older-than-1.4">
+            <or>
+                <contains string="${version-output}" substring="java version &quot;1.0"/>
+                <contains string="${version-output}" substring="java version &quot;1.1"/>
+                <contains string="${version-output}" substring="java version &quot;1.2"/>
+                <contains string="${version-output}" substring="java version &quot;1.3"/>
+            </or>
+        </condition>
+        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
+            <istrue value="${have-jdk-older-than-1.4}"/>
+        </condition>
+        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
+            <os family="windows"/>
+        </condition>
+        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
+            <isset property="debug.transport"/>
+        </condition>
+    </target>
+    <target depends="-init-debug-args" name="-init-macrodef-debug">
+        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${main.class}" name="classname"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg line="${debug-args-line}"/>
+                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
+                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-java">
+        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="classname"/>
+            <attribute default="${run.classpath}" name="classpath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-copylibs">
+        <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+                <pathconvert property="run.classpath.without.build.classes.dir">
+                    <path path="${run.classpath}"/>
+                    <map from="${build.classes.dir.resolved}" to=""/>
+                </pathconvert>
+                <pathconvert pathsep=" " property="jar.classpath">
+                    <path path="${run.classpath.without.build.classes.dir}"/>
+                    <chainedmapper>
+                        <flattenmapper/>
+                        <globmapper from="*" to="lib/*"/>
+                    </chainedmapper>
+                </pathconvert>
+                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
+                <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
+                    <fileset dir="${build.classes.dir}"/>
+                    <manifest>
+                        <attribute name="Class-Path" value="${jar.classpath}"/>
+                        <customize/>
+                    </manifest>
+                </copylibs>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-presetdef-jar">
+        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
+                <j2seproject1:fileset dir="${build.classes.dir}"/>
+            </jar>
+        </presetdef>
+    </target>
+    <target name="-init-ap-cmdline-properties">
+        <property name="annotation.processing.enabled" value="true"/>
+        <property name="annotation.processing.processors.list" value=""/>
+        <property name="annotation.processing.processor.options" value=""/>
+        <property name="annotation.processing.run.all.processors" value="true"/>
+        <property name="javac.processorpath" value="${javac.classpath}"/>
+        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
+        <condition property="ap.supported.internal" value="true">
+            <not>
+                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
+            </not>
+        </condition>
+    </target>
+    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
+        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
+            <isfalse value="${annotation.processing.run.all.processors}"/>
+        </condition>
+        <condition else="" property="ap.proc.none.internal" value="-proc:none">
+            <isfalse value="${annotation.processing.enabled}"/>
+        </condition>
+    </target>
+    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
+        <property name="ap.cmd.line.internal" value=""/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
+    <!--
+                ===================
+                COMPILATION SECTION
+                ===================
+            -->
+    <target name="-deps-jar-init" unless="built-jar.properties">
+        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
+        <delete file="${built-jar.properties}" quiet="true"/>
+    </target>
+    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
+        <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
+    </target>
+    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
+        <mkdir dir="${build.dir}"/>
+        <touch file="${built-jar.properties}" verbose="false"/>
+        <property file="${built-jar.properties}" prefix="already.built.jar."/>
+        <antcall target="-warn-already-built-jar"/>
+        <propertyfile file="${built-jar.properties}">
+            <entry key="${basedir}" value=""/>
+        </propertyfile>
+        <antcall target="-maybe-call-dep">
+            <param name="call.built.properties" value="${built-jar.properties}"/>
+            <param location="${project.HotSwapTool}" name="call.subproject"/>
+            <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
+            <param name="call.target" value="jar"/>
+            <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
+        </antcall>
+    </target>
+    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
+    <target depends="init" name="-check-automatic-build">
+        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
+    </target>
+    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
+        <antcall target="clean"/>
+    </target>
+    <target depends="init,deps-jar" name="-pre-pre-compile">
+        <mkdir dir="${build.classes.dir}"/>
+    </target>
+    <target name="-pre-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-depend">
+        <pathconvert property="build.generated.subdirs">
+            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="*"/>
+            </dirset>
+        </pathconvert>
+        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
+        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
+        <copy todir="${build.classes.dir}">
+            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target if="has.persistence.xml" name="-copy-persistence-xml">
+        <mkdir dir="${build.classes.dir}/META-INF"/>
+        <copy todir="${build.classes.dir}/META-INF">
+            <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
+        </copy>
+    </target>
+    <target name="-post-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
+    <target name="-pre-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile/>
+        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
+    </target>
+    <target name="-post-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
+    <!--
+                ====================
+                JAR BUILDING SECTION
+                ====================
+            -->
+    <target depends="init" name="-pre-pre-jar">
+        <dirname file="${dist.jar}" property="dist.jar.dir"/>
+        <mkdir dir="${dist.jar.dir}"/>
+    </target>
+    <target name="-pre-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
+        <j2seproject1:jar/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
+        <j2seproject1:jar manifest="${manifest.file}"/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
+        <j2seproject1:jar manifest="${manifest.file}">
+            <j2seproject1:manifest>
+                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
+            </j2seproject1:manifest>
+        </j2seproject1:jar>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <pathconvert property="run.classpath.with.dist.jar">
+            <path path="${run.classpath}"/>
+            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
+        </pathconvert>
+        <echo>${platform.java} -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
+        <basename file="${application.splash}" property="splashscreen.basename"/>
+        <mkdir dir="${build.classes.dir}/META-INF"/>
+        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
+        <j2seproject3:copylibs>
+            <customize>
+                <attribute name="Main-Class" value="${main.class}"/>
+                <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
+            </customize>
+        </j2seproject3:copylibs>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
+        <j2seproject3:copylibs>
+            <customize>
+                <attribute name="Main-Class" value="${main.class}"/>
+            </customize>
+        </j2seproject3:copylibs>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
+    </target>
+    <target name="-post-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
+    <!--
+                =================
+                EXECUTION SECTION
+                =================
+            -->
+    <target depends="init,compile" description="Run a main class." name="run">
+        <j2seproject1:java>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <target name="-do-not-recompile">
+        <property name="javac.includes.binary" value=""/>
+    </target>
+    <target depends="init,compile-single" name="run-single">
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+        <j2seproject1:java classname="${run.class}"/>
+    </target>
+    <target depends="init,compile-test-single" name="run-test-with-main">
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
+    </target>
+    <!--
+                =================
+                DEBUGGING SECTION
+                =================
+            -->
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
+        <j2seproject1:nbjpdastart name="${debug.class}"/>
+    </target>
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
+    </target>
+    <target depends="init,compile" name="-debug-start-debuggee">
+        <j2seproject3:debug>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
+        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
+    </target>
+    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+        <j2seproject3:debug classname="${debug.class}"/>
+    </target>
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
+    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
+    </target>
+    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
+    <target depends="init" name="-pre-debug-fix">
+        <fail unless="fix.includes">Must set fix.includes</fail>
+        <property name="javac.includes" value="${fix.includes}.java"/>
+    </target>
+    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
+        <j2seproject1:nbjpdareload/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
+    <!--
+                =================
+                PROFILING SECTION
+                =================
+            -->
+    <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <profile/>
+    </target>
+    <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
+        <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <profile classname="${profile.class}"/>
+    </target>
+    <!--
+                =========================
+                APPLET PROFILING  SECTION
+                =========================
+            -->
+    <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <profile classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </profile>
+    </target>
+    <!--
+                =========================
+                TESTS PROFILING  SECTION
+                =========================
+            -->
+    <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.test.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
+            <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+            <jvmarg value="${profiler.info.jvmargs.agent}"/>
+            <jvmarg line="${profiler.info.jvmargs}"/>
+            <test name="${profile.class}"/>
+            <classpath>
+                <path path="${run.test.classpath}"/>
+            </classpath>
+            <syspropertyset>
+                <propertyref prefix="test-sys-prop."/>
+                <mapper from="test-sys-prop.*" to="*" type="glob"/>
+            </syspropertyset>
+            <formatter type="brief" usefile="false"/>
+            <formatter type="xml"/>
+        </junit>
+    </target>
+    <!--
+                ===============
+                JAVADOC SECTION
+                ===============
+            -->
+    <target depends="init" if="have.sources" name="-javadoc-build">
+        <mkdir dir="${dist.javadoc.dir}"/>
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
+            <classpath>
+                <path path="${javac.classpath}"/>
+            </classpath>
+            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+                <filename name="**/*.java"/>
+            </fileset>
+            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="**/*.java"/>
+            </fileset>
+        </javadoc>
+        <copy todir="${dist.javadoc.dir}">
+            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+                <filename name="**/doc-files/**"/>
+            </fileset>
+            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="**/doc-files/**"/>
+            </fileset>
+        </copy>
+    </target>
+    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
+        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
+    </target>
+    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
+    <!--
+                =========================
+                JUNIT COMPILATION SECTION
+                =========================
+            -->
+    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
+        <mkdir dir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-pre-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-test-depend">
+        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir=""/>
+        <copy todir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-post-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
+    <target name="-pre-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="" srcdir=""/>
+        <copy todir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-post-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
+    <!--
+                =======================
+                JUNIT EXECUTION SECTION
+                =======================
+            -->
+    <target depends="init" if="have.tests" name="-pre-test-run">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
+        <j2seproject3:junit testincludes="**/*Test.java"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init" if="have.tests" name="test-report"/>
+    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
+    <target depends="init" if="have.tests" name="-pre-test-run-single">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
+        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+        <j2seproject3:junit excludes="" includes="${test.includes}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
+    <!--
+                =======================
+                JUNIT DEBUGGING SECTION
+                =======================
+            -->
+    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
+        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
+        <delete file="${test.report.file}"/>
+        <mkdir dir="${build.test.results.dir}"/>
+        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
+            <customize>
+                <syspropertyset>
+                    <propertyref prefix="test-sys-prop."/>
+                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                </syspropertyset>
+                <arg value="${test.class}"/>
+                <arg value="showoutput=true"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
+    </target>
+    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
+    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
+        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
+    <!--
+                =========================
+                APPLET EXECUTION SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" name="run-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject1:java classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <!--
+                =========================
+                APPLET DEBUGGING  SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject3:debug classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
+    <!--
+                ===============
+                CLEANUP SECTION
+                ===============
+            -->
+    <target name="-deps-clean-init" unless="built-clean.properties">
+        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
+        <delete file="${built-clean.properties}" quiet="true"/>
+    </target>
+    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
+        <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
+    </target>
+    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
+        <mkdir dir="${build.dir}"/>
+        <touch file="${built-clean.properties}" verbose="false"/>
+        <property file="${built-clean.properties}" prefix="already.built.clean."/>
+        <antcall target="-warn-already-built-clean"/>
+        <propertyfile file="${built-clean.properties}">
+            <entry key="${basedir}" value=""/>
+        </propertyfile>
+        <antcall target="-maybe-call-dep">
+            <param name="call.built.properties" value="${built-clean.properties}"/>
+            <param location="${project.HotSwapTool}" name="call.subproject"/>
+            <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
+            <param name="call.target" value="clean"/>
+            <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
+        </antcall>
+    </target>
+    <target depends="init" name="-do-clean">
+        <delete dir="${build.dir}"/>
+        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
+    </target>
+    <target name="-post-clean">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
+    <target name="-check-call-dep">
+        <property file="${call.built.properties}" prefix="already.built."/>
+        <condition property="should.call.dep">
+            <not>
+                <isset property="already.built.${call.subproject}"/>
+            </not>
+        </condition>
+    </target>
+    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
+        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
+            <propertyset>
+                <propertyref prefix="transfer."/>
+                <mapper from="transfer.*" to="*" type="glob"/>
+            </propertyset>
+        </ant>
+    </target>
+</project>
diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/configs/Run_All_Tests.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/nbproject/configs/Run_All_Tests.properties	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,2 @@
+$label=Run All Tests
+run.jvmargs=\ -Xdebug -XX:TraceRedefineClasses=4 -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n
diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/configs/Run_Natives_Tests.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/nbproject/configs/Run_Natives_Tests.properties	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,2 @@
+$label=Run Natives Tests
+run.jvmargs=\ -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n
diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/genfiles.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/nbproject/genfiles.properties	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,8 @@
+nbbuild.xml.data.CRC32=c8ab650e
+nbbuild.xml.script.CRC32=2ea92a55
+nbbuild.xml.stylesheet.CRC32=958a1d3e@1.26.2.45
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=c46425e2
+nbproject/build-impl.xml.script.CRC32=2aba14d0
+nbproject/build-impl.xml.stylesheet.CRC32=fce8b508@1.40.0.45
diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/project.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/nbproject/project.properties	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,76 @@
+application.title=HotSwapTests
+application.vendor=Thomas
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+buildfile=build.xml
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/HotSwapTests.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+excludes=
+file.reference.asm-all-3.2.jar=../lib/asm-all-3.2.jar
+file.reference.HotSwapTests-src=src
+file.reference.tools.jar=../lib/tools.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+    ${libs.junit_4.classpath}:\
+    ${reference.HotSwapTool.jar}:\
+    ${file.reference.asm-all-3.2.jar}:\
+    ${file.reference.tools.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.junit.classpath}:\
+    ${libs.junit_4.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
+jnlp.codebase.type=local
+jnlp.descriptor=application
+jnlp.enabled=false
+jnlp.offline-allowed=false
+jnlp.signed=false
+main.class=at.ssw.hotswap.test.Main
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=JDK_1.7_HotSwap
+project.HotSwapTool=../HotSwapTool
+reference.HotSwapTool.jar=${project.HotSwapTool}/dist/HotSwapTool.jar
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=${file.reference.HotSwapTests-src}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/project.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/nbproject/project.xml	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+            <name>HotSwapTests</name>
+            <minimum-ant-version>1.6.5</minimum-ant-version>
+            <explicit-platform explicit-source-supported="true"/>
+            <source-roots>
+                <root id="src.dir"/>
+            </source-roots>
+            <test-roots/>
+        </data>
+        <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
+            <reference>
+                <foreign-project>HotSwapTool</foreign-project>
+                <artifact-type>jar</artifact-type>
+                <script>build.xml</script>
+                <target>jar</target>
+                <clean-target>clean</clean-target>
+                <id>jar</id>
+            </reference>
+        </references>
+    </configuration>
+</project>
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test;
+
+import at.ssw.hotswap.test.accesstests.AccessTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import at.ssw.hotswap.test.body.BodyTestSuite;
+import at.ssw.hotswap.test.eval.EvalTestSuite;
+import at.ssw.hotswap.test.fields.FieldsTestSuite;
+import at.ssw.hotswap.test.methods.MethodsTestSuite;
+import at.ssw.hotswap.test.natives.NativesTestSuite;
+import at.ssw.hotswap.test.transformer.TransformerTestSuite;
+import at.ssw.hotswap.test.structural.StructuralTestSuite;
+
+/**
+ * Summarizes all available test suites.
+ * 
+ * @author Thomas Wuerthinger
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    BodyTestSuite.class,
+    EvalTestSuite.class,
+    MethodsTestSuite.class,
+    FieldsTestSuite.class,
+    StructuralTestSuite.class,
+    TransformerTestSuite.class,
+    NativesTestSuite.class,
+    AccessTestSuite.class
+})
+public class CompleteTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test;
+
+import at.ssw.hotswap.HotSwapTool;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+
+/**
+ * Main class for running class redefinition tests. Make sure that the execution directory is set such that this class file
+ * can be reached via "at/ssw/hotswap/test/Main.class".
+ * 
+ * There are different levels of redefinition:
+ * Swap method bodies < add/remove methods < add/remove fields < add/remove super type
+ * 
+ * Make sure that the application is started with a Java debug agent on port 4000. If you specify an argument, only tests
+ * containing the specified string are executed.
+ * 
+ * Example usage:
+ * <pre>java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n at.ssw.hotswap.test.Main SimpleTest</pre>
+ * 
+ * @author Thomas Wuerthinger
+ *
+ * Usage:
+ * If a first parameter is given, then only tests with a name containing this parameter are executed.
+ *
+ * Default values of system properties that can be overwritten:
+ * -Dhotswap.trace=0
+ *
+ */
+public class Main {
+
+    private static int failedCount;
+    private static int finishedCount;
+    private static String failureString = "";
+
+    public static void main(final String[] args) {
+
+        boolean runNativeTests = true;
+        String nativeLibraryName = new File("../../../HotSwapTestsNatives/dist/" + System.mapLibraryName("libHotSwapTestsNatives")).getAbsolutePath();
+        try {
+            System.out.println("Load native library: ");
+            System.load(nativeLibraryName);
+        } catch(UnsatisfiedLinkError e) {
+            System.out.println("WARNING: Could not load native library from path " + nativeLibraryName);
+            System.out.println("Disabling native tests");
+            runNativeTests = false;
+        }
+
+        System.out.println("Running JUnit tests: ");
+
+        JUnitCore core = new JUnitCore();
+        core.addListener(runListener);
+        Request request = Request.classes(CompleteTestSuite.class);
+        HotSwapTool.setTraceLevel(Integer.parseInt(System.getProperty("hotswap.trace", "0")));
+
+        // Filter the request?
+        if (args.length > 0) {
+
+            System.out.println("Only run tests containing \"" + args[0] + "\"");
+
+            request = request.filterWith(new Filter() {
+
+                @Override
+                public String describe() {
+                    return "Filter";
+                }
+
+                private Set<Description> childrenToRun = new HashSet<Description>();
+
+                @Override
+                public boolean shouldRun(Description d) {
+                    System.out.println(d.getDisplayName());
+
+                    if (d.getDisplayName().contains(args[0]) || childrenToRun.contains(d)) {
+                        childrenToRun.addAll(d.getChildren());
+                        return true;
+                    }
+
+                    // explicitly check if any children want to run
+                    for (Description each : d.getChildren()) {
+                        if (shouldRun(each)) {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+            });
+        }
+
+        long startTime = System.currentTimeMillis();
+        core.run(request);
+        long time = System.currentTimeMillis() - startTime;
+
+        System.out.println("" + (finishedCount - failedCount) + " of " + finishedCount + " tests are OK!");
+        System.out.println("Time: " + ((double) time) / 1000);
+        if (failedCount == 0) {
+            System.out.println("ALL OK");
+        } else {
+            System.out.println(failedCount + " FAILURES: " + failureString);
+        }
+    }
+
+    private static RunListener runListener = new RunListener() {
+
+        @Override
+        public void testStarted(Description description) throws Exception {
+            System.out.println("============================================================");
+            System.out.println("Test started: " + description.getDisplayName());
+        }
+
+        @Override
+        public void testFailure(Failure failure) throws Exception {
+            System.out.println("Test failure: " + failure.getMessage());
+            failure.getException().printStackTrace();
+            failedCount++;
+            failureString += failure.getDescription().getDisplayName() + " ";
+        }
+
+        @Override
+        public void testFinished(Description description) throws Exception {
+            System.out.println("Test finished: " + description.getDisplayName());
+            finishedCount++;
+        }
+    };
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test;
+
+import junit.framework.Assert;
+
+/**
+ *
+ * Utility methods for unit testing.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class TestUtil {
+
+    public static int assertException(Class exceptionClass, Runnable run) {
+
+        try {
+            run.run();
+        } catch(Throwable t) {
+            if (t.getClass().equals(exceptionClass)) {
+                return t.getStackTrace()[0].getLineNumber();
+            }
+            Assert.assertTrue("An exception of type " + t.getClass().getSimpleName() + " instead of " + exceptionClass.getSimpleName() + " has been thrown!", false);
+        }
+
+        Assert.assertTrue("No exception has been thrown!", false);
+        return -1;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/ClassAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/ClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access;
+
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public interface ClassAccess {
+
+    public String getName();
+
+    public MethodAccess findMethod(String method);
+
+    public List<MethodAccess> getMethods();
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/MethodAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/MethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access;
+
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public interface MethodAccess {
+
+    public String getName();
+
+    public String getSignature();
+
+    public boolean canCheckObsoletness();
+
+    public boolean isObsolete();
+
+    public Object invoke(Object[] o, Object instance);
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/StackFrameAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/StackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public interface StackFrameAccess {
+
+    public MethodAccess getMethod() throws ClassNotFoundException;
+
+    public ClassAccess getClazz();
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/VMAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/VMAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access;
+
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public interface VMAccess {
+
+    public boolean canGetFrames();
+    
+    public List<StackFrameAccess> getFrames(final String threadName);
+
+    public List<String> getThreadNames();
+
+    public ClassAccess findClass(String clazz);
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIClassAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jdi;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.MethodAccess;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JDIClassAccess implements ClassAccess {
+
+    private ReferenceType clazz;
+
+    public JDIClassAccess(ReferenceType clazz) {
+        this.clazz = clazz;
+    }
+
+    @Override
+    public String getName() {
+        return clazz.name();
+    }
+
+    @Override
+    public MethodAccess findMethod(String method) {
+        List<Method> methods = clazz.methodsByName(method);
+        List<Method> newMethods = new ArrayList<Method>();
+        for (Method m : methods) {
+            if (!m.isObsolete()) {
+                newMethods.add(m);
+            }
+        }
+        if (newMethods.size() > 1) {
+            throw new RuntimeException("ambiguous methods: " + newMethods.get(0) + ", " + newMethods.get(1));
+        }
+        if (newMethods.isEmpty()) {
+            return null;
+        }
+        return new JDIMethodAccess(newMethods.get(0), clazz);
+    }
+
+    @Override
+    public List<MethodAccess> getMethods() {
+        List<MethodAccess> methodAccesses = new ArrayList<MethodAccess>();
+        for (Method m : clazz.methods()) {
+            if (!m.name().equals("<init>")) {
+                methodAccesses.add(new JDIMethodAccess(m, clazz));
+            }
+        }
+        return methodAccesses;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIMethodAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIMethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jdi;
+
+import at.ssw.hotswap.JDIProxy;
+import at.ssw.hotswap.test.access.MethodAccess;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Type;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JDIMethodAccess implements MethodAccess {
+
+    private Method method;
+
+    public JDIMethodAccess(Method m, ReferenceType clazz) {
+        method = m;
+    }
+
+    @Override
+    public String toString() {
+        return method.toString();
+    }
+
+    @Override
+    public String getName() {
+        return method.name();
+    }
+
+    @Override
+    public String getSignature() {
+        String methodString = Modifier.toString(method.modifiers()) + " " + method.returnTypeName() + " " + method.name() + "(";
+        boolean paramFound = false;
+        try {
+            for (Type type : method.argumentTypes()) {
+                if (paramFound) {
+                    methodString += ", ";
+                }
+                paramFound = true;
+                methodString += type.name();
+            }
+        } catch (ClassNotLoadedException ex) {
+            throw new RuntimeException(ex);
+        }
+        return methodString + ")";
+    }
+
+    @Override
+    public boolean canCheckObsoletness() {
+        return true;
+    }
+
+    @Override
+    public boolean isObsolete() {
+        return method.isObsolete();
+    }
+
+    @Override
+    public Object invoke(Object[] o, Object instance) {
+        Thread tempthread = new Thread("invokeThread") {
+
+            @Override
+            public void run() {
+                try {
+                    sleep(2000);
+                } catch (InterruptedException ex) {
+                    Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
+                }
+            }
+        };
+        tempthread.start();
+
+        // get Main-Thread
+        final JDIProxy jdi = JDIProxy.getJDI();
+        ThreadReference reference = null;
+        for (ThreadReference t : jdi.getVM().allThreads()) {
+            if (t.name().equals("invokeThread")) {
+                reference = t;
+                break;
+            }
+        }
+        //  reference.suspend();
+
+        Object obj = null;
+        try {
+            obj = ((ClassType) method.declaringType()).invokeMethod(reference, method, new ArrayList(), ClassType.INVOKE_SINGLE_THREADED);
+        } catch (InvalidTypeException ex) {
+            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (ClassNotLoadedException ex) {
+            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (IncompatibleThreadStateException ex) {
+            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (InvocationException ex) {
+            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        // reference.resume();
+        return obj;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIStackFrameAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIStackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jdi;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.MethodAccess;
+import at.ssw.hotswap.test.access.StackFrameAccess;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JDIStackFrameAccess implements StackFrameAccess {
+
+    private ReferenceType clazz;
+    private Method method;
+    private MethodAccess methodAccess;
+    private ClassAccess classAccess;
+
+    JDIStackFrameAccess(StackFrame s) {
+        method = s.location().method();
+        clazz = s.location().method().declaringType();
+    }
+
+    @Override
+    public MethodAccess getMethod() {
+        if (methodAccess == null) {
+            methodAccess = new JDIMethodAccess(method, clazz);
+        }
+        return methodAccess;
+    }
+
+    @Override
+    public ClassAccess getClazz() {
+        if (classAccess == null) {
+            classAccess = new JDIClassAccess(clazz);
+        }
+        return classAccess;
+    }
+
+    @Override
+    public String toString() {
+        return method.toString();
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIVMAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIVMAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jdi;
+
+import at.ssw.hotswap.JDIProxy;
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.StackFrameAccess;
+import at.ssw.hotswap.test.access.VMAccess;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.ThreadReference;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JDIVMAccess implements VMAccess {
+
+    private List<ThreadReference> getThreads() {
+        final JDIProxy jdi = JDIProxy.getJDI();
+        return jdi.getVM().allThreads();
+    }
+
+    @Override
+    public boolean canGetFrames() {
+        return true;
+    }
+
+    @Override
+    public List<StackFrameAccess> getFrames(final String threadName) {
+        final JDIProxy jdi = JDIProxy.getJDI();
+        final Exception[] exception = new Exception[1];
+        final Object[] object = new Object[1];
+        object[0] = null;
+        exception[0] = null;
+
+        Runnable r = new Runnable() {
+
+            public void run() {
+                List<StackFrameAccess> stackAccesses = new ArrayList<StackFrameAccess>();
+                for (ThreadReference t : getThreads()) {
+                    if (t.name().equals(threadName)) {
+                        try {
+                            for (StackFrame stack : t.frames()) {
+                                StackFrameAccess stackAccess = new JDIStackFrameAccess(stack);
+                                stackAccesses.add(stackAccess);
+                            }
+                        } catch (IncompatibleThreadStateException ex) {
+                            exception[0] = ex;
+                        }
+                        object[0] = stackAccesses;
+                        return;
+                    }
+                }
+            }
+        };
+
+        jdi.executeSuspended(r);
+
+        if (exception[0] != null) {
+            throw new RuntimeException(exception[0]);
+        }
+        return (List<StackFrameAccess>) object[0];
+    }
+
+    @Override
+    public List<String> getThreadNames() {
+        List<String> threadNames = new ArrayList<String>();
+
+        for (ThreadReference t : getThreads()) {
+            threadNames.add(t.name());
+        }
+        return threadNames;
+    }
+
+    @Override
+    public ClassAccess findClass(String clazz) {
+        final JDIProxy jdi = JDIProxy.getJDI();
+        ReferenceType found = null;
+        // ensures, that all classes are retrieved
+        jdi.refreshAllClasses();
+        for (ReferenceType referenceType : jdi.getVM().allClasses()) {
+            if (referenceType.name().equals(clazz)) {
+                if (found != null) {
+                    throw new RuntimeException("ambiguous class name");
+                }
+                found = referenceType;
+            }
+        }
+        if (found == null) {
+            return null;
+        }
+        return new JDIClassAccess(found);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIClassAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jni;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.MethodAccess;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JNIClassAccess implements ClassAccess {
+
+    Class clazz;
+
+    public JNIClassAccess(Class clazz) {
+        this.clazz = clazz;
+    }
+
+    @Override
+    public String getName() {
+        return clazz.getName();
+    }
+
+    public static native Method findMethodNative(Class clazz, String methodName);
+
+    @Override
+    public MethodAccess findMethod(String methodName) {
+        Method m;
+        try {
+            m = findMethodNative(clazz, methodName);
+        } catch (NoSuchMethodError ex) {
+            return null;
+        }
+        return new JNIMethodAccess(m);
+    }
+
+    public static native Method[] getMethodsNative(Class clazz);
+
+    @Override
+    public List<MethodAccess> getMethods() {
+        Method[] array = getMethodsNative(clazz);
+        List<MethodAccess> mAccesses = new ArrayList<MethodAccess>();
+        for (int i = 0; i < array.length; i++) {
+            mAccesses.add(new JNIMethodAccess(array[i]));
+        }
+        return mAccesses;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIMethodAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIMethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jni;
+
+import at.ssw.hotswap.test.access.MethodAccess;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import org.objectweb.asm.Type;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JNIMethodAccess implements MethodAccess {
+
+    Method method;
+
+    public JNIMethodAccess(Method m) {
+        method = m;
+    }
+
+    @Override
+    public String getName() {
+        return method.getName();
+    }
+
+    @Override
+    public String getSignature() {
+        String methodString = Modifier.toString(method.getModifiers()) + " " + method.getReturnType().getName() + " " + method.getName() + "(";
+        boolean paramFound = false;
+        for (Class c : method.getParameterTypes()) {
+            if (paramFound) {
+                methodString += ", ";
+            }
+            paramFound = true;
+            methodString += c.getName();
+        }
+        return methodString + ")";
+    }
+
+    @Override
+    public boolean canCheckObsoletness() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isObsolete() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public static native Object invokeMethodNative(Class clazz, Object obj, String methodName, String retValue, boolean staticValue, String descriptor, Object[] params);
+
+    @Override
+    public Object invoke(Object[] o, Object instance) {
+        boolean staticValue = java.lang.reflect.Modifier.isStatic(method.getModifiers());
+        String retValue = method.getReturnType().getName();
+        String descriptor = new org.objectweb.asm.commons.Method(method.getName(), Type.getReturnType(method), Type.getArgumentTypes(method)).getDescriptor();
+
+        return invokeMethodNative(method.getDeclaringClass(), instance, method.getName(), retValue, staticValue, descriptor, o);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIStackFrameAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIStackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jni;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.MethodAccess;
+import at.ssw.hotswap.test.access.StackFrameAccess;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JNIStackFrameAccess implements StackFrameAccess {
+
+    @Override
+    public MethodAccess getMethod() throws ClassNotFoundException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ClassAccess getClazz() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIVMAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIVMAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.jni;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.StackFrameAccess;
+import at.ssw.hotswap.test.access.VMAccess;
+import java.io.File;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class JNIVMAccess implements VMAccess {
+
+    @Override
+    public boolean canGetFrames() {
+        return false;
+    }
+
+    @Override
+    public List<StackFrameAccess> getFrames(String threadName) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public List<String> getThreadNames() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public static native Class findClassNative(String clazz) throws ClassNotFoundException, NoClassDefFoundError;
+
+    @Override
+    public ClassAccess findClass(String clazz) {
+        try {
+            return new JNIClassAccess(findClassNative(clazz.replace('.', '/')));
+        } catch (ClassNotFoundException ex) {
+            return null;
+        } catch (NoClassDefFoundError ex) {
+            return null;
+        }
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionClassAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.reflection;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.MethodAccess;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class ReflectionClassAccess implements ClassAccess {
+
+    private Class clazz;
+   
+    public ReflectionClassAccess() {
+    }
+    public ReflectionClassAccess(String name) throws ClassNotFoundException {
+        clazz = Class.forName(name);
+    }
+
+    @Override
+    public String getName() {
+        return clazz.getName();
+    }
+
+    @Override
+    public MethodAccess findMethod(String method) {
+        try {
+            return new ReflectionMethodAccess(method, clazz.getName());
+        } catch (ClassNotFoundException ex) {
+            return null;
+        } catch (NoSuchMethodError ex) {
+            return null;
+        }
+    }
+
+    @Override
+    public List<MethodAccess> getMethods() {
+        List<MethodAccess> methodAccesses = new ArrayList<MethodAccess>();
+        for (Method m : clazz.getDeclaredMethods()) {
+            methodAccesses.add(new ReflectionMethodAccess(m, clazz));
+        }
+        return methodAccesses;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionMethodAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionMethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.reflection;
+
+import at.ssw.hotswap.test.access.MethodAccess;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class ReflectionMethodAccess implements MethodAccess {
+
+    private Method method;
+
+    public ReflectionMethodAccess(String methodName, String className) throws ClassNotFoundException, NoSuchMethodError {
+
+        Class clazz = Class.forName(className);
+
+        Method found = null;
+        for (Method m : clazz.getDeclaredMethods()) {
+            if (m.getName().equals(methodName)) {
+                if (found != null) {
+                    throw new RuntimeException("ambiguous method name");
+                }
+                found = m;
+            }
+        }
+        if (found == null) {
+            throw new NoSuchMethodError(methodName);
+        }
+        this.method = found;
+    }
+
+    public ReflectionMethodAccess(Method m, Class clazz) {
+        this.method = m;
+    }
+
+    @Override
+    public String getSignature() {
+        String methodString = Modifier.toString(method.getModifiers()) + " " + method.getReturnType().getName() + " " + method.getName() + "(";
+        boolean paramFound = false;
+        for (Class c : method.getParameterTypes()) {
+            if (paramFound) {
+                methodString += ", ";
+            }
+            paramFound = true;
+            methodString += c.getName();
+        }
+        return methodString + ")";
+    }
+
+    @Override
+    public String getName() {
+        return method.getName();
+    }
+
+    @Override
+    public boolean canCheckObsoletness() {
+        return false;
+    }
+
+    @Override
+    public boolean isObsolete() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object invoke(Object[] o, Object instance) {
+        try {
+            boolean acc = method.isAccessible();
+            method.setAccessible(true);
+            Object obj = method.invoke(instance, o);
+            method.setAccessible(acc);
+            return obj;
+        } catch (IllegalAccessException ex) {
+            throw new RuntimeException(ex);
+        } catch (IllegalArgumentException ex) {
+            throw new RuntimeException(ex);
+        } catch (InvocationTargetException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionStackFrameAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionStackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.reflection;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.MethodAccess;
+import at.ssw.hotswap.test.access.StackFrameAccess;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class ReflectionStackFrameAccess implements StackFrameAccess {
+
+    private String methodName;
+    private String className;
+    private MethodAccess methodAccess;
+    private ClassAccess classAccess;
+
+    ReflectionStackFrameAccess(StackTraceElement element) {
+        methodName = element.getMethodName();
+        className = element.getClassName();
+    }
+
+    @Override
+    public MethodAccess getMethod() throws ClassNotFoundException {
+        if (methodAccess == null) {
+            methodAccess = new ReflectionMethodAccess(methodName, className);
+        }
+        return methodAccess;
+    }
+
+    @Override
+    public ClassAccess getClazz() {
+        if (classAccess == null) {
+            try {
+                classAccess = new ReflectionClassAccess(className);
+            } catch (ClassNotFoundException ex) {
+                return null;
+            }
+        }
+        return classAccess;
+    }
+
+    @Override
+    public String toString() {
+        return methodName;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionVMAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionVMAccess.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.access.reflection;
+
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.VMAccess;
+import at.ssw.hotswap.test.access.StackFrameAccess;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+public class ReflectionVMAccess implements VMAccess {
+
+    private List<Thread> getThreads() {
+        ThreadGroup root = Thread.currentThread().getThreadGroup();
+        while (root.getParent() != null) {
+            root = root.getParent();
+        }
+
+        Thread[] threads;
+        int cnt;
+        int estsize = root.activeCount();
+
+        do {
+            estsize *= 2;
+            threads = new Thread[estsize];
+
+            cnt = root.enumerate(threads, true);
+        } while (cnt == estsize);
+
+        List<Thread> ret = new ArrayList<Thread>();
+        for (int i = 0; i < cnt; i++) {
+            ret.add(threads[i]);
+        }
+        return ret;
+    }
+
+    @Override
+    public List<String> getThreadNames() {
+        List<String> threadNames = new ArrayList<String>();
+        List<Thread> threads = getThreads();
+        for (Thread t : threads) {
+            threadNames.add(t.getName());
+        }
+        return threadNames;
+    }
+
+    @Override
+    public boolean canGetFrames() {
+        return true;
+    }
+
+    @Override
+    public List<StackFrameAccess> getFrames(String threadName) {
+
+        List<Thread> threads = getThreads();
+        List<StackFrameAccess> stackAccesses = new ArrayList<StackFrameAccess>();
+        for (Thread t : threads) {
+            if (t.getName().equals(threadName)) {
+                for (StackTraceElement stackElement : t.getStackTrace()) {
+                    StackFrameAccess stackAccess = new ReflectionStackFrameAccess(stackElement);
+                    stackAccesses.add(stackAccess);
+                }
+            }
+        }
+        return stackAccesses;
+    }
+
+    @Override
+    public ClassAccess findClass(String clazz) {
+        try {
+            return new ReflectionClassAccess(clazz);
+        } catch (ClassNotFoundException ex) {
+            return null;
+        }
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.accesstests;
+
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.access.ClassAccess;
+import at.ssw.hotswap.test.access.MethodAccess;
+import at.ssw.hotswap.test.access.StackFrameAccess;
+import at.ssw.hotswap.test.access.VMAccess;
+import at.ssw.hotswap.test.access.jdi.JDIVMAccess;
+import at.ssw.hotswap.test.access.jni.JNIVMAccess;
+import at.ssw.hotswap.test.access.reflection.ReflectionVMAccess;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+@RunWith(Parameterized.class)
+public class AccessTest {
+
+    private static VMAccess vma;
+
+    public AccessTest(VMAccess vma) {
+        this.vma = vma;
+    }
+
+    // Version 0
+    public static class A {
+
+        //needed for StackTraceTest
+        public static String stackTraceHelper() {
+            return getParentMethodSignature();
+        }
+
+        //needed for FindMethodTest
+        public static String method_Version0() {
+            return "Version0";
+        }
+
+        //needed for SignatureTest
+        public static String signatureHelper(String y, int x) {
+            return "Version0";
+        }
+
+        //needed for invokeMethodIntTest()
+        private int testIntRetValue() {
+            return 2;
+        }
+
+        //needed for invokeMethodObjectTest
+        private Object testObjectRetValue() {
+            return new Integer(2);
+        }
+
+        //needed for invokeMethodVoidTest
+        private static void testVoidRetValue() {
+            System.out.println("Version 0");
+        }
+
+        //needed for invokeMethodParameterTest()
+        private static int testMethodParameter(Integer x) {
+            return x;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        //needed for StackTraceTest
+        protected static String stackTraceHelper() {
+            return getParentMethodSignature();
+        }
+
+        //needed for FindMethodTest, SignatureTest
+        public static String method_Version1() {
+            return "Version1";
+        }
+
+        //needed for SignatureTest
+        private static String signatureHelper(int y, int x) {
+            return "Version1";
+        }
+
+        //needed for invokeMethodIntTest
+        private int testIntRetValue() {
+            return 3;
+        }
+
+        //needed for invokeMethodObjectTest
+        private Object testObjectRetValue() {
+            return new Integer(3);
+        }
+
+        //needed for invokeMethodVoidTest
+        private static void testVoidRetValue() {
+            System.out.println("Version 1");
+        }
+
+        //needed for invokeMethodParameterTest()
+        private static int testMethodParameter(Integer x) {
+            return x + 1;
+        }
+    }
+
+    //needed for StackTraceTest
+    private static String getParentMethodSignature() {
+
+        try {
+            int i = 0;
+            for (StackFrameAccess stack : vma.getFrames("main")) {
+                if (stack.getMethod().getName().equals("access$000")) {
+                    break;
+                } else {
+                    i++;
+                }
+            }
+            return vma.getFrames("main").get(++i).getMethod().getSignature();
+        } catch (ClassNotFoundException ex) {
+            return null;
+        }
+    }
+
+    @Parameters
+    public static Collection accessValues() {
+        return Arrays.asList(new Object[][]{{new JDIVMAccess()}, {new JNIVMAccess()}, {new ReflectionVMAccess()}});
+        //return Arrays.asList(new Object[][]{{new JDIVMAccess()}});
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(AccessTest.class, 0);
+    }
+
+    @Test
+    public void FindClassTest() {
+
+
+        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$XYZ");
+        assertNull(classAccess);
+
+        classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        assertNotNull(classAccess);
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        assertNotNull(classAccess);
+    }
+
+    @Test
+    public void FindMethodTest() {
+
+        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        assertNotNull(classAccess);
+
+        assertNotNull(classAccess.findMethod("method_Version0"));
+        assertNull(classAccess.findMethod("method_Version1"));
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        assertNull(classAccess.findMethod("method_Version0"));
+        assertNotNull(classAccess.findMethod("method_Version1"));
+    }
+
+    @Test
+    public void StackTraceTest() {
+        if (vma.canGetFrames()) {
+            assertEquals("public static java.lang.String stackTraceHelper()", A.stackTraceHelper());
+
+            HotSwapTool.toVersion(AccessTest.class, 1);
+
+            assertEquals("protected static java.lang.String stackTraceHelper()", A.stackTraceHelper());
+        }
+    }
+
+    @Test
+    public void SignatureTest() {
+        MethodAccess mAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A").findMethod("signatureHelper");
+        assertEquals("public static java.lang.String signatureHelper(java.lang.String, int)", mAccess.getSignature());
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        mAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A").findMethod("signatureHelper");
+        assertEquals("private static java.lang.String signatureHelper(int, int)", mAccess.getSignature());
+    }
+
+    @Test
+    public void invokeMethodIntTest() {
+        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
+            return;
+        }
+
+        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        assertEquals(2, classAccess.findMethod("testIntRetValue").invoke(new Object[0], new A()));
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        assertEquals(3, classAccess.findMethod("testIntRetValue").invoke(new Object[0], new A()));
+    }
+
+    @Test
+    public void invokeMethodObjectTest() {
+        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
+            return;
+        }
+
+        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        assertEquals(2, classAccess.findMethod("testObjectRetValue").invoke(new Object[0], new A()));
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        assertEquals(3, classAccess.findMethod("testObjectRetValue").invoke(new Object[0], new A()));
+    }
+
+    @Test
+    public void invokeMethodVoidTest() {
+        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
+            return;
+        }
+
+        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        assertNull(classAccess.findMethod("testVoidRetValue").invoke(new Object[0], new A()));
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        assertNull(classAccess.findMethod("testVoidRetValue").invoke(new Object[0], new A()));
+    }
+
+    @Test
+    public void invokeMethodParameterTest() {
+        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
+            return;
+        }
+
+        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        assertEquals(6, classAccess.findMethod("testMethodParameter").invoke(new Object[]{6}, new A()));
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        assertEquals(7, classAccess.findMethod("testMethodParameter").invoke(new Object[]{6}, new A()));
+
+    }
+
+    @Test
+    public void getMethodsTest() {
+
+        ClassAccess cAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
+        List<MethodAccess> list = cAccess.getMethods();
+
+        assertEquals(7, list.size());
+
+        Object[] mAccesses = list.toArray();
+
+        Arrays.sort(mAccesses, new Comparator() {
+
+            @Override
+            public int compare(Object o1, Object o2) {
+                return ((MethodAccess) o1).getName().compareTo(((MethodAccess) o2).getName());
+            }
+        });
+
+        assertEquals("method_Version0", ((MethodAccess) mAccesses[0]).getName());
+        assertEquals("signatureHelper", ((MethodAccess) mAccesses[1]).getName());
+        assertEquals("stackTraceHelper", ((MethodAccess) mAccesses[2]).getName());
+        assertEquals("testIntRetValue", ((MethodAccess) mAccesses[3]).getName());
+        assertEquals("testMethodParameter", ((MethodAccess) mAccesses[4]).getName());
+        assertEquals("testObjectRetValue", ((MethodAccess) mAccesses[5]).getName());
+        assertEquals("testVoidRetValue", ((MethodAccess) mAccesses[6]).getName());
+
+        HotSwapTool.toVersion(AccessTest.class, 1);
+
+        list = cAccess.getMethods();
+
+        assertEquals(7, list.size());
+
+        mAccesses = list.toArray();
+        Arrays.sort(mAccesses, new Comparator() {
+
+            @Override
+            public int compare(Object o1, Object o2) {
+                return ((MethodAccess) o1).getName().compareTo(((MethodAccess) o2).getName());
+            }
+        });
+
+        assertEquals("method_Version1", ((MethodAccess) mAccesses[0]).getName());
+        assertEquals("signatureHelper", ((MethodAccess) mAccesses[1]).getName());
+        assertEquals("stackTraceHelper", ((MethodAccess) mAccesses[2]).getName());
+        assertEquals("testIntRetValue", ((MethodAccess) mAccesses[3]).getName());
+        assertEquals("testMethodParameter", ((MethodAccess) mAccesses[4]).getName());
+        assertEquals("testObjectRetValue", ((MethodAccess) mAccesses[5]).getName());
+        assertEquals("testVoidRetValue", ((MethodAccess) mAccesses[6]).getName());
+
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.accesstests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    AccessTest.class
+})
+public class AccessTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * 
+ * Class redefinition tests that swap only method bodies and change nothing else. This test cases should also
+ * run with the current version of HotSpot.
+ * 
+ * @author Thomas Wuerthinger
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses(
+{
+    StaticTest.class,
+    SimpleStaticTest.class,
+    MultipleThreadsTest.class,
+    OldActivationTest.class,
+    RefactorActiveMethodTest.class,
+    StressTest.class,
+    FacTest.class,
+    FibTest.class,
+    RedefinePrivateMethodTest.class,
+    ClassRenamingTestCase.class,
+    EMCPTest.class
+})
+public class BodyTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/ClassRenamingTestCase.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/ClassRenamingTestCase.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.body;
+
+import at.ssw.hotswap.ClassRedefinitionPolicy;
+import at.ssw.hotswap.HotSwapTool;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ *
+ * @author Kerstin Breiteneder
+ * @author Christoph Wimberger
+ *
+ */
+public class ClassRenamingTestCase {
+
+    public static class B {
+
+        public int a() {
+            return 1;
+        }
+    }
+
+    @ClassRedefinitionPolicy(alias = B.class)
+    public static class A___1 {
+
+        public int a() {
+            return 2;
+        }
+    }
+
+    @Test
+    public void testRenaming() {
+        HotSwapTool.toVersion(ClassRenamingTestCase.class, 0);
+
+        B b = new B();
+        assertEquals(1, b.a());
+
+        HotSwapTool.toVersion(ClassRenamingTestCase.class, 1);
+
+        assertEquals(2, b.a());
+
+        HotSwapTool.toVersion(ClassRenamingTestCase.class, 0);
+
+        assertEquals(1, b.a());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/EMCPTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/EMCPTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.body;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.TestUtil;
+import java.io.PrintStream;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ *
+ * EMCP (Equivalent modulo Constant Pool) tests.
+ *
+ * @author Thomas Wuerthinger
+ *
+ */
+public class EMCPTest {
+
+    public static class A {
+
+        public static int EMCPReturn() {
+            change();
+            PrintStream s = System.out;
+            return 1;
+        }
+    }
+
+    public static class B {
+
+        public static int b() {
+            change();
+            throw new RuntimeException();
+        }
+    }
+
+    public static class C {
+
+        public static int c() {
+            changeAndThrow();
+            return 0;
+        }
+    }
+
+    public static class D {
+
+        private static int value = 1;
+
+        public static int EMCPReturn() {
+            change3();
+            return value;
+        }
+    }
+
+    public static class A___1 {
+
+        public static int EMCPReturn() {
+            change();
+            PrintStream s = System.out;
+            return 1;
+        }
+    }
+
+    public static class B___1 {
+
+        public static int b() {
+            change();
+            throw new RuntimeException();
+        }
+    }
+
+    public static class C___1 {
+
+        public static int c() {
+            changeAndThrow();
+            return 0;
+        }
+    }
+    
+    public static class D___1 {
+        private static int value = 1;
+
+        public static int EMCPReturn() {
+            change3();
+            return value;
+        }
+    }
+
+    public static class D___2 {
+        private static int value = 1;
+
+        public static int EMCPReturn() {
+            change3();
+            return value;
+        }
+    }
+
+    public static class D___3 {
+        private static int value = 1;
+
+        public static int EMCPReturn() {
+            change3();
+            return value;
+        }
+    }
+
+    public static void change() {
+
+        HotSwapTool.toVersion(EMCPTest.class, 1);
+    }
+
+    public static void change3() {
+
+        HotSwapTool.toVersion(EMCPTest.class, 1);
+        HotSwapTool.toVersion(EMCPTest.class, 2);
+        HotSwapTool.toVersion(EMCPTest.class, 3);
+    }
+
+    public static void changeAndThrow() {
+
+        HotSwapTool.toVersion(EMCPTest.class, 1);
+
+        throw new RuntimeException();
+    }
+
+
+    @Test
+    public void testEMCPReturn() {
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        assertEquals(1, A.EMCPReturn());
+
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        assertEquals(1, A.EMCPReturn());
+        
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+    }
+    
+    @Test
+    public void testEMCPMultiChangeReturn() {
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        assertEquals(1, D.EMCPReturn());
+
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        assertEquals(1, D.EMCPReturn());
+
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+    }
+
+    @Test
+    public void testEMCPException() {
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        TestUtil.assertException(RuntimeException.class, new Runnable(){
+            @Override
+            public void run() {
+               B.b();
+            }
+        });
+
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        TestUtil.assertException(RuntimeException.class, new Runnable(){
+            @Override
+            public void run() {
+               B.b();
+            }
+        });
+
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+    }
+
+    @Test
+    public void testEMCPExceptionInCallee() {
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        TestUtil.assertException(RuntimeException.class, new Runnable(){
+            @Override
+            public void run() {
+               C.c();
+            }
+        });
+
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+
+        TestUtil.assertException(RuntimeException.class, new Runnable(){
+            @Override
+            public void run() {
+               C.c();
+            }
+        });
+
+        HotSwapTool.toVersion(EMCPTest.class, 0);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Recursive implementation of the factorial function using class redefinition.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class FacTest {
+
+    public static abstract class Base {
+
+        protected int calc() {
+            return calc(HotSwapTool.getCurrentVersion(FacTest.class));
+        }
+
+        public int calcAt(int version) {
+            HotSwapTool.toVersion(FacTest.class, version);
+            int result = calc();
+            HotSwapTool.toVersion(FacTest.class, 0);
+            return result;
+        }
+
+        protected int calc(int version) {
+            return calc();
+        }
+    }
+
+    public static class Factorial extends Base {
+
+        @Override
+        protected int calc(int n) {
+            return n * calcAt(n - 1);
+        }
+    }
+
+    public static class Factorial___1 extends Base {
+
+        @Override
+        protected int calc() {
+            return 1;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(FacTest.class, 0);
+    }
+
+    @Test
+    public void testFac() {
+
+        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
+        Factorial f = new Factorial();
+
+        assertEquals(1, f.calcAt(1));
+
+        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
+        assertEquals(2, f.calcAt(2));
+
+        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
+        assertEquals(6, f.calcAt(3));
+
+        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
+        assertEquals(24, f.calcAt(4));
+
+        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
+        assertEquals(120, f.calcAt(5));
+
+        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
+        assertEquals(479001600, f.calcAt(12));
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Recursive implementation of the fibonacci function using class redefinition.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class FibTest {
+
+    public static abstract class Base {
+
+        protected int calc() {
+            return calc(HotSwapTool.getCurrentVersion(FibTest.class));
+        }
+
+        public int calcAt(int version) {
+            HotSwapTool.toVersion(FibTest.class, version);
+            int result = calc();
+            HotSwapTool.toVersion(FibTest.class, 0);
+            return result;
+        }
+
+        protected int calc(int version) {
+            return calc();
+        }
+    }
+
+    public static class Fib extends Base {
+
+        @Override
+        protected int calc(int n) {
+            return calcAt(n - 1) + calcAt(n - 2);
+        }
+    }
+
+    public static class Fib___1 extends Base {
+
+        @Override
+        protected int calc() {
+            return 1;
+        }
+    }
+
+    public static class Fib___2 extends Base {
+
+        @Override
+        protected int calc() {
+            return 2;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(FibTest.class, 0);
+    }
+
+    @Test
+    public void testFib() {
+
+        // 0 1 2 3 4 5
+        // 1 1 2 3 5 8
+        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
+        Fib f = new Fib();
+
+        assertEquals(1, f.calcAt(1));
+
+        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
+        assertEquals(2, f.calcAt(2));
+
+        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
+        assertEquals(3, f.calcAt(3));
+
+        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
+        assertEquals(5, f.calcAt(4));
+
+        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
+        assertEquals(8, f.calcAt(5));
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.methods.OverrideMethodTest;
+
+/**
+ * Class for testing redefining methods of classes that extend the Thread class. In the test setup the run method
+ * calls the doit method in a loop until this methods returns false.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class MultipleThreadsTest {
+
+    public static final int COUNT = 10;
+
+    // Version 0
+    public static class A extends Thread {
+
+        private int value;
+        private int value2;
+        private boolean flag = false;
+
+        @Override
+        public void run() {
+            while (doit()) {
+                flag = false;
+            }
+        }
+
+        public boolean doit() {
+            if (flag) {
+                throw new RuntimeException("Must not reach here");
+            }
+            flag = true;
+            try {
+                Thread.sleep(1);
+            } catch (InterruptedException e) {
+            }
+
+            value++;
+            return true;
+        }
+
+        public int getValue() {
+            return value;
+        }
+
+        public int getValue2() {
+            return value2;
+        }
+    }
+
+    // Version 1
+    public static class A___1 extends Thread {
+
+        private int value;
+        private int value2;
+        private boolean flag = false;
+
+        @Override
+        public void run() {
+            while (doit()) {
+                flag = false;
+            }
+        }
+
+        public boolean doit() {
+            if (flag) {
+                throw new RuntimeException("Must not reach here");
+            }
+            flag = true;
+            try {
+                Thread.sleep(1);
+            } catch (InterruptedException e) {
+            }
+
+            value2++;
+            return true;
+        }
+
+        public int getValue() {
+            return value;
+        }
+
+        public int getValue2() {
+            return value2;
+        }
+    }
+
+    // Version 2
+    public static class A___2 extends Thread {
+
+        private int value;
+        private int value2;
+        private boolean flag = false;
+
+        @Override
+        public void run() {
+            while (doit()) {
+                flag = false;
+            }
+        }
+
+        public boolean doit() {
+            return false;
+        }
+
+        public int getValue() {
+            return value;
+        }
+
+        public int getValue2() {
+            return value2;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(MultipleThreadsTest.class, 0);
+    }
+
+    @Test
+    public void testOneThread() {
+        test(1);
+    }
+
+    @Test
+    public void testThreads() {
+        test(COUNT);
+    }
+
+    private void test(int count) {
+
+        assert HotSwapTool.getCurrentVersion(MultipleThreadsTest.class) == 0;
+
+        A[] arr = new A[count];
+        for (int i = 0; i < count; i++) {
+            arr[i] = new A();
+            arr[i].start();
+        }
+
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+        }
+
+        for (int i = 0; i < count; i++) {
+            //assertTrue(arr[i].getValue() > 0);
+        }
+
+        HotSwapTool.toVersion(MultipleThreadsTest.class, 1);
+
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+        }
+
+        for (int i = 0; i < count; i++) {
+            assertTrue(arr[i].getValue2() > 0);
+        }
+
+        HotSwapTool.toVersion(MultipleThreadsTest.class, 2);
+
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+        }
+
+
+        for (int i = 0; i < count; i++) {
+            assertFalse(arr[i].isAlive());
+        }
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 0);
+
+
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Stress test for the number of old activations on the stack. In the test setup 10 different versions of the method A.value will be on the stack.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class OldActivationTest {
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 1);
+            return 1 + this.value();
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 2);
+            return 2 + this.value();
+        }
+    }
+
+    // Version 2
+    public static class A___2 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 3);
+            return 3 + this.value();
+        }
+    }
+
+    // Version 3
+    public static class A___3 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 4);
+            return 4 + this.value();
+        }
+    }
+
+    // Version 4
+    public static class A___4 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 5);
+            return 5 + this.value();
+        }
+    }
+
+    // Version 5
+    public static class A___5 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 6);
+            return 6 + this.value();
+        }
+    }
+
+    // Version 6
+    public static class A___6 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 7);
+            return 7 + this.value();
+        }
+    }
+
+    // Version 7
+    public static class A___7 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 8);
+            return 8 + this.value();
+        }
+    }
+
+    // Version 8
+    public static class A___8 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 9);
+            return 9 + this.value();
+        }
+    }
+
+    // Version 9
+    public static class A___9 {
+
+        public int value() {
+            HotSwapTool.toVersion(OldActivationTest.class, 0);
+            return 10;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(OldActivationTest.class, 0);
+    }
+
+    @Test
+    public void testOldActivationTest() {
+
+        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
+
+        A a = new A();
+
+        assertEquals(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
+        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
+
+        HotSwapTool.toVersion(OldActivationTest.class, 1);
+        assertEquals(2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
+        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
+
+        HotSwapTool.toVersion(OldActivationTest.class, 8);
+        assertEquals(9 + 10, a.value());
+        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
+
+        HotSwapTool.toVersion(OldActivationTest.class, 4);
+        assertEquals(5 + 6 + 7 + 8 + 9 + 10, a.value());
+        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Tests redefinition of a class such that old code still accesses a redefined private method.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class RedefinePrivateMethodTest {
+
+    // Version 0
+    public static class A {
+
+        public int foo() {
+            int result = bar();
+            HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 1);
+            result += bar();
+            return result;
+        }
+
+        private int bar() {
+            return 1;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int foo() {
+            return -1;
+        }
+
+        private int bar() {
+            return 2;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
+    }
+
+    @Test
+    public void testRedefinePrivateMethod() {
+
+        assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 0;
+
+        A a = new A();
+
+        assertEquals(3, a.foo());
+
+        assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
+
+        assertEquals(-1, a.foo());
+
+        HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
+
+        assertEquals(3, a.foo());
+
+        assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
+
+        assertEquals(-1, a.foo());
+
+        HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class RefactorActiveMethodTest {
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            HotSwapTool.toVersion(RefactorActiveMethodTest.class, 1);
+            return 5;
+        }
+
+        public int secondValue() {
+            return 1;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value() {
+            return secondValue() * 2;
+        }
+
+        public int secondValue() {
+            return 2;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
+    }
+
+    @Test
+    public void testActiveMethodReplacement() {
+
+        assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 0;
+
+        A a = new A();
+
+        assertEquals(5, a.value());
+
+        assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
+
+        assertEquals(2, a.secondValue());
+        assertEquals(4, a.value());
+        assertEquals(2, a.secondValue());
+
+        assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
+
+        HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
+
+        assertEquals(1, a.secondValue());
+        assertEquals(5, a.value());
+        assertEquals(4, a.value());
+
+        HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
+
+        assertEquals(1, a.secondValue());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.TestUtil;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class SimpleStaticTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(SimpleStaticTest.class, 0);
+        
+        // E and Helper must be loaded and initialized
+        E e = new E();
+        Helper h = new Helper();
+    }
+
+    // Version 0
+
+    public static class Helper {
+        public static int getIntegerField() {
+            return E.integerField;
+        }
+
+        public static void setIntegerField(int x) {
+            E.integerField = x;
+        }
+
+        public static int getFinalIntegerField() {
+            return E.finalIntegerField;
+        }
+    }
+
+    public static class E {
+        public static int integerField = 10;
+
+        // javac will generate "ConstantValue" attribute for this field!
+        public static final int finalIntegerField = 7;
+    }
+
+    public static class E___1 {
+    }
+
+    // Version 1
+    public static class E___2 {
+        public static int integerField = 10;
+
+        // javac will generate "ConstantValue" attribute for this field!
+        public static final int finalIntegerField = 7;
+    }
+
+    @Test
+    public void testSimpleNewStaticField() {
+
+        assert HotSwapTool.getCurrentVersion(SimpleStaticTest.class) == 0;
+
+        HotSwapTool.toVersion(SimpleStaticTest.class, 1);
+
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable(){
+            @Override
+            public void run() {
+                Helper.getIntegerField();
+            }
+        });
+
+        HotSwapTool.toVersion(SimpleStaticTest.class, 2);
+
+        assertEquals(0, Helper.getIntegerField());
+        assertEquals(7, Helper.getFinalIntegerField());
+        Helper.setIntegerField(1000);
+        assertEquals(1000, Helper.getIntegerField());
+
+        HotSwapTool.toVersion(SimpleStaticTest.class, 1);
+
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable(){
+            @Override
+            public void run() {
+                Helper.getIntegerField();
+            }
+        });
+
+        HotSwapTool.toVersion(SimpleStaticTest.class, 2);
+
+        assertEquals(0, Helper.getIntegerField());
+        assertEquals(7, Helper.getFinalIntegerField());
+        Helper.setIntegerField(1000);
+        assertEquals(1000, Helper.getIntegerField());
+        
+        HotSwapTool.toVersion(SimpleStaticTest.class, 0);
+
+        assertEquals(7, Helper.getFinalIntegerField());
+        assertEquals(1000, Helper.getIntegerField());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StaticTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StaticTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class StaticTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(StaticTest.class, 0);
+    }
+
+    // Version 0
+
+
+    public static class Helper {
+        public static int getAdditionalField() {
+            return -1;
+        }
+
+        public static void setAdditionalField(int x) {
+            
+        }
+    }
+
+    public static class A {
+
+        public static int value() {
+            return 1;
+        }
+    }
+
+    public static class B {
+
+        public static int value() {
+            return 2;
+        }
+    }
+
+    public static class C {
+        static {
+            System.out.println("Static initializer of C");
+        }
+
+        public static int value = 5;
+    }
+
+    public static class D {
+        public static List objectField = new ArrayList();
+        public static int[] arrayField = new int[10];
+        public static int integerField = 5;
+        public static char characterField = 6;
+        public static short shortField = 7;
+        public static double doubleField = 1.0;
+        public static float floatField = 2.0f;
+        public static long longField = 8;
+        public static boolean booleanField = true;
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public static int value() {
+            return B.value() * 2;
+        }
+    }
+
+    // Version 2
+    public static class B___2 {
+
+        public static int value() {
+            return 3;
+        }
+    }
+
+    // Version 3
+    public static class A___3 {
+
+        public static int value() {
+            return 5;
+        }
+    }
+
+    public static class B___3 {
+
+        public static int value() {
+            return A.value() * 2;
+        }
+    }
+
+    // Version 4
+    public static class C___4 {
+
+        static {
+            System.out.println("Static initializer of C-4");
+        }
+
+        public static int value = 6;
+    }
+
+    public static class Helper___5 {
+        public static int getAdditionalField() {
+            return D___5.additionalField;
+        }
+
+        public static void setAdditionalField(int x) {
+            D___5.additionalField = x;
+        }
+    }
+
+    public static class D___5 {
+        public static int additionalField;
+
+        public static List objectField;
+        public static long longField;
+        public static short shortField = 10;
+        public static float floatField;
+        public static int[] arrayField;
+        public static int integerField;
+        public static char characterField;
+        public static double doubleField;
+        public static boolean booleanField;
+    }
+
+    @Test
+    public void testBase() {
+
+        assert HotSwapTool.getCurrentVersion(StaticTest.class) == 0;
+
+
+        assertEquals(1, A.value());
+        assertEquals(2, B.value());
+
+        HotSwapTool.toVersion(StaticTest.class, 1);
+
+        assertEquals(4, A.value());
+        assertEquals(2, B.value());
+
+        HotSwapTool.toVersion(StaticTest.class, 2);
+
+        assertEquals(6, A.value());
+        assertEquals(3, B.value());
+
+        HotSwapTool.toVersion(StaticTest.class, 3);
+
+        assertEquals(5, A.value());
+        assertEquals(10, B.value());
+
+        HotSwapTool.toVersion(StaticTest.class, 0);
+
+        assertEquals(1, A.value());
+        assertEquals(2, B.value());
+    }
+
+    @Test
+    public void testStaticField() {
+
+        assert HotSwapTool.getCurrentVersion(StaticTest.class) == 0;
+        assertEquals(5, C.value);
+
+        HotSwapTool.toVersion(StaticTest.class, 4);
+        assertEquals(5, C.value);
+
+        HotSwapTool.toVersion(StaticTest.class, 0);
+        assertEquals(5, C.value);
+    }
+
+
+    @Test
+    public void testManyStaticFields() {
+
+        assert HotSwapTool.getCurrentVersion(StaticTest.class) == 0;
+        assertTrue(D.objectField != null);
+        assertTrue(D.arrayField != null);
+        assertEquals(5, D.integerField);
+        assertEquals(6, D.characterField);
+        assertEquals(7, D.shortField);
+        assertEquals(1.0, D.doubleField, 0.0);
+        assertEquals(2.0f, D.floatField, 0.0);
+        assertEquals(8, D.longField);
+        assertEquals(true, D.booleanField);
+
+        HotSwapTool.toVersion(StaticTest.class, 5);
+        assertTrue(D.objectField != null);
+        assertTrue(D.arrayField != null);
+        assertEquals(5, D.integerField);
+        assertEquals(6, D.characterField);
+        assertEquals(7, D.shortField);
+        assertEquals(1.0, D.doubleField, 0.0);
+        assertEquals(2.0f, D.floatField, 0.0);
+        assertEquals(8, D.longField);
+        assertEquals(true, D.booleanField);
+
+        assertEquals(0, Helper.getAdditionalField());
+        Helper.setAdditionalField(1000);
+        assertEquals(1000, Helper.getAdditionalField());
+
+
+        HotSwapTool.toVersion(StaticTest.class, 0);
+
+        assertTrue(D.objectField != null);
+        assertTrue(D.arrayField != null);
+        assertEquals(5, D.integerField);
+        assertEquals(6, D.characterField);
+        assertEquals(7, D.shortField);
+        assertEquals(1.0, D.doubleField, 0.0);
+        assertEquals(2.0f, D.floatField, 0.0);
+        assertEquals(8, D.longField);
+        assertEquals(true, D.booleanField);
+
+        HotSwapTool.toVersion(StaticTest.class, 5);
+        assertTrue(D.objectField != null);
+        assertTrue(D.arrayField != null);
+        assertEquals(5, D.integerField);
+        assertEquals(6, D.characterField);
+        assertEquals(7, D.shortField);
+        assertEquals(1.0, D.doubleField, 0.0);
+        assertEquals(2.0f, D.floatField, 0.0);
+        assertEquals(8, D.longField);
+        assertEquals(true, D.booleanField);
+
+        assertEquals(0, Helper.getAdditionalField());
+
+        HotSwapTool.toVersion(StaticTest.class, 0);
+        assertTrue(D.objectField != null);
+        assertTrue(D.arrayField != null);
+        assertEquals(5, D.integerField);
+        assertEquals(6, D.characterField);
+        assertEquals(7, D.shortField);
+        assertEquals(1.0, D.doubleField, 0.0);
+        assertEquals(2.0f, D.floatField, 0.0);
+        assertEquals(8, D.longField);
+        assertEquals(true, D.booleanField);
+
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StressTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StressTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.body;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class StressTest {
+
+    public final static int COUNT = 10;
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 1;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value() {
+            return 2;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(StressTest.class, 0);
+    }
+
+    @Test
+    public void testStressSwap() {
+
+        assert HotSwapTool.getCurrentVersion(StressTest.class) == 0;
+
+        A a = new A();
+
+        for (int i = 0; i < COUNT; i++) {
+
+            assertEquals(1, a.value());
+
+            HotSwapTool.toVersion(StressTest.class, 1);
+
+            assertEquals(2, a.value());
+
+            HotSwapTool.toVersion(StressTest.class, 0);
+        }
+
+        assertEquals(1, a.value());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/AddingInterfaceTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/AddingInterfaceTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.eval;
+
+import at.ssw.hotswap.HotSwapTool;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Adds an implemented interface to a class and tests whether an instance of this class can then really be treated as an instance of the interface.
+ * Additionally, performs performance measurements of a call to this interface compared to a proxy object.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class AddingInterfaceTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(AddingInterfaceTest.class, 0);
+        assert HotSwapTool.getCurrentVersion(AddingInterfaceTest.class) == 0;
+    }
+
+    public static class A {
+
+        public int getValue() {
+            return 1;
+        }
+    }
+
+    public static interface I {
+
+        public int getValue();
+    }
+
+    public static class A___1 implements I {
+
+        public int getValue() {
+            return 1;
+        }
+    }
+
+    public static class Proxy implements I {
+
+        private A a;
+
+        public Proxy(A a) {
+            this.a = a;
+        }
+
+        public int getValue() {
+            return a.getValue();
+        }
+    }
+
+    @Test
+    public void testAddInterface() {
+
+        A a = new A();
+        Proxy p = new Proxy(a);
+
+        final int N = 100000;
+        final int Z = 1;
+
+
+
+        HotSwapTool.toVersion(AddingInterfaceTest.class, 1);
+        I i = (I) a;
+
+        long startTime = System.currentTimeMillis();
+        for (int j = 0; j < Z; j++) {
+            calculateSum(N, i);
+        }
+        long time = System.currentTimeMillis() - startTime;
+        System.out.println(time);
+
+        // Must set to null, otherwise local variable i would violate type safety
+        i = null;
+        HotSwapTool.toVersion(AddingInterfaceTest.class, 0);
+
+        startTime = System.currentTimeMillis();
+        for (int j = 0; j < Z; j++) {
+            calculateSum(N, p);
+        }
+        time = System.currentTimeMillis() - startTime;
+        System.out.println(time);
+    }
+
+    public int calculateSum(int n, I i) {
+        int sum = 0;
+        for (int j = 0; j < n; j++) {
+            sum += i.getValue();
+        }
+        return sum;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/EvalTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/EvalTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.eval;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * 
+ * Tests used for evaluation purposes (especially performance measurements).
+ * 
+ * @author Thomas Wuerthinger
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    FractionTest.class,
+    AddingInterfaceTest.class
+})
+public class EvalTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/FractionTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/FractionTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.eval;
+
+import java.lang.Runnable;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class FractionTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(FractionTest.class, 0);
+        assert HotSwapTool.getCurrentVersion(FractionTest.class) == 0;
+    }
+
+    // Version 0
+    public static class NoChange {
+
+        int i1;
+        int i2;
+        int i3;
+        Object o1;
+        Object o2;
+        Object o3;
+    }
+
+    public static class Change {
+
+        int i1;
+        int i2;
+        int i3;
+        Object o1;
+        Object o2;
+        Object o3;
+    }
+
+    // Version 1
+    public static class Change___1 {
+
+        int i1;
+        int i2;
+        int i3;
+        Object o1;
+        Object o2;
+        Object o3;
+        Object o4;
+    }
+
+    // Version 2
+    public static class Change___2 {
+
+        int i1;
+        int i2;
+        int i3;
+        Object o1;
+    }
+
+    // Version 3
+    public static class Change___3 {
+
+        int i3;
+        int i1;
+        int i2;
+        Object o3;
+        Object o1;
+        Object o2;
+    }
+
+    // Version 3
+    public static class Change___4 {
+
+        int i1;
+        int i2;
+        int i3;
+        Object o1;
+        Object o2;
+        Object o3;
+    }
+    private static List<Long> measurements = new ArrayList<Long>();
+    private final int BASE = 10;
+    private Object[] objects;
+
+    private void clear() {
+        objects = null;
+        System.gc();
+        System.gc();
+        HotSwapTool.toVersion(FractionTest.class, 0);
+        System.gc();
+        System.gc();
+
+    }
+
+    private void init(int count, int percent) {
+        objects = new Object[count];
+        int changed = 0;
+        int unchanged = 0;
+        for (int k = 0; k < count; k++) {
+            if ((count / BASE) * percent <= k/* && k >= 200000*/) {
+                objects[k] = new NoChange();
+                unchanged++;
+            } else {
+                objects[k] = new Change();
+                changed++;
+            }
+        }
+
+        System.gc();
+
+        System.out.println(changed + " changed objects allocated");
+    }
+
+    @Test
+    public void testBase() {
+
+        assert HotSwapTool.getCurrentVersion(FractionTest.class) == 0;
+
+        final int N = 1;
+        final int INC = 4;
+
+        int[] benchmarking = new int[]{40000};
+        int base = BASE;
+        int start = 0;
+
+        MicroBenchmark[] benchmarks = new MicroBenchmark[]{new GCMicroBenchmark(), new IncreaseMicroBenchmark(), new DecreaseMicroBenchmark(), new ReorderMicroBenchmark(), new NoRealChangeMicroBenchmark()};
+
+        clear();
+        for (int k = 0; k < N; k++) {
+            for (MicroBenchmark m : benchmarks) {
+                for (int i : benchmarking) {
+                    System.out.println(m.getClass().getName() + " with " + i + " objects");
+                    for (int j = start; j <= base; j += INC) {
+                        System.out.println(j);
+                        m.init(i);
+                        init(i, j);
+                        m.doit(i, measurements);
+                        clear();
+                    }
+                }
+            }
+        }
+
+        System.out.println("Results:");
+        for (long l : measurements) {
+            System.out.println(l);
+        }
+        measurements.clear();
+    }
+}
+
+abstract class MicroBenchmark {
+
+    public void init(int count) {
+    }
+
+    public abstract void doit(int count, List<Long> measurements);
+}
+
+class GCMicroBenchmark extends MicroBenchmark {
+
+    public void doit(int count, List<Long> measurements) {
+        long startTime = System.currentTimeMillis();
+        System.gc();
+        long curTime = System.currentTimeMillis() - startTime;
+        measurements.add(curTime);
+    }
+}
+
+class IncreaseMicroBenchmark extends MicroBenchmark {
+
+    public void doit(int count, List<Long> measurements) {
+        HotSwapTool.resetTimings();
+        HotSwapTool.toVersion(FractionTest.class, 1);
+        measurements.add(HotSwapTool.getTotalTime());
+    }
+}
+
+class DecreaseMicroBenchmark extends MicroBenchmark {
+
+    public void doit(int count, List<Long> measurements) {
+        HotSwapTool.resetTimings();
+        HotSwapTool.toVersion(FractionTest.class, 2);
+        measurements.add(HotSwapTool.getTotalTime());
+    }
+}
+
+class ReorderMicroBenchmark extends MicroBenchmark {
+
+    public void doit(int count, List<Long> measurements) {
+        HotSwapTool.resetTimings();
+        HotSwapTool.toVersion(FractionTest.class, 3);
+        measurements.add(HotSwapTool.getTotalTime());
+    }
+}
+
+class NoRealChangeMicroBenchmark extends MicroBenchmark {
+
+    public void doit(int count, List<Long> measurements) {
+        HotSwapTool.resetTimings();
+        HotSwapTool.toVersion(FractionTest.class, 4);
+        measurements.add(HotSwapTool.getTotalTime());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/AccessDeletedFieldTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/AccessDeletedFieldTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.TestUtil;
+
+/**
+ * Tests for accessing a deleted field. In the first scenario, the field is deleted from the class.
+ * In the second scenario, it is deleted because of a changed subtype relationship.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class AccessDeletedFieldTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public int x;
+
+        int getFieldInOldCode() {
+            
+            HotSwapTool.toVersion(AccessDeletedFieldTest.class, 1);
+
+            // This field does no longer exist
+            return x;
+        }
+    }
+
+    public static class B extends A {
+    }
+
+    // Version 1
+    public static class A___1 {
+    }
+
+    // Version 2
+    public static class B___2 {
+    }
+
+    // Method to enforce cast (otherwise bytecodes become invalid in version 2)
+    public static A convertBtoA(Object b) {
+        return (A) b;
+    }
+
+    @Test
+    public void testOldCodeAccessesDeletedField() {
+
+        assert HotSwapTool.getCurrentVersion(AccessDeletedFieldTest.class) == 0;
+
+        final A a = new A();
+        a.x = 1;
+
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable() {
+            @Override
+            public void run() {
+                assertEquals(0, a.getFieldInOldCode());
+            }
+        });
+
+        assert HotSwapTool.getCurrentVersion(AccessDeletedFieldTest.class) == 1;
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 0);
+        assertEquals(0, a.x);
+    }
+
+    @Test
+    public void testAccessDeletedField() {
+
+        assert HotSwapTool.getCurrentVersion(AccessDeletedFieldTest.class) == 0;
+
+        final A a = new A();
+        a.x = 1;
+
+        assertEquals(1, a.x);
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 1);
+
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable() {
+            @Override
+            public void run() {
+                System.out.println(a.x);
+            }
+        });
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 0);
+        assertEquals(0, a.x);
+    }
+
+    @Test
+    public void testAccessDeleteBaseClassFieldNormal() {
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 0);
+        assert HotSwapTool.getCurrentVersion(AccessDeletedFieldTest.class) == 0;
+        final B b = new B();
+        b.x = 1;
+        final A a = new A();
+        a.x = 2;
+
+        assertEquals(1, b.x);
+        assertEquals(2, a.x);
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 2);
+
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable() {
+
+            @Override
+            public void run() {
+                System.out.println(b.x);
+            }
+        });
+
+        assertEquals(2, a.x);
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 0);
+        assertEquals(0, b.x);
+    }
+
+    @Test
+    public void testAccessDeleteBaseClassFieldInvalid() {
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 0);
+        assert HotSwapTool.getCurrentVersion(AccessDeletedFieldTest.class) == 0;
+        final B b = new B();
+        final A a1 = new A();
+        a1.x = 1;
+        b.x = 1;
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 2);
+
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable() {
+
+            @Override
+            public void run() {
+                System.out.println(b.x);
+            }
+        });
+
+        assertEquals(1, a1.x);
+
+        HotSwapTool.toVersion(AccessDeletedFieldTest.class, 0);
+        assertEquals(0, b.x);
+        assertEquals(1, a1.x);
+
+        A a = convertBtoA(b);
+
+        assertEquals(0, b.x);
+
+        // Must fail, because now an instance of B is in a local variable of type A!
+        TestUtil.assertException(UnsupportedOperationException.class, new Runnable() {
+
+            @Override
+            public void run() {
+                HotSwapTool.toVersion(AccessDeletedFieldTest.class, 2);
+            }
+        });
+
+        assertEquals(0, a.x);
+
+        // Still at version 0
+        assert HotSwapTool.getCurrentVersion(AccessDeletedFieldTest.class) == 0;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/AccessDeletedStaticFieldTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/AccessDeletedStaticFieldTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.TestUtil;
+
+/**
+ * Tests for accessing a deleted static field.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class AccessDeletedStaticFieldTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(AccessDeletedStaticFieldTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public static int x;
+
+        static int getFieldInOldCode() {
+            
+            HotSwapTool.toVersion(AccessDeletedStaticFieldTest.class, 1);
+
+            newMethodFromOldCode();
+
+            // This field does no longer exist
+            return x;
+        }
+
+        static int getFieldEMCPMethod() {
+            HotSwapTool.toVersion(AccessDeletedStaticFieldTest.class, 2);
+            return A.x;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+    }
+
+    // Version 2
+
+    public static class A___2 {
+
+        // EMCP to method in version 0
+        static int getFieldEMCPMethod() {
+            HotSwapTool.toVersion(AccessDeletedStaticFieldTest.class, 2);
+            return A.x;
+        }
+    }
+
+    private static void newMethodFromOldCode() {
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable() {
+            @Override
+            public void run() {
+                System.out.println(A.x);
+            }
+        });
+    }
+
+    @Test
+    public void testAccessDeletedStaticField() {
+
+        assert HotSwapTool.getCurrentVersion(AccessDeletedStaticFieldTest.class) == 0;
+
+        A.x = 1;
+        assertEquals(1, A.getFieldInOldCode());
+
+        assert HotSwapTool.getCurrentVersion(AccessDeletedStaticFieldTest.class) == 1;
+        HotSwapTool.toVersion(AccessDeletedStaticFieldTest.class, 0);
+        assertEquals(0, A.x);
+        
+        assert HotSwapTool.getCurrentVersion(AccessDeletedStaticFieldTest.class) == 0;
+    }
+
+
+    @Test
+    public void testAccessDeletedStaticFieldFromEMCPMethod() {
+
+        assert HotSwapTool.getCurrentVersion(AccessDeletedStaticFieldTest.class) == 0;
+        TestUtil.assertException(NoSuchFieldError.class, new Runnable() {
+            @Override
+            public void run() {
+                System.out.println(A.getFieldEMCPMethod());
+            }
+        });
+        
+        HotSwapTool.toVersion(AccessDeletedStaticFieldTest.class, 0);
+        assertEquals(0, A.x);
+
+        assert HotSwapTool.getCurrentVersion(AccessDeletedStaticFieldTest.class) == 0;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/ComplexFieldTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/ComplexFieldTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Complex field test.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class ComplexFieldTest {
+
+    // Version 0
+    public static class A {
+        public byte byteFld = 10;
+        public short shortFld = 20;
+        public int intFld = 30;
+        public long longFld = 40L;
+        public float floatFld = 50.2F;
+        public double doubleFld = 60.3D;
+        public char charFld = 'b';
+        public boolean booleanFld = true;
+        public String stringFld = "OLD";
+    }
+
+    // Version 1
+    public static class A___1 {
+        public byte byteFld = 11;
+        public short shortFld = 22;
+        public int intFld = 33;
+        public long longFld = 44L;
+        public float floatFld = 55.5F;
+        public double doubleFld = 66.6D;
+        public char charFld = 'c';
+        public boolean booleanFld = false;
+        public String stringFld = "NEW";
+
+        // completely new instance fields are below
+        public int intComplNewFld = 333;
+        public long longComplNewFld = 444L;
+        public String stringComplNewFld = "completely new String field";
+    }
+    
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(ComplexFieldTest.class, 0);
+    }
+
+    /**
+     * Checks that the given object is unmodified (i.e. the values of the fields are correct)
+     * @param a the object to be checked
+     */
+    private void assertObjectOK(A a) {
+        assertEquals(10, a.byteFld);
+        assertEquals(20, a.shortFld);
+        assertEquals(30, a.intFld);
+        assertEquals(40L, a.longFld);
+        assertEquals(50.2F, a.floatFld, 0.01);
+        assertEquals(60.3D, a.doubleFld, 0.01);
+        assertEquals('b', a.charFld);
+        assertEquals(true, a.booleanFld);
+        assertEquals("OLD", a.stringFld);
+    }
+
+    @Test
+    public void testComplexFieldChange() {
+        assert HotSwapTool.getCurrentVersion(ComplexFieldTest.class) == 0;
+        A a = new A();
+        assertObjectOK(a);
+        HotSwapTool.toVersion(ComplexFieldTest.class, 1);
+        assertObjectOK(a);
+        HotSwapTool.toVersion(ComplexFieldTest.class, 0);
+        assertObjectOK(a);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/FieldChangedOrderTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/FieldChangedOrderTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Test that changes the order of two int fields.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class FieldChangedOrderTest {
+
+    // Version 0
+    public static class A {
+
+        public int value1;
+        public int value2;
+
+        public A() {
+            value1 = 1;
+            value2 = 2;
+        }
+
+        public int getValue1() {
+            return value1;
+        }
+
+        public int getValue2() {
+            return value2;
+        }
+    }
+
+    public static class B {
+
+        public static int getStaticValue1(A a) {
+            return a.value1;
+        }
+
+        public static int getStaticValue2(A a) {
+            return a.value2;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value2;
+        public int value1;
+
+        public int getValue1() {
+            return value1;
+        }
+
+        public int getValue2() {
+            return value2;
+        }
+    }
+
+    public static class B___1 {
+
+        public static int getStaticValue1(A a) {
+            return a.value1;
+        }
+
+        public static int getStaticValue2(A a) {
+            return a.value2;
+        }
+    }
+
+    // Version 2
+    public static class A___2 {
+
+        public int tmp1;
+        public int value2;
+        public int tmp2;
+        public int value1;
+        public int tmp3;
+
+        public int getValue1() {
+            return value1;
+        }
+
+        public int getValue2() {
+            return value2;
+        }
+    }
+
+    // Version 3
+    public static class A___3 {
+
+        public int tmp1;
+        public int value2;
+
+        public int getValue1() {
+            return tmp1;
+        }
+
+        public int getValue2() {
+            return value2;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(FieldChangedOrderTest.class, 0);
+    }
+
+    @Test
+    public void testRenameField() {
+        assert HotSwapTool.getCurrentVersion(FieldChangedOrderTest.class) == 0;
+        A a = new A();
+        assertObjectOK(a);
+        HotSwapTool.toVersion(FieldChangedOrderTest.class, 3);
+        assertEquals(0, a.getValue1());
+        assertEquals(2, a.getValue2());
+        HotSwapTool.toVersion(FieldChangedOrderTest.class, 0);
+        assertEquals(0, a.getValue1());
+        assertEquals(2, a.getValue2());
+    }
+
+    @Test
+    public void testSimpleOrderChange() {
+        assert HotSwapTool.getCurrentVersion(FieldChangedOrderTest.class) == 0;
+        A a = new A();
+        assertObjectOK(a);
+        HotSwapTool.toVersion(FieldChangedOrderTest.class, 1);
+        assertObjectOK(a);
+        HotSwapTool.toVersion(FieldChangedOrderTest.class, 0);
+        assertObjectOK(a);
+    }
+
+    /**
+     * Checks that the given object is unmodified (i.e. the values of the fields are correct)
+     * @param a the object to be checked
+     */
+    private void assertObjectOK(A a) {
+        assertEquals(1, a.getValue1());
+        assertEquals(2, a.getValue2());
+        assertEquals(1, B.getStaticValue1(a));
+        assertEquals(2, B.getStaticValue2(a));
+        assertEquals(1, a.value1);
+        assertEquals(2, a.value2);
+    }
+
+    @Test
+    public void testSimpleOrderChangeWithNewTempFields() {
+        assert HotSwapTool.getCurrentVersion(FieldChangedOrderTest.class) == 0;
+        A a = new A();
+        assertObjectOK(a);
+        HotSwapTool.toVersion(FieldChangedOrderTest.class, 2);
+        assertObjectOK(a);
+        HotSwapTool.toVersion(FieldChangedOrderTest.class, 0);
+        assertObjectOK(a);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/FieldModificationTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/FieldModificationTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class FieldModificationTest {
+
+    // Version 0
+    public static class A {
+
+        public int val0;
+        public int val1;
+        public int val2;
+        public int val3;
+        public int val4;
+        public int val5;
+        public int val6;
+        public int val7;
+
+        public void increaseAllByOne() {
+            val0++;
+            val1++;
+            val2++;
+            val3++;
+            val4++;
+            val5++;
+            val6++;
+            val7++;
+        }
+
+        public int sum() {
+            return val0 + val1 + val2 + val3 + val4 + val5 + val6 + val7;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int val0;
+
+        public void increaseAllByOne() {
+            val0++;
+        }
+
+        public int sum() {
+            return val0;
+        }
+    }
+
+    // Version 2
+    public static class A___2 {
+
+        public int val0;
+        public int val1;
+        public int val2;
+        public int val3;
+        public int val4;
+        public int val5;
+        public int val6;
+        public int val7;
+        public int val8;
+        public int val9;
+        public int val10;
+        public int val11;
+        public int val12;
+        public int val13;
+        public int val14;
+        public int val15;
+
+        public int sum() {
+            return val0 + val1 + val2 + val3 + val4 + val5 + val6 + val7 + val8 + val9 + val10 + val11 + val12 + val13 + val14 + val15;
+        }
+
+        public void increaseAllByOne() {
+            val0++;
+            val1++;
+            val2++;
+            val3++;
+            val4++;
+            val5++;
+            val6++;
+            val7++;
+            val8++;
+            val9++;
+            val10++;
+            val11++;
+            val12++;
+            val13++;
+            val14++;
+            val15++;
+        }
+    }
+
+    // Version 3
+    public static class A___3 {
+
+        public int val6;
+        public int val0;
+        public int val7;
+        public int val1;
+        public int val2;
+        public int val5;
+        public int val3;
+        public int val4;
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(FieldModificationTest.class, 0);
+    }
+
+    @Test
+    public void testReorder() {
+
+        A a = new A();
+
+        a.val0 = 0;
+        a.val1 = 1;
+        a.val2 = 2;
+        a.val3 = 3;
+        a.val4 = 4;
+        a.val5 = 5;
+        a.val6 = 6;
+        a.val7 = 7;
+    }
+
+    @Test
+    public void testIncreaseFirst() {
+
+        A a = new A();
+
+        a.val0 = 0;
+        a.val1 = 1;
+        a.val2 = 2;
+        a.val3 = 3;
+        a.val4 = 4;
+        a.val5 = 5;
+        a.val6 = 6;
+        a.val7 = 7;
+
+        assertEquals(0, a.val0);
+        assertEquals(1, a.val1);
+        assertEquals(2, a.val2);
+        assertEquals(3, a.val3);
+        assertEquals(4, a.val4);
+        assertEquals(5, a.val5);
+        assertEquals(6, a.val6);
+        assertEquals(7, a.val7);
+        assertEquals(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7, a.sum());
+
+        HotSwapTool.toVersion(FieldModificationTest.class, 2);
+
+        assertEquals(0, a.val0);
+        assertEquals(1, a.val1);
+        assertEquals(2, a.val2);
+        assertEquals(3, a.val3);
+        assertEquals(4, a.val4);
+        assertEquals(5, a.val5);
+        assertEquals(6, a.val6);
+        assertEquals(7, a.val7);
+        assertEquals(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7, a.sum());
+
+        a.increaseAllByOne();
+        assertEquals(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 16, a.sum());
+
+        HotSwapTool.toVersion(FieldModificationTest.class, 0);
+
+        assertEquals(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8, a.sum());
+        assertEquals(1, a.val0);
+        assertEquals(2, a.val1);
+        assertEquals(3, a.val2);
+        assertEquals(4, a.val3);
+        assertEquals(5, a.val4);
+        assertEquals(6, a.val5);
+        assertEquals(7, a.val6);
+        assertEquals(8, a.val7);
+
+        HotSwapTool.toVersion(FieldModificationTest.class, 2);
+
+        assertEquals(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8, a.sum());
+        assertEquals(1, a.val0);
+        assertEquals(2, a.val1);
+        assertEquals(3, a.val2);
+        assertEquals(4, a.val3);
+        assertEquals(5, a.val4);
+        assertEquals(6, a.val5);
+        assertEquals(7, a.val6);
+        assertEquals(8, a.val7);
+
+        a.increaseAllByOne();
+
+        assertEquals(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 16, a.sum());
+        assertEquals(2, a.val0);
+        assertEquals(3, a.val1);
+        assertEquals(4, a.val2);
+        assertEquals(5, a.val3);
+        assertEquals(6, a.val4);
+        assertEquals(7, a.val5);
+        assertEquals(8, a.val6);
+        assertEquals(9, a.val7);
+        HotSwapTool.toVersion(FieldModificationTest.class, 0);
+
+        assertEquals(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 16, a.sum());
+        assertEquals(2, a.val0);
+        assertEquals(3, a.val1);
+        assertEquals(4, a.val2);
+        assertEquals(5, a.val3);
+        assertEquals(6, a.val4);
+        assertEquals(7, a.val5);
+        assertEquals(8, a.val6);
+        assertEquals(9, a.val7);
+    }
+
+    @Test
+    public void testAddRemoveField() {
+
+        assert HotSwapTool.getCurrentVersion(FieldModificationTest.class) == 0;
+
+        A a = new A();
+
+        assertEquals(0, a.val0);
+        assertEquals(0, a.val1);
+
+        HotSwapTool.toVersion(FieldModificationTest.class, 1);
+
+        a.val0 = 1234;
+
+        HotSwapTool.toVersion(FieldModificationTest.class, 0);
+
+        assertEquals(1234, a.val0);
+        assertEquals(0, a.val1);
+
+        a.val1 = 1234;
+
+        assertEquals(1234, a.val0);
+        assertEquals(1234, a.val1);
+
+        HotSwapTool.toVersion(FieldModificationTest.class, 1);
+
+        assertEquals(1234, a.val0);
+
+        HotSwapTool.toVersion(FieldModificationTest.class, 0);
+
+        assertEquals(1234, a.val0);
+        assertEquals(0, a.val1);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/FieldsTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/FieldsTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Class redefinition tests that may change the methods and fields of class, but do not change the superklass or the implemented
+ * interface.
+ * 
+ * @author Thomas Wuerthinger
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    AccessDeletedFieldTest.class,
+    FieldChangedOrderTest.class,
+    FieldModificationTest.class,
+    ObjectStressTest.class,
+    YieldTest.class,
+    ComplexFieldTest.class,
+    StringFieldTest.class,
+    RedefinePrivateFieldTest.class,
+    AccessDeletedStaticFieldTest.class
+})
+public class FieldsTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/ObjectStressTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/ObjectStressTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class ObjectStressTest {
+
+    private final int COUNT = 10000;
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(ObjectStressTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public A thisPointer;
+        public int i1;
+        public int i2;
+        public int i3;
+        public int i4;
+        public int i5;
+        public int i6;
+        public int i7;
+        public int i8;
+        public int i9;
+        public int i10;
+
+        public int sum() {
+            return i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int i1;
+        public int i2;
+        public int i8;
+        public int i3;
+        public int i4;
+        public int i10;
+        public int i5;
+        public int i6;
+        public int i7;
+        public int i9;
+        public A thisPointer;
+
+        public int sum() {
+            return i1 * i2 * i3 * i4 * i5 * i6 * i7 * i8 * i9 * i10;
+        }
+    }
+
+    @Test
+    public void testLotsOfObjects() {
+
+        assert HotSwapTool.getCurrentVersion(ObjectStressTest.class) == 0;
+
+        A[] arr = new A[COUNT];
+        for (int i = 0; i < arr.length; i++) {
+            arr[i] = new A();
+            arr[i].thisPointer = arr[i];
+            arr[i].i1 = 1;
+            arr[i].i2 = 2;
+            arr[i].i3 = 3;
+            arr[i].i4 = 4;
+            arr[i].i5 = 5;
+            arr[i].i6 = 6;
+            arr[i].i7 = 7;
+            arr[i].i8 = 8;
+            arr[i].i9 = 9;
+            arr[i].i10 = 10;
+        }
+
+
+        HotSwapTool.toVersion(ObjectStressTest.class, 1);
+
+        for (int i = 0; i < arr.length; i++) {
+            assertEquals(1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10, arr[i].sum());
+            assertEquals(arr[i].thisPointer, arr[i]);
+        }
+
+        HotSwapTool.toVersion(ObjectStressTest.class, 0);
+
+        for (int i = 0; i < arr.length; i++) {
+            assertEquals(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, arr[i].sum());
+            assertEquals(arr[i].thisPointer, arr[i]);
+        }
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/RedefinePrivateFieldTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/RedefinePrivateFieldTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Tests redefinition of a class such that old code still accesses a redefined private field.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class RedefinePrivateFieldTest {
+
+    // Version 0
+    public static class A {
+
+        private int f1;
+        
+        public A() {
+            f1 = 5;
+        }
+
+        public int foo() {
+            int result = f1;
+            HotSwapTool.toVersion(RedefinePrivateFieldTest.class, 1);
+            result += f1;
+            return result;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        int f0;
+        int f1;
+
+        public int foo() {
+            return -1;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(RedefinePrivateFieldTest.class, 0);
+    }
+
+    @Test
+    public void testRedefinePrivateField() {
+
+        assert HotSwapTool.getCurrentVersion(RedefinePrivateFieldTest.class) == 0;
+
+        A a = new A();
+
+        assertEquals(10, a.foo());
+
+        assert HotSwapTool.getCurrentVersion(RedefinePrivateFieldTest.class) == 1;
+
+        assertEquals(-1, a.foo());
+
+        HotSwapTool.toVersion(RedefinePrivateFieldTest.class, 0);
+
+        assertEquals(10, a.foo());
+
+        assert HotSwapTool.getCurrentVersion(RedefinePrivateFieldTest.class) == 1;
+
+        assertEquals(-1, a.foo());
+
+        HotSwapTool.toVersion(RedefinePrivateFieldTest.class, 0);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/StringFieldTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/StringFieldTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Complex field test.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class StringFieldTest {
+
+    // Version 0
+    public static class A {
+        public String stringFld = "OLD";
+    }
+
+    // Version 1
+    public static class A___1 {
+        public String stringFld = "NEW";
+        public int intComplNewFld = 333;
+        public long longComplNewFld = 444L;
+        public String stringComplNewFld = "completely new String field";
+    }
+    
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(StringFieldTest.class, 0);
+    }
+
+    /**
+     * Checks that the given object is unmodified (i.e. the values of the fields are correct)
+     * @param a the object to be checked
+     */
+    private void assertObjectOK(A a) {
+        assertEquals("OLD", a.stringFld);
+    }
+
+    @Test
+    public void testComplexFieldChange() {
+        assert HotSwapTool.getCurrentVersion(StringFieldTest.class) == 0;
+        A a = new A();
+        assertObjectOK(a);
+        HotSwapTool.toVersion(StringFieldTest.class, 1);
+        assertObjectOK(a);
+        HotSwapTool.toVersion(StringFieldTest.class, 0);
+        assertObjectOK(a);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/YieldTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/YieldTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.fields;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Test case that produces a list of integer values recursively.
+ * The recursive function does not contain a conditional statement.
+ * The recursion is stopped by swapping the recursive method with a different non-recursive implementation.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class YieldTest {
+
+    // Version 0
+    public static class Base {
+
+        protected List<Integer> arr = new ArrayList<Integer>();
+
+        public void reset() {
+            HotSwapTool.toVersion(YieldTest.class, 0);
+        }
+
+        public void next() {
+            HotSwapTool.toVersion(YieldTest.class, HotSwapTool.getCurrentVersion(YieldTest.class) + 1);
+        }
+    }
+
+    public static abstract class A extends Base {
+
+        public List<Integer> gen() {
+            arr.add(produce());
+            next();
+            return gen();
+        }
+
+        public abstract int produce();
+    }
+
+    public static class B extends A {
+
+        public int produce() {
+            return 1;
+        }
+    }
+
+    public static class B___10 extends A {
+
+        public int produce() {
+            return 2;
+        }
+    }
+
+    public static class B___20 extends A {
+
+        private int x;
+
+        public int produce() {
+            return ++x;
+        }
+    }
+
+    public static class A___30 extends Base {
+
+        public List<Integer> gen() {
+            reset();
+            return arr;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(YieldTest.class, 0);
+    }
+
+    @Test
+    public void testYield() {
+
+        assert HotSwapTool.getCurrentVersion(YieldTest.class) == 0;
+
+        B b = new B();
+        assertEquals(Arrays.asList(
+                1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+                2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+                1, 2, 3, 4, 5, 6, 7, 8, 9, 10), b.gen());
+        assert HotSwapTool.getCurrentVersion(YieldTest.class) == 0;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/AddMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/AddMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.methods;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.TestUtil;
+
+/**
+ * Tests for adding / removing methods in a single class.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class AddMethodTest {
+
+    // Version 0
+    public static class A {
+        public int value(int newVersion) {
+            return newVersion;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value(int newVersion) {
+
+            int x = 1;
+            try {
+                x = 2;
+            } catch (NumberFormatException e) {
+                x = 3;
+            } catch (Exception e) {
+                x = 4;
+            } finally {
+                x = x * 2;
+            }
+            HotSwapTool.toVersion(AddMethodTest.class, newVersion);
+            throw new IllegalArgumentException();
+        }
+    }
+
+    // Version 2
+    public static class A___2 {
+
+        public int value2() {
+            return 2;
+        }
+
+        public int value(int newVersion) {
+
+            int x = 1;
+            try {
+                x = 2;
+            } catch (NumberFormatException e) {
+                x = 3;
+            } catch (Exception e) {
+                x = 4;
+            } finally {
+                x = x * 2;
+            }
+            HotSwapTool.toVersion(AddMethodTest.class, newVersion);
+            throw new IllegalArgumentException();
+        }
+
+        public int value3() {
+            return 3;
+        }
+
+        public int value4() {
+            return 4;
+        }
+
+        public int value5() {
+            return 5;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(AddMethodTest.class, 0);
+    }
+
+    @Test
+    public void testAddMethodToKlassWithEMCPExceptionMethod() {
+
+        assert HotSwapTool.getCurrentVersion(AddMethodTest.class) == 0;
+
+        final A a = new A();
+
+        assertEquals(1, a.value(1));
+
+        HotSwapTool.toVersion(AddMethodTest.class, 1);
+
+        int firstLineNumber = TestUtil.assertException(IllegalArgumentException.class, new Runnable() {
+            @Override
+            public void run() {
+                assertEquals(4, a.value(1));
+            }
+        });
+
+        int secondLineNumber = TestUtil.assertException(IllegalArgumentException.class, new Runnable() {
+            @Override
+            public void run() {
+                assertEquals(4, a.value(2));
+            }
+        });
+
+        System.out.println("Exception line numbers: " + firstLineNumber + " and " + secondLineNumber);
+
+        assertTrue("Must have different line numbers (A.value is an EMCP method and therefore execution has to be transferred)", firstLineNumber != secondLineNumber);
+
+        assert HotSwapTool.getCurrentVersion(AddMethodTest.class) == 2;
+
+        int newFirstLineNumber = TestUtil.assertException(IllegalArgumentException.class, new Runnable() {
+            @Override
+            public void run() {
+                assertEquals(4, a.value(2));
+            }
+        });
+
+        assertEquals(secondLineNumber, newFirstLineNumber);
+
+        int newSecondLineNumber = TestUtil.assertException(IllegalArgumentException.class, new Runnable() {
+            @Override
+            public void run() {
+                assertEquals(4, a.value(1));
+            }
+        });
+
+        assertEquals(newSecondLineNumber, firstLineNumber);
+
+        assertTrue("Must have different line numbers (A.value is an EMCP method and therefore execution has to be transferred)", firstLineNumber != secondLineNumber);
+
+        HotSwapTool.toVersion(AddMethodTest.class, 0);
+        
+        assertEquals(1, a.value(1));
+
+        assert HotSwapTool.getCurrentVersion(AddMethodTest.class) == 0;
+
+
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/CallDeletedInterfaceMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/CallDeletedInterfaceMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import static org.junit.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Test case that calls an interface method that was deleted through class redefinition.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class CallDeletedInterfaceMethodTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(CallDeletedInterfaceMethodTest.class, 0);
+    }
+
+    // Version 0
+    public static interface I {
+        public int foo();
+    }
+
+    public static class A implements I {
+        @Override
+        public int foo() {
+            return 1;
+        }
+    }
+
+    public static class Helper {
+        public static int process(I i) {
+            HotSwapTool.toVersion(CallDeletedInterfaceMethodTest.class, 1);
+            return i.foo();
+        }
+    }
+
+    // Version 1
+    public static interface I___1 {
+        
+    }
+
+    public static class Helper___1 {
+        public static int process(I i) {
+            return 2;
+        }
+    }
+
+    @Test
+    public void testOldCodeCallsDeletedInterfaceMethod() {
+
+        assert HotSwapTool.getCurrentVersion(CallDeletedInterfaceMethodTest.class) == 0;
+        A a = new A();
+
+        assertEquals(1, Helper.process(a));
+        assert HotSwapTool.getCurrentVersion(CallDeletedInterfaceMethodTest.class) == 1;
+        assertEquals(2, Helper.process(a));
+
+        HotSwapTool.toVersion(CallDeletedInterfaceMethodTest.class, 0);
+
+        assertEquals(1, Helper.process(a));
+        assert HotSwapTool.getCurrentVersion(CallDeletedInterfaceMethodTest.class) == 1;
+        assertEquals(2, Helper.process(a));
+
+        HotSwapTool.toVersion(CallDeletedInterfaceMethodTest.class, 0);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/CallDeletedMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/CallDeletedMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import at.ssw.hotswap.MethodRedefinitionPolicy;
+import static org.junit.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.RedefinitionPolicy;
+
+/**
+ * Test case that calls a virtual method that was deleted through class redefinition.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class CallDeletedMethodTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(CallDeletedMethodTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 5;
+        }
+
+        public int oldMethod() {
+            HotSwapTool.toVersion(CallDeletedMethodTest.class, 1);
+            return deletedMethod();
+        }
+
+        public int deletedMethod() {
+            return 1;
+        }
+    }
+
+    // Version 1
+    @MethodRedefinitionPolicy(RedefinitionPolicy.AccessDeletedMembers)
+    public static class A___1 {
+
+        public int oldMethod() {
+            return 2;
+        }
+    }
+
+    @Test
+    public void testOldCodeCallsDeletedMethod() {
+
+        assert HotSwapTool.getCurrentVersion(CallDeletedMethodTest.class) == 0;
+        A a = new A();
+
+        assertEquals(1, a.oldMethod());
+        assert HotSwapTool.getCurrentVersion(CallDeletedMethodTest.class) == 1;
+        assertEquals(2, a.oldMethod());
+
+        HotSwapTool.toVersion(CallDeletedMethodTest.class, 0);
+
+        assertEquals(1, a.oldMethod());
+        assert HotSwapTool.getCurrentVersion(CallDeletedMethodTest.class) == 1;
+        assertEquals(2, a.oldMethod());
+
+        HotSwapTool.toVersion(CallDeletedMethodTest.class, 0);
+    }
+
+    @Test
+    public void testNewCodeCallsDeletedMethod() {
+
+        assert HotSwapTool.getCurrentVersion(CallDeletedMethodTest.class) == 0;
+
+        A a = new A();
+        assertEquals(5, a.value());
+        
+        HotSwapTool.toVersion(CallDeletedMethodTest.class, 1);
+
+        try {
+            a.value();
+            Assert.fail("NoSuchMethodError exception must be thrown!");
+        } catch (NoSuchMethodError e) {
+            // Expected exception
+        }
+
+        HotSwapTool.toVersion(CallDeletedMethodTest.class, 0);
+        assertEquals(5, a.value());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/DeleteActiveMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/DeleteActiveMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import at.ssw.hotswap.MethodRedefinitionPolicy;
+import static org.junit.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.RedefinitionPolicy;
+import at.ssw.hotswap.test.TestUtil;
+
+/**
+ * Test cases that delete a method that is currently active on the stack.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class DeleteActiveMethodTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(DeleteActiveMethodTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        boolean firstCall;
+
+        public int value() {
+            firstCall = true;
+            return helperValue();
+        }
+
+        public int helperValue() {
+
+            if (!firstCall) {
+                return -1;
+            }
+            firstCall = false;
+
+            Thread t = new Thread(new Runnable() {
+
+                @Override
+                public void run() {
+                    HotSwapTool.toVersion(DeleteActiveMethodTest.class, 1);
+                }
+            });
+            t.start();
+
+            try {
+                while (t.isAlive()) {
+                    try {
+                        this.helperValue();
+                        Thread.sleep(10);
+                    } catch (InterruptedException e) {
+                    }
+                }
+                Assert.fail("Exception expected!");
+            } catch (NoSuchMethodError e) {
+            }
+
+            try {
+                t.join();
+            } catch (InterruptedException e) {
+            }
+
+            return 1;
+        }
+    }
+
+    public static class B {
+
+        public int fac(int x) {
+            if (x == 0) {
+                HotSwapTool.toVersion(DeleteActiveMethodTest.class, 1);
+            }
+
+            return x * fac(x - 1);
+        }
+    }
+
+    // Version 1
+    @MethodRedefinitionPolicy(RedefinitionPolicy.DynamicCheck)
+    public static class A___1 {
+
+        boolean firstCall;
+
+        public int value() {
+            HotSwapTool.toVersion(DeleteActiveMethodTest.class, 0);
+            return 2;
+        }
+    }
+
+    @MethodRedefinitionPolicy(RedefinitionPolicy.DynamicCheck)
+    public static class B___1 {
+    }
+
+    @Test
+    public void testDeleteActiveMethodSimple() {
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 0;
+
+        final B b = new B();
+        TestUtil.assertException(NoSuchMethodError.class, new Runnable() {
+            @Override
+            public void run() {
+                b.fac(5);
+            }
+        });
+       
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 1;
+        
+        HotSwapTool.toVersion(DeleteActiveMethodTest.class, 0);
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 0;
+    }
+
+    @Test
+    public void testDeleteActiveMethod() {
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 0;
+
+        A a = new A();
+
+        assertEquals(1, a.value());
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 1;
+
+        assertEquals(2, a.value());
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 0;
+
+        assertEquals(1, a.value());
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 1;
+
+        assertEquals(2, a.value());
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 0;
+
+        assertEquals(1, a.value());
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 1;
+
+        assertEquals(2, a.value());
+        assert HotSwapTool.getCurrentVersion(DeleteActiveMethodTest.class) == 0;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/MethodsTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/MethodsTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Class redefinition tests that perform adding/removing/changing the methods of a class.
+ * 
+ * @author Thomas Wuerthinger
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    AddMethodTest.class,
+    CallDeletedMethodTest.class,
+    DeleteActiveMethodTest.class,
+    ReflectionTest.class,
+    OverrideMethodTest.class,
+    SingleClassTest.class,
+    SingleClassReflectionTest.class,
+    OldCodeNonOSRTest.class,
+    CallDeletedInterfaceMethodTest.class
+})
+public class MethodsTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/OldCodeNonOSRTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/OldCodeNonOSRTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Test case that makes sure that old code does not get on-stack-replaced.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class OldCodeNonOSRTest {
+
+    // Chose high enough to make sure method could get OSR (usually the OSR flag in the VM is set to about 15000)
+    private static final int N = 100000;
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(OldCodeNonOSRTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 5;
+        }
+
+        public int oldMethod() {
+            HotSwapTool.toVersion(OldCodeNonOSRTest.class, 1);
+            int sum = 0;
+            for (int i=0; i<N; i++) {
+                sum += i;
+            }
+            return (sum & deletedMethod()) | 1;
+        }
+
+        public int oldMethod2() {
+            int sum = 0;
+            for (int i=0; i<N; i++) {
+                sum += i;
+            }
+            HotSwapTool.toVersion(OldCodeNonOSRTest.class, 1);
+            return (sum & deletedMethod()) | 1;
+        }
+
+        public int oldMethod3() {
+            int sum = 0;
+            for (int i=0; i<N; i++) {
+                sum += i;
+            }
+            HotSwapTool.toVersion(OldCodeNonOSRTest.class, 1);
+            for (int i=0; i<N; i++) {
+                sum += i;
+            }
+            return (sum & deletedMethod()) | 1;
+        }
+
+        public int deletedMethod() {
+            return 1;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int oldMethod() {
+            return 2;
+        }
+    }
+
+    @Test
+    public void testOldCodeNonOSR() {
+
+        assert HotSwapTool.getCurrentVersion(OldCodeNonOSRTest.class) == 0;
+        A a = new A();
+
+        assertEquals(1, a.oldMethod());
+        assert HotSwapTool.getCurrentVersion(OldCodeNonOSRTest.class) == 1;
+        assertEquals(2, a.oldMethod());
+
+        HotSwapTool.toVersion(OldCodeNonOSRTest.class, 0);
+
+        assertEquals(1, a.oldMethod2());
+        assert HotSwapTool.getCurrentVersion(OldCodeNonOSRTest.class) == 1;
+        assertEquals(2, a.oldMethod());
+
+        HotSwapTool.toVersion(OldCodeNonOSRTest.class, 0);
+
+        assertEquals(1, a.oldMethod3());
+        assert HotSwapTool.getCurrentVersion(OldCodeNonOSRTest.class) == 1;
+        assertEquals(2, a.oldMethod());
+
+        HotSwapTool.toVersion(OldCodeNonOSRTest.class, 0);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/OverrideMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/OverrideMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Tests for the class relationship A<B<C with adding / removing methods.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class OverrideMethodTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(OverrideMethodTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 5;
+        }
+    }
+
+    public static class B extends A {
+
+        public int doubled() {
+            return value() * 2;
+        }
+    }
+
+    public static class C extends B {
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value() {
+            return 10;
+        }
+    }
+
+    // Version 2
+    public static class B___2 extends A {
+
+        public int doubled() {
+            return value() * 3;
+        }
+    }
+
+    // Version 3
+    public static class C___3 extends B {
+
+        @Override
+        public int value() {
+            return 1;
+        }
+    }
+
+    // Verison 4
+    public static class A___4 {
+
+        public int value() {
+            return baseValue();
+        }
+
+        public int baseValue() {
+            return 20;
+        }
+    }
+
+    public static class B___4 extends A {
+
+        public int doubled() {
+            return value() * 2;
+        }
+    }
+
+    public static class C___4 extends B {
+    }
+
+    // Verison 5
+    public static class A___5 {
+
+        public int value() {
+            return baseValue();
+        }
+
+        public int baseValue() {
+            return 20;
+        }
+    }
+
+    @Test
+    public void testSimple() {
+
+        assert HotSwapTool.getCurrentVersion(OverrideMethodTest.class) == 0;
+
+        A a = new A();
+        B b = new B();
+        C c = new C();
+
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 1);
+        assertEquals(10, a.value());
+        assertEquals(10, b.value());
+        assertEquals(20, b.doubled());
+        assertEquals(10, c.value());
+        assertEquals(20, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 2);
+        assertEquals(10, a.value());
+        assertEquals(10, b.value());
+        assertEquals(30, b.doubled());
+        assertEquals(10, c.value());
+        assertEquals(30, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 0);
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+    }
+
+    @Test
+    public void testMethodAdd() {
+
+        assert HotSwapTool.getCurrentVersion(OverrideMethodTest.class) == 0;
+        A a = new A();
+        B b = new B();
+        C c = new C();
+
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 4);
+        assertEquals(20, a.value());
+        assertEquals(40, b.doubled());
+        assertEquals(20, b.value());
+        assertEquals(20, c.value());
+        assertEquals(40, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 0);
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+    }
+
+    @Test
+    public void testOverride() {
+
+        assert HotSwapTool.getCurrentVersion(OverrideMethodTest.class) == 0;
+
+        A a = new A();
+        B b = new B();
+        C c = new C();
+
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 3);
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(1, c.value());
+        assertEquals(2, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 0);
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+    }
+
+    @Test
+    public void testMethodAddAdvanced() {
+
+        assert HotSwapTool.getCurrentVersion(OverrideMethodTest.class) == 0;
+        A a = new A();
+        B b = new B();
+        C c = new C();
+
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 5);
+        assertEquals(20, a.value());
+        assertEquals(20, b.value());
+        assertEquals(40, b.doubled());
+        assertEquals(20, c.value());
+        assertEquals(40, c.doubled());
+
+        HotSwapTool.toVersion(OverrideMethodTest.class, 0);
+        assertEquals(5, a.value());
+        assertEquals(5, b.value());
+        assertEquals(10, b.doubled());
+        assertEquals(5, c.value());
+        assertEquals(10, c.doubled());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/ReflectionTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/ReflectionTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import java.lang.ref.SoftReference;
+
+/**
+ * Testing correct reflection functionality after class redefinition.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class ReflectionTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(ReflectionTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 1;
+        }
+    }
+
+    public static class B extends A {
+
+        @Override
+        public int value() {
+            return 2;
+        }
+    }
+
+    public static class C extends B {
+
+        @Override
+        public int value() {
+            return 3;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value() {
+            return 1;
+        }
+
+        public int value2() {
+            return 2;
+        }
+    }
+
+    // Version 2
+    public static class C___2 extends A {
+
+        @Override
+        public int value() {
+            return super.value();
+        }
+    }
+
+    @Test
+    public void testMethodReflection() {
+
+        assert HotSwapTool.getCurrentVersion(ReflectionTest.class) == 0;
+
+        A a = new A();
+        B b = new B();
+        C c = new C();
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(3, c.value());
+
+        assertContainsMethod(A.class, "value");
+        assertDoesNotContainMethod(A.class, "value2");
+
+        HotSwapTool.toVersion(ReflectionTest.class, 1);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(3, c.value());
+
+        assertContainsMethod(A.class, "value");
+        assertContainsMethod(A.class, "value2");
+
+        HotSwapTool.toVersion(ReflectionTest.class, 0);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(3, c.value());
+
+        assertContainsMethod(A.class, "value");
+        assertDoesNotContainMethod(A.class, "value2");
+    }
+
+    private void assertContainsMethod(Class<?> c, String methodName) {
+        boolean found = false;
+        for (Method m : c.getDeclaredMethods()) {
+            if (m.getName().equals(methodName)) {
+                found = true;
+                break;
+            }
+        }
+
+        Assert.assertTrue(found);
+    }
+
+    private void assertDoesNotContainMethod(Class<?> c, String methodName) {
+        boolean found = false;
+        for (Method m : c.getDeclaredMethods()) {
+            if (m.getName().equals(methodName)) {
+                found = true;
+                break;
+            }
+        }
+
+        Assert.assertFalse(found);
+    }
+
+    private void assertIsSuper(Class<?> s, Class<?> c) {
+        assertEquals(s, c.getSuperclass());
+    }
+
+    private void assertIsNotSuper(Class<?> s, Class<?> c) {
+        Assert.assertFalse(s.equals(c.getSuperclass()));
+    }
+
+    @Test
+    public void testClassReflection() {
+
+        assert HotSwapTool.getCurrentVersion(ReflectionTest.class) == 0;
+
+        A a = new A();
+        B b = new B();
+        C c = new C();
+
+        assertIsSuper(A.class, B.class);
+        assertIsSuper(B.class, C.class);
+        assertIsNotSuper(A.class, C.class);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(3, c.value());
+
+        HotSwapTool.toVersion(ReflectionTest.class, 2);
+
+        assertIsSuper(A.class, B.class);
+        assertIsNotSuper(B.class, C.class);
+        assertIsSuper(A.class, C.class);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(1, c.value());
+
+        HotSwapTool.toVersion(ReflectionTest.class, 0);
+
+        assertIsSuper(A.class, B.class);
+        assertIsNotSuper(A.class, C.class);
+        assertIsSuper(B.class, C.class);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(3, c.value());
+    }
+
+    @Test
+    public void testWeakReferenceOnClass() {
+        A a = new A();
+        Class strongRef = a.getClass();
+        SoftReference<Class> softRef = new SoftReference<Class>(a.getClass());
+
+
+        assertEquals(1, a.value());
+        HotSwapTool.toVersion(ReflectionTest.class, 1);
+        assertEquals(1, a.value());
+        Assert.assertTrue(strongRef == softRef.get());
+
+        HotSwapTool.toVersion(ReflectionTest.class, 0);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/SingleClassReflectionTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/SingleClassReflectionTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Testing correct behaviour of the class object after class redefinition (with respect to the identity hash code and synchronization).
+ *
+ * @author Thomas Wuerthinger
+ */
+public class SingleClassReflectionTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(SingleClassReflectionTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public static synchronized void staticSynchronized() {
+            HotSwapTool.toVersion(SingleClassReflectionTest.class, 1);
+        }
+    }
+
+
+    // Version 1
+    public static class A___1 {
+        public static synchronized void staticSynchronized() {
+        }
+    }
+
+
+    @Test
+    public void testHashcode() {
+
+        assert HotSwapTool.getCurrentVersion(SingleClassReflectionTest.class) == 0;
+
+        A a = new A();
+        
+        int hashcode = a.getClass().hashCode();
+
+        HotSwapTool.toVersion(SingleClassReflectionTest.class, 1);
+
+        assertEquals(hashcode, a.getClass().hashCode());
+
+        HotSwapTool.toVersion(SingleClassReflectionTest.class, 0);
+    }
+
+    @Test
+    public void testStaticSynchronized() {
+
+        A.staticSynchronized();
+
+        assertEquals(1, HotSwapTool.getCurrentVersion(SingleClassReflectionTest.class));
+
+        HotSwapTool.toVersion(SingleClassReflectionTest.class, 0);
+    }
+
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/SingleClassTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/methods/SingleClassTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.methods;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Tests for adding / removing methods in a single class.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class SingleClassTest {
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 5;
+        }
+    }
+
+    // Version 3
+    public static class A___3 {
+
+        public int value() {
+            return 5;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value() {
+            return 6;
+        }
+
+        public int testValue() {
+            return 1;
+
+        }
+    }
+
+    // Version 2
+    public static class A___2 {
+
+        public int value() {
+            return baseValue() * 2;
+        }
+
+        public int baseValue() {
+            return 10;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(SingleClassTest.class, 0);
+    }
+
+    @Test
+    public void testSimpleReplacement() {
+
+        assert HotSwapTool.getCurrentVersion(SingleClassTest.class) == 0;
+
+        A a = new A();
+
+        assertEquals(5, a.value());
+
+        HotSwapTool.toVersion(SingleClassTest.class, 1);
+
+        assertEquals(6, a.value());
+
+        HotSwapTool.toVersion(SingleClassTest.class, 3);
+
+        assertEquals(5, a.value());
+
+        HotSwapTool.toVersion(SingleClassTest.class, 0);
+
+        assertEquals(5, a.value());
+    }
+
+    @Test
+    public void testAddMethod() {
+
+        assert HotSwapTool.getCurrentVersion(SingleClassTest.class) == 0;
+
+        A a = new A();
+        assertEquals(a.value(), 5);
+
+        HotSwapTool.toVersion(SingleClassTest.class, 2);
+        assertEquals(a.value(), 20);
+
+        HotSwapTool.toVersion(SingleClassTest.class, 0);
+        assertEquals(a.value(), 5);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/natives/NativesTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/natives/NativesTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.natives;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Class redefinition tests that include native code.
+ * 
+ * @author Thomas Wuerthinger
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    SimpleNativeTest.class
+})
+public class NativesTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/natives/SimpleNativeTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/natives/SimpleNativeTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.natives;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Testing correct resolving of a native method after class redefinition.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class SimpleNativeTest {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(SimpleNativeTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public static int get() {
+            return value();
+        }
+
+        public static native int value();
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public static int get() {
+            return value() + value2();
+        }
+
+        public static native int value();
+
+        public static native int value2();
+    }
+
+    @Test
+    public void testSimpleNativeCalls() {
+
+        assert HotSwapTool.getCurrentVersion(SimpleNativeTest.class) == 0;
+
+
+        assertEquals(1, A.get());
+
+        HotSwapTool.toVersion(SimpleNativeTest.class, 1);
+
+        assertEquals(3, A.get());
+
+        HotSwapTool.toVersion(SimpleNativeTest.class, 0);
+
+        assertEquals(1, A.get());
+
+    }
+
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/GeometryScenario.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/GeometryScenario.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.structural;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * A small geometry example application including a Point and a Rectangle class.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class GeometryScenario {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(GeometryScenario.class, 0);
+    }
+
+    // Version 0
+    public static class Point {
+
+        private int x;
+        private int y;
+
+        public Point(int x, int y) {
+            this.x = x;
+            this.y = y;
+        }
+
+        public boolean isBottomRightOf(Point p) {
+            return p.x >= x && p.y >= y;
+        }
+
+        public boolean isTopLeftOf(Point p) {
+            return p.x <= x && p.y <= y;
+        }
+
+        public int getX() {
+            return x;
+        }
+
+        public int getY() {
+            return y;
+        }
+    }
+
+    public static interface IFigure {
+
+        public boolean isHitAt(Point p);
+    }
+
+    public static class Rectangle {
+
+        private Point topLeft;
+        private Point bottomRight;
+
+        public Rectangle(Point p1, Point p2) {
+            topLeft = p1;
+            bottomRight = p2;
+        }
+
+        public boolean isHitAt(Point p) {
+            return p.isBottomRightOf(topLeft) && !p.isTopLeftOf(bottomRight);
+        }
+
+        public Point getTopLeft() {
+            return topLeft;
+        }
+
+        public Point getBottomRight() {
+            return bottomRight;
+        }
+
+        public static Rectangle create(Point p) {
+            return (Rectangle) (Object) (new Rectangle___1(p));
+        }
+    }
+
+    // Version 1
+    public static class Rectangle___1 implements IFigure {
+
+        private Point topLeft;
+        private Point center;
+        private Point bottomRight;
+
+        public Point getCenter() {
+            return center;
+        }
+
+        public Rectangle___1(Point p) {
+            topLeft = p;
+            bottomRight = p;
+        }
+
+        public boolean isHitAt(Point p) {
+            return p.isBottomRightOf(topLeft) && !p.isTopLeftOf(bottomRight);
+        }
+
+        public Point getTopLeft() {
+            return topLeft;
+        }
+
+        public Point getBottomRight() {
+            return bottomRight;
+        }
+
+        public static Rectangle create(Point p) {
+            return (Rectangle) (Object) (new Rectangle___1(p));
+        }
+    }
+
+    public static class Point___1 {
+
+        private char x1;
+        private int y;
+        private char x2;
+
+        public boolean isBottomRightOf(Point p) {
+            return p.x >= x1 && p.y >= y;
+        }
+
+        public boolean isTopLeftOf(Point p) {
+            return p.x <= x1 && p.y <= y;
+        }
+
+        public int getY() {
+            return y;
+        }
+
+        public int getX() {
+            return x1;
+        }
+
+        public char getX2() {
+            return x2;
+        }
+    }
+
+    @Test
+    public void testContructorChange() {
+
+        assert HotSwapTool.getCurrentVersion(GeometryScenario.class) == 0;
+
+        Point p1 = new Point(1, 2);
+        Point p2 = new Point(3, 4);
+        Rectangle r1 = new Rectangle(p1, p2);
+
+        assertEquals(1, p1.getX());
+        assertEquals(2, p1.getY());
+        assertEquals(3, p2.getX());
+        assertEquals(4, p2.getY());
+        assertEquals(p1, r1.getTopLeft());
+        assertEquals(p2, r1.getBottomRight());
+
+        HotSwapTool.toVersion(GeometryScenario.class, 1);
+
+        r1 = Rectangle.create(p1);
+        assertEquals(0, p1.getX());
+        assertEquals(2, p1.getY());
+        assertEquals(0, p2.getX());
+        assertEquals(4, p2.getY());
+        assertEquals(p1, r1.getTopLeft());
+        assertEquals(p1, r1.getBottomRight());
+
+        HotSwapTool.toVersion(GeometryScenario.class, 0);
+
+        assertEquals(0, p1.getX());
+        assertEquals(2, p1.getY());
+        assertEquals(0, p2.getX());
+        assertEquals(4, p2.getY());
+        assertEquals(p1, r1.getTopLeft());
+        assertEquals(p1, r1.getBottomRight());
+    }
+
+    @Test
+    public void testSingleGeometry() {
+
+        assert HotSwapTool.getCurrentVersion(GeometryScenario.class) == 0;
+
+        Point p1 = new Point(1, 2);
+        Point p2 = new Point(3, 4);
+        Rectangle r1 = new Rectangle(p1, p2);
+
+        assertEquals(1, p1.getX());
+        assertEquals(2, p1.getY());
+        assertEquals(3, p2.getX());
+        assertEquals(4, p2.getY());
+        assertEquals(p1, r1.getTopLeft());
+        assertEquals(p2, r1.getBottomRight());
+
+        HotSwapTool.toVersion(GeometryScenario.class, 1);
+
+        System.out.println("after redef");
+        assertEquals(0, p1.getX());
+        System.out.println("1");
+        assertEquals(2, p1.getY());
+        System.out.println("2");
+        assertEquals(0, p2.getX());
+        System.out.println("3");
+        assertEquals(4, p2.getY());
+        System.out.println("4");
+        assertEquals(p1, r1.getTopLeft());
+        System.out.println("5");
+        assertEquals(p2, r1.getBottomRight());
+        System.out.println("6");
+
+        HotSwapTool.toVersion(GeometryScenario.class, 0);
+
+        assertEquals(0, p1.getX());
+        assertEquals(2, p1.getY());
+        assertEquals(0, p2.getX());
+        assertEquals(4, p2.getY());
+        assertEquals(p1, r1.getTopLeft());
+        assertEquals(p2, r1.getBottomRight());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/HierarchySwapTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/HierarchySwapTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.structural;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Smallest test case for a hierarchy swap. A<B is changed to B<A.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class HierarchySwapTest {
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 1;
+        }
+    }
+
+    public static class B extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class C {
+
+        public boolean doInstanceCheckA(Object o) {
+            return o instanceof A;
+        }
+
+        public boolean doInstanceCheckB(Object o) {
+            return o instanceof B;
+        }
+    }
+
+    public static class Base {
+
+        public String className() {
+            return "Base";
+        }
+    }
+
+    public static class D extends Base {
+
+        @Override
+        public String className() {
+            return "D";
+        }
+
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class E extends Base {
+
+        @Override
+        public String className() {
+            return "E";
+        }
+
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class F extends Base {
+
+        @Override
+        public String className() {
+            return "F";
+        }
+
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    // Version 1
+    public static class A___1 extends B___1 {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class B___1 {
+
+        public int value() {
+            return 4;
+        }
+    }
+
+    public static class C___1 {
+
+        public boolean doInstanceCheckA(Object o) {
+            return o instanceof A;
+        }
+
+        public boolean doInstanceCheckB(Object o) {
+            return o instanceof B;
+        }
+    }
+
+    // Version 2
+    public static class D___2 extends Base {
+
+        @Override
+        public String className() {
+            return "D";
+        }
+
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class E___2 extends D {
+
+        @Override
+        public String className() {
+            return "E";
+        }
+
+        @Override
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class F___2 extends E {
+
+        @Override
+        public String className() {
+            return "F";
+        }
+
+        @Override
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    // Version 3
+    public static class D___3 extends E {
+
+        @Override
+        public String className() {
+            return "D";
+        }
+
+        @Override
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class E___3 extends F {
+
+        @Override
+        public String className() {
+            return "E";
+        }
+
+        @Override
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class F___3 extends Base {
+
+        @Override
+        public String className() {
+            return "F";
+        }
+
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    // Version 4
+    public static class D___4 extends E {
+
+        @Override
+        public String className() {
+            return "D";
+        }
+
+        @Override
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class E___4 extends Base {
+
+        @Override
+        public String className() {
+            return "E";
+        }
+
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    public static class F___4 extends E {
+
+        @Override
+        public String className() {
+            return "F";
+        }
+
+        @Override
+        public String superClassName() {
+            return super.className();
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(HierarchySwapTest.class, 0);
+    }
+
+    @Test
+    public void testHierarchySwap() {
+
+        assert HotSwapTool.getCurrentVersion(HierarchySwapTest.class) == 0;
+
+        A a = new A();
+        B b = new B();
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertTrue(b.getClass().getSuperclass().equals(A.class));
+        assertFalse(a.getClass().getSuperclass().equals(B.class));
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 1);
+
+        assertEquals(8, a.value());
+        assertEquals(4, b.value());
+        assertFalse(b.getClass().getSuperclass().equals(A.class));
+        assertTrue(a.getClass().getSuperclass().equals(B.class));
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 0);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertTrue(b.getClass().getSuperclass().equals(A.class));
+        assertFalse(a.getClass().getSuperclass().equals(B.class));
+    }
+
+    @Test
+    public void testHierarchySwapWithInstanceOfTest() {
+
+        assert HotSwapTool.getCurrentVersion(HierarchySwapTest.class) == 0;
+
+        A a = new A();
+        B b = new B();
+        C c = new C();
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertTrue(c.doInstanceCheckA(b));
+        assertFalse(c.doInstanceCheckB(a));
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 1);
+
+        assertEquals(8, a.value());
+        assertEquals(4, b.value());
+        assertFalse(c.doInstanceCheckA(b));
+        assertTrue(c.doInstanceCheckB(a));
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 0);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertTrue(c.doInstanceCheckA(b));
+        assertFalse(c.doInstanceCheckB(a));
+    }
+
+    @Test
+    public void testHierarchySwapWithInstanceOf() {
+
+        assert HotSwapTool.getCurrentVersion(HierarchySwapTest.class) == 0;
+
+        A a = new A();
+        B b = new B();
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertTrue(b instanceof A);
+        assertFalse(a instanceof B);
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 1);
+
+        assertEquals(8, a.value());
+        assertEquals(4, b.value());
+        assertFalse(b instanceof A);
+        assertTrue(a instanceof B);
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 0);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertTrue(b instanceof A);
+        assertFalse(a instanceof B);
+    }
+
+    @Test
+    public void testTripleSwap() {
+
+
+        assert HotSwapTool.getCurrentVersion(HierarchySwapTest.class) == 0;
+
+        D d = new D();
+        E e = new E();
+        F f = new F();
+
+        assertEquals(d.superClassName(), "Base");
+        assertEquals(e.superClassName(), "Base");
+        assertEquals(f.superClassName(), "Base");
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 2);
+
+        assertEquals(d.superClassName(), "Base");
+        assertEquals(e.superClassName(), "D");
+        assertEquals(f.superClassName(), "E");
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 3);
+
+        assertEquals(d.superClassName(), "E");
+        assertEquals(e.superClassName(), "F");
+        assertEquals(f.superClassName(), "Base");
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 4);
+
+        assertEquals(d.superClassName(), "E");
+        assertEquals(e.superClassName(), "Base");
+        assertEquals(f.superClassName(), "E");
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 3);
+
+        assertEquals(d.superClassName(), "E");
+        assertEquals(e.superClassName(), "F");
+        assertEquals(f.superClassName(), "Base");
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 2);
+
+        assertEquals(d.superClassName(), "Base");
+        assertEquals(e.superClassName(), "D");
+        assertEquals(f.superClassName(), "E");
+
+        HotSwapTool.toVersion(HierarchySwapTest.class, 0);
+
+        assertEquals(d.superClassName(), "Base");
+        assertEquals(e.superClassName(), "Base");
+        assertEquals(f.superClassName(), "Base");
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/InterfaceTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/InterfaceTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.structural;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.methods.OverrideMethodTest;
+
+/**
+ * Tests for adding an interface to a class and for changing the methods of an interface.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class InterfaceTest {
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(InterfaceTest.class, 0);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    public static interface A {
+
+        int giveMeFive();
+    }
+
+    public static class AImpl {
+
+        public int giveMeFive() {
+            return 5;
+        }
+    }
+
+    public static class BImpl implements A {
+
+        @Override
+        public int giveMeFive() {
+            return 5;
+        }
+
+        public int giveMeTen() {
+            return 10;
+        }
+    }
+
+    public static class AImpl___1 implements A {
+
+        @Override
+        public int giveMeFive() {
+            return 5;
+        }
+    }
+
+    public static interface A___2 {
+
+        int giveMeTen();
+    }
+
+    public static class Helper {
+
+        public int giveMeTenA2(A a) {
+            return 3;
+        }
+    }
+
+    public static class Helper___2 {
+
+        public int giveMeTenA2(A a) {
+            return ((A___2) a).giveMeTen();
+        }
+    }
+
+    @Test
+    public void testAddInterface() {
+
+        assert HotSwapTool.getCurrentVersion(OverrideMethodTest.class) == 0;
+
+        AImpl a = new AImpl();
+        assertFalse(a instanceof A);
+        try {
+            int val = (((A) a).giveMeFive());
+            fail();
+        } catch (ClassCastException e) {
+        }
+
+        HotSwapTool.toVersion(InterfaceTest.class, 1);
+        assertTrue(a instanceof A);
+        assertEquals(5, ((A) a).giveMeFive());
+
+        HotSwapTool.toVersion(InterfaceTest.class, 0);
+        assertFalse(a instanceof A);
+    }
+
+    @Test
+    public void testModifyInterface() {
+
+        assert HotSwapTool.getCurrentVersion(OverrideMethodTest.class) == 0;
+
+        BImpl b = new BImpl();
+        assertTrue(b instanceof A);
+
+        HotSwapTool.toVersion(InterfaceTest.class, 2);
+
+        assertEquals(10, new Helper().giveMeTenA2(b));
+
+        HotSwapTool.toVersion(InterfaceTest.class, 0);
+        assertEquals(5, ((A) b).giveMeFive());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/LargeHierarchyTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/LargeHierarchyTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.structural;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Tests that modify a large class hierarchy with the classes A, B, C, D, E, and F.
+ * 
+ * @author Thomas Wuerthinger
+ */
+public class LargeHierarchyTest {
+
+    private A a = new A();
+    private B b = new B();
+    private C c = new C();
+    private D d = new D();
+    private E e = new E();
+    private F f = new F();
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public int value() {
+            return 1;
+        }
+    }
+
+    public static class B extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class C extends B {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class D extends C {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class E extends D {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class F extends E {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int value() {
+            return 2;
+        }
+    }
+
+    // Version 2
+    //     D - E - F
+    //   /
+    // A - B - C
+    public static class D___2 extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    // Version 3
+    //     D
+    //   /
+    // A - B - C - E - F
+    public static class D___3 extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class E___3 extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    // Version 4
+    // Completely flat
+    public static class C___4 extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class D___4 extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class E___4 extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    public static class F___4 extends A {
+
+        @Override
+        public int value() {
+            return super.value() * 2;
+        }
+    }
+
+    // Version 5
+    public static class F___5 extends E {
+
+        @Override
+        public int value() {
+            return 0;
+        }
+    }
+
+    @Test
+    public void testChangeBaseClass() {
+
+        assert HotSwapTool.getCurrentVersion(LargeHierarchyTest.class) == 0;
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(8, d.value());
+        assertEquals(16, e.value());
+        assertEquals(32, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 1);
+
+        assertEquals(2, a.value());
+        assertEquals(4, b.value());
+        assertEquals(8, c.value());
+        assertEquals(16, d.value());
+        assertEquals(32, e.value());
+        assertEquals(64, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 0);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(8, d.value());
+        assertEquals(16, e.value());
+        assertEquals(32, f.value());
+    }
+
+    @Test
+    public void testChangeSubClass() {
+        assert HotSwapTool.getCurrentVersion(LargeHierarchyTest.class) == 0;
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(8, d.value());
+        assertEquals(16, e.value());
+        assertEquals(32, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 5);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(8, d.value());
+        assertEquals(16, e.value());
+        assertEquals(0, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 0);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(8, d.value());
+        assertEquals(16, e.value());
+        assertEquals(32, f.value());
+    }
+
+    @Test
+    public void testChangeHierarchy() {
+
+        assert HotSwapTool.getCurrentVersion(LargeHierarchyTest.class) == 0;
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(8, d.value());
+        assertEquals(16, e.value());
+        assertEquals(32, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 2);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(2, d.value());
+        assertEquals(4, e.value());
+        assertEquals(8, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 3);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(2, d.value());
+        assertEquals(2, e.value());
+        assertEquals(4, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 4);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(2, c.value());
+        assertEquals(2, d.value());
+        assertEquals(2, e.value());
+        assertEquals(2, f.value());
+
+        HotSwapTool.toVersion(LargeHierarchyTest.class, 0);
+
+        assertEquals(1, a.value());
+        assertEquals(2, b.value());
+        assertEquals(4, c.value());
+        assertEquals(8, d.value());
+        assertEquals(16, e.value());
+        assertEquals(32, f.value());
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/RedefineClassClassTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/RedefineClassClassTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.structural;
+
+import at.ssw.hotswap.ClassRedefinitionPolicy;
+
+
+import at.ssw.hotswap.HotSwapTool;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Smallest test case for redefining the interface java/lang/reflect/Type (causes java/lang/Class being redefined)
+ *
+ * @author Thomas Wuerthinger
+ */
+public class RedefineClassClassTest {
+
+    // Version 0
+    public interface Type {
+    }
+
+    // Version 1
+    @ClassRedefinitionPolicy(alias = java.lang.reflect.Type.class)
+    public interface Type___1 {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(RedefineClassClassTest.class, 0);
+    }
+
+    @Test
+    public void testRedefineClass() {
+
+        assert HotSwapTool.getCurrentVersion(RedefineClassClassTest.class) == 0;
+
+        HotSwapTool.toVersion(RedefineClassClassTest.class, 1);
+
+        HotSwapTool.toVersion(RedefineClassClassTest.class, 0);
+
+        HotSwapTool.toVersion(RedefineClassClassTest.class, 1);
+
+        HotSwapTool.toVersion(RedefineClassClassTest.class, 0);
+
+
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/RedefineObjectClassTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/RedefineObjectClassTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package at.ssw.hotswap.test.structural;
+
+import at.ssw.hotswap.ClassRedefinitionPolicy;
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+
+/**
+ * Smallest test case for redefining java/lang/Object, without changing the number of virtual methods.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class RedefineObjectClassTest {
+
+    // Version 0
+    public static class Helper {
+        public static String access(Object o) {
+            return "";
+        }
+    }
+    
+    // Version 1
+
+    public static class Helper___1 {
+        public static String access(Object o) {
+            return ((A___1)o).myTestFunction___();
+        }
+    }
+
+    @ClassRedefinitionPolicy(alias=java.lang.Object.class)
+    public static class A___1 {
+
+        public final native Class<? extends Object> getClass___();
+
+        public native int hashCode();
+
+        public boolean equals(Object obj) {
+            return (this == obj);
+        }
+
+        public static int x;
+        public static int x1;
+        public static int x2;
+        public static int x3;
+        public static int x4;
+        public static int x5;
+
+        protected native Object clone() throws CloneNotSupportedException;
+
+        public String toString() {
+            System.out.println("x=" + (x++));
+            return getClass().getName() + "@" + Integer.toHexString(hashCode());// myTestFunction___();
+        }
+        
+        public final String myTestFunction___() {
+            return "test";
+        }
+
+        public final native void notify___();
+
+        public final native void notifyAll___();
+
+        public final native void wait___(long timeout) throws InterruptedException;
+
+        public final void wait___(long timeout, int nanos) throws InterruptedException {
+
+
+            if (timeout < 0) {
+                throw new IllegalArgumentException("timeout value is negative");
+            }
+
+            if (nanos < 0 || nanos > 999999) {
+                throw new IllegalArgumentException(
+                        "nanosecond timeout value out of range");
+            }
+
+            if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {
+                timeout++;
+            }
+
+            wait(timeout);
+        }
+
+        public final void wait___() throws InterruptedException {
+            wait(0);
+        }
+
+        protected void finalize() throws Throwable {
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(RedefineObjectClassTest.class, 0);
+    }
+
+    @Test
+    public void testRedefineObject() {
+
+        assert HotSwapTool.getCurrentVersion(RedefineObjectClassTest.class) == 0;
+
+        Object o = new Object();
+        HotSwapTool.toVersion(RedefineObjectClassTest.class, 1);
+
+        System.out.println(this.toString());
+        System.out.println(o.toString());
+        System.out.println(this.toString());
+        
+
+        //assertEquals("test", o.toString());
+        assertEquals("test", Helper.access(o));
+        HotSwapTool.toVersion(RedefineObjectClassTest.class, 0);
+        HotSwapTool.toVersion(RedefineObjectClassTest.class, 1);
+        HotSwapTool.toVersion(RedefineObjectClassTest.class, 0);
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/StructuralTestSuite.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/StructuralTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.structural;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Class redefinition tests that do arbitrary structural changes.
+ *
+ * TODO: Add a test where redefinition triggers classloading (e.g. because a super type is not yet loaded).
+ * 
+ * @author Thomas Wuerthinger
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    RedefineClassClassTest.class,
+    RedefineObjectClassTest.class,
+    GeometryScenario.class,
+    HierarchySwapTest.class,
+    InterfaceTest.class,
+    LargeHierarchyTest.class,
+    ThisTypeChange.class,
+    TypeNarrowingHeapTest.class,
+    TypeNarrowingMethodTest.class,
+    TypeNarrowingMethodTest2.class,
+    TypeNarrowingMethodTest3.class
+})
+public class StructuralTestSuite {
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/ThisTypeChange.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/ThisTypeChange.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.structural;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.TestUtil;
+
+/**
+ * Tests that change the type of the object references by the Java this pointer.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class ThisTypeChange {
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(ThisTypeChange.class, 0);
+    }
+
+    // Version 0
+    public static class A {
+
+        public int valueOK() {
+            return 1;
+        }
+
+        public int value() {
+            HotSwapTool.toVersion(ThisTypeChange.class, 1);
+            return 1;
+        }
+    }
+
+    public static class B extends A {
+
+        @Override
+        public int value() {
+            return super.value();
+        }
+
+
+        @Override
+        public int valueOK() {
+            HotSwapTool.toVersion(ThisTypeChange.class, 1);
+            return super.valueOK();
+        }
+    }
+
+    // Version 1
+    public static class A___1 {
+
+        public int valueOK() {
+            return 2;
+        }
+    }
+
+    // Version 1
+    public static class B___1 {
+    }
+    
+    // Method to enforce cast (otherwise bytecodes become invalid in version 2)
+    public static A convertBtoA(Object b) {
+        return (A)b;
+    }
+
+    @Test
+    public void testThisTypeChange() {
+
+        assert HotSwapTool.getCurrentVersion(ThisTypeChange.class) == 0;
+
+        final B b = new B();
+        TestUtil.assertException(UnsupportedOperationException.class, new Runnable() {
+            @Override
+            public void run() {
+                b.value();
+            }
+        });
+
+        assert HotSwapTool.getCurrentVersion(ThisTypeChange.class) == 0;
+
+        TestUtil.assertException(UnsupportedOperationException.class, new Runnable() {
+            @Override
+            public void run() {
+                b.valueOK();
+            }
+        });
+
+        assert HotSwapTool.getCurrentVersion(ThisTypeChange.class) == 0;
+
+        TestUtil.assertException(UnsupportedOperationException.class, new Runnable() {
+            @Override
+            public void run() {
+                b.valueOK();
+            }
+        });
+
+        assert HotSwapTool.getCurrentVersion(ThisTypeChange.class) == 0;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/TypeNarrowingHeapTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/TypeNarrowingHeapTest.java	Fri Dec 17 13:23:04 2010 +0100
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package at.ssw.hotswap.test.structural;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import at.ssw.hotswap.HotSwapTool;
+import at.ssw.hotswap.test.TestUtil;
+
+/**
+ * Test case for type narrowing.
+ *
+ * @author Thomas Wuerthinger
+ */
+public class TypeNarrowingHeapTest {
+
+    // Version 0
+    public static class A {
+
+        int x = 1;
+        int y = 2;
+        int z = 3;
+
+        public int value() {
+            return x;
+        }
+    }
+
+    public static class C {
+        private A a;
+
+        public C(A a) {
+            this.a = a;
+        }
+    }
+
+    public static class B extends A {
+
+    }
+
+
+    // Version 1
+    public static class B___1 {
+    }
+
+
+    @Before
+    public void setUp() throws Exception {
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 0);
+        A a = new A();
+        B b = new B();
+    }
+
+    @Test
+    public void testSimpleTypeNarrowing() {
+
+        assert HotSwapTool.getCurrentVersion(TypeNarrowingHeapTest.class) == 0;
+
+        A a = convertBtoA(new B());
+
+        assertEquals(1, a.value());
+
+        // Cannot do conversion if A object is on the stack!
+        a = null;
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 1);
+
+        TestUtil.assertException(NoSuchMethodError.class, new Runnable() {
+            @Override
+            public void run() {
+                B b = new B();
+                b.value();
+            }
+        });
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 0);
+        assert HotSwapTool.getCurrentVersion(TypeNarrowingHeapTest.class) == 0;
+    }
+
+    @Test
+    public void testTypeNarrowingWithField() {
+        C c = new C(new A());
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 1);
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 0);
+
+        c = new C(convertBtoA(new B()));
+
+        TestUtil.assertException(UnsupportedOperationException.class, new Runnable() {
+            @Override
+            public void run() {
+                HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 1);
+            }
+        });
+
+        assert HotSwapTool.getCurrentVersion(TypeNarrowingHeapTest.class) == 0;
+
+        c.a = null;
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 1);
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 0);
+    }
+    
+    // Method to enforce cast (otherwise bytecodes become invalid in version 2)
+    public static A convertBtoA(Object b) {
+        return (A)b;
+    }
+
+    @Test
+    public void testTypeNarrowingWithArray() {
+        final B b = new B();
+        final A[] arr = new A[3];
+        arr[0] = new A();
+
+        assert b instanceof A;
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 1);
+
+        assert !(b instanceof A);
+
+        TestUtil.assertException(ArrayStoreException.class, new Runnable() {
+            @Override
+            public void run() {
+                arr[1] = b;
+            }
+        });
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 0);
+
+        arr[1] = new B();
+
+        TestUtil.assertException(UnsupportedOperationException.class, new Runnable() {
+            @Override
+            public void run() {
+                HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 1);
+            }
+        });
+
+        assert HotSwapTool.getCurrentVersion(TypeNarrowingHeapTest.class) == 0;
+
+        assert b instanceof A;
+
+        arr[1] = new A();
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 1);
+
+        assert !(b instanceof A);
+
+        HotSwapTool.toVersion(TypeNarrowingHeapTest.class, 0);
+
+        assert b instanceof A;
+    }
+}
diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/structural/TypeNarrowingMethodTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000