1 diff -r f5603a6e5042 .hgignore
2 --- a/.hgignore Wed Nov 17 22:42:08 2010 -0800
3 +++ b/.hgignore Fri Dec 17 13:23:04 2010 +0100
8 -^src/share/tools/hsdis/build/
9 -^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
10 -^src/share/tools/IdealGraphVisualizer/build/
11 -^src/share/tools/IdealGraphVisualizer/dist/
21 +^src/share/tools/hsdis/build/
36 +^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
37 +^src/share/tools/IdealGraphVisualizer/build/
38 +^src/share/tools/IdealGraphVisualizer/dist/
39 diff -r f5603a6e5042 .hgtags
40 --- a/.hgtags Wed Nov 17 22:42:08 2010 -0800
41 +++ b/.hgtags Fri Dec 17 13:23:04 2010 +0100
43 806d0c037e6bbb88dac0699673f4ba55ee8c02da jdk7-b117
44 698b7b727e12de44139d8cca6ab9a494ead13253 jdk7-b118
45 3ef7426b4deac5dcfd4afb35cabe9ab3d666df91 hs20-b02
46 +946201493cab53f518c55272b6f27517a0ba4e0e build 0.1-b01
47 +4425fe0d7f0ec7f8583ae687f7eb1b4a3e94ea09 build 0.1-b02
48 +0c5e4a085baa8aaa9aed55b20810de4bdc2d6548 build 0.2-b01
49 +34520cf6c532e28f529340f66f71855aadf83d95 build 0.2-b02
50 diff -r f5603a6e5042 build.cmd
51 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52 +++ b/build.cmd Fri Dec 17 13:23:04 2010 +0100
54 +set HotSpotMksHome=C:\Cygwin\bin
55 +set path=%JAVA_HOME%;C:\Cygwin\bin
56 +call "%VS_VCVARS%\vsvars32.bat"
61 +call build.bat product compiler1 %OrigPath% %JAVA_HOME%
62 +call build.bat fastdebug compiler1 %OrigPath% %JAVA_HOME%
66 diff -r f5603a6e5042 create.cmd
67 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68 +++ b/create.cmd Fri Dec 17 13:23:04 2010 +0100
70 +set HotSpotMksHome=C:\Cygwin\bin
71 +set path=%JAVA_HOME%\bin;C:\Cygwin\bin
72 +call "%VS_VCVARS%\vsvars32.bat"
77 +mkdir %OrigPath%\work
78 +call create.bat %OrigPath% %OrigPath%\work %OrigPath%\java
82 diff -r f5603a6e5042 create64.cmd
83 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
84 +++ b/create64.cmd Fri Dec 17 13:23:04 2010 +0100
86 +set HotSpotMksHome=C:\cygwin\bin
87 +set JAVA_HOME=%cd%\java64
89 +set path=%JAVA_HOME%\bin;%path%;C:\cygwin\bin
94 +mkdir %OrigPath%\work64
95 +call create.bat %OrigPath% %OrigPath%\work64 %OrigPath%\java64
100 diff -r f5603a6e5042 create_installers.cmd
101 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
102 +++ b/create_installers.cmd Fri Dec 17 13:23:04 2010 +0100
104 +copy hotswapinstaller\Installer\dist\Installer.jar dcevm-mac.jar
105 +jar uvf dcevm-mac.jar -C hotswapbinaries\mac\ .
106 +jar uvf dcevm-mac.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
108 +copy hotswapinstaller\Installer\dist\Installer.jar dcevm-win.jar
109 +jar uvf dcevm-win.jar -C hotswapbinaries\win\ .
110 +jar uvf dcevm-win.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
112 +copy hotswapinstaller\Installer\dist\Installer.jar dcevm-linux.jar
113 +jar uvf dcevm-linux.jar -C hotswapbinaries\linux\ .
114 +jar uvf dcevm-linux.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
115 \ No newline at end of file
116 diff -r f5603a6e5042 create_installers.sh
117 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
118 +++ b/create_installers.sh Fri Dec 17 13:23:04 2010 +0100
120 +cp hotswapinstaller/Installer/dist/Installer.jar dcevm-mac.jar
121 +jar uvf dcevm-mac.jar -C hotswapbinaries/mac/ .
122 +jar uvf dcevm-mac.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
124 +cp hotswapinstaller/Installer/dist/Installer.jar dcevm-win.jar
125 +jar uvf dcevm-win.jar -C hotswapbinaries/win/ .
126 +jar uvf dcevm-win.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
128 +cp hotswapinstaller/Installer/dist/Installer.jar dcevm-linux.jar
129 +jar uvf dcevm-linux.jar -C hotswapbinaries/linux/ .
130 +jar uvf dcevm-linux.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
131 diff -r f5603a6e5042 create_patch_vm_only.cmd
132 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
133 +++ b/create_patch_vm_only.cmd Fri Dec 17 13:23:04 2010 +0100
135 +hg diff -r 2039 -X hotswapdoc -X hotswaptest -X hotswapinstaller -X create_patch.cmd -X create_patch_vm_only.cmd >hotswapping_patch_vm_only
136 \ No newline at end of file
137 diff -r f5603a6e5042 hotswapbinaries/README
138 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
139 +++ b/hotswapbinaries/README Fri Dec 17 13:23:04 2010 +0100
141 +The binary files are not stored in the mercurial repository, because they would bloat the repository size. The expected files in this subdirectory are:
143 +==========================================
145 +win/data/64/bin/server/jvm.dll
146 +win/data/bin/client/jvm.dll
147 +win/data/bin/server/jvm.dll
149 +==========================================
151 +mac/data/lib/i386/client/libjvm.dylib
152 +mac/data/lib/i386/server/libjvm.dylib
154 +==========================================
156 +linux/data/64/lib/amd64/server/libjvm.so
157 +linux/data/lib/i386/client/libjvm.so
158 +linux/data/lib/i386/server/libjvm.so
159 diff -r f5603a6e5042 hotswapinstaller/Installer/build.xml
160 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
161 +++ b/hotswapinstaller/Installer/build.xml Fri Dec 17 13:23:04 2010 +0100
163 +<?xml version="1.0" encoding="UTF-8"?>
164 +<!-- You may freely edit this file. See commented blocks below for -->
165 +<!-- some examples of how to customize the build. -->
166 +<!-- (If you delete it and reopen the project it will be recreated.) -->
167 +<!-- By default, only the Clean and Build commands use this build script. -->
168 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
169 +<!-- the Compile on Save feature is turned off for the project. -->
170 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
171 +<!-- in the project's Project Properties dialog box.-->
172 +<project name="Installer" default="default" basedir=".">
173 + <description>Builds, tests, and runs the project Installer.</description>
174 + <import file="nbproject/build-impl.xml"/>
175 + <target name="-post-compile">
176 + <property name="hotswapvm.dir" value="${build.classes.dir}/../../../.."/>
178 + <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/bin/client/jvm.dll" tofile="${build.classes.dir}/data/bin/client/jvm.dll"/>
179 + <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/bin/server/jvm.dll" tofile="${build.classes.dir}/data/bin/server/jvm.dll"/>
180 + <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/64/bin/server/jvm.dll" tofile="${build.classes.dir}/data/64/bin/server/jvm.dll"/>
181 + <copy file="${hotswapvm.dir}/hotswapbinaries/mac/data/lib/i386/client/libjvm.dylib" tofile="${build.classes.dir}/data/lib/i386/client/libjvm.dylib"/>
182 + <copy file="${hotswapvm.dir}/hotswapbinaries/mac/data/lib/i386/server/libjvm.dylib" tofile="${build.classes.dir}/data/lib/i386/server/libjvm.dylib"/>
186 + <jar destfile="dist/data/dcevm.jar">
188 + <attribute name="Premain-Class" value="at.ssw.mixin.MixinAgent"/>
189 + <attribute name="Can-Retransform-Classes" value="true"/>
191 + <zipfileset src="${hotswapvm.dir}/hotswaptest/HotSwapTool/dist/HotSwapTool.jar" />
192 + <zipfileset src="${hotswapvm.dir}/../Mixin/Mixin/dist/Mixin.jar" />
193 + <zipfileset src="${hotswapvm.dir}/../Mixin/Mixin/dist/lib/asm-all-3.3.jar" />
199 + There exist several targets which are by default empty and which can be
200 + used for execution of your tasks. These targets are usually executed
201 + before and after some main targets. They are:
203 + -pre-init: called before initialization of project properties
204 + -post-init: called after initialization of project properties
205 + -pre-compile: called before javac compilation
206 + -post-compile: called after javac compilation
207 + -pre-compile-single: called before javac compilation of single file
208 + -post-compile-single: called after javac compilation of single file
209 + -pre-compile-test: called before javac compilation of JUnit tests
210 + -post-compile-test: called after javac compilation of JUnit tests
211 + -pre-compile-test-single: called before javac compilation of single JUnit test
212 + -post-compile-test-single: called after javac compilation of single JUunit test
213 + -pre-jar: called before JAR building
214 + -post-jar: called after JAR building
215 + -post-clean: called after cleaning build products
217 + (Targets beginning with '-' are not intended to be called on their own.)
219 + Example of inserting an obfuscator after compilation could look like this:
221 + <target name="-post-compile">
223 + <fileset dir="${build.classes.dir}"/>
227 + For list of available properties check the imported
228 + nbproject/build-impl.xml file.
231 + Another way to customize the build is by overriding existing main targets.
232 + The targets of interest are:
234 + -init-macrodef-javac: defines macro for javac compilation
235 + -init-macrodef-junit: defines macro for junit execution
236 + -init-macrodef-debug: defines macro for class debugging
237 + -init-macrodef-java: defines macro for class execution
238 + -do-jar-with-manifest: JAR building (if you are using a manifest)
239 + -do-jar-without-manifest: JAR building (if you are not using a manifest)
240 + run: execution of project
241 + -javadoc-build: Javadoc generation
242 + test-report: JUnit report generation
244 + An example of overriding the target for project execution could look like this:
246 + <target name="run" depends="Installer-impl.jar">
247 + <exec dir="bin" executable="launcher.exe">
248 + <arg file="${dist.jar}"/>
252 + Notice that the overridden target depends on the jar target and not only on
253 + the compile target as the regular run target does. Again, for a list of available
254 + properties which you can use, check the target you are overriding in the
255 + nbproject/build-impl.xml file.
259 diff -r f5603a6e5042 hotswapinstaller/Installer/manifest.mf
260 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
261 +++ b/hotswapinstaller/Installer/manifest.mf Fri Dec 17 13:23:04 2010 +0100
263 +Manifest-Version: 1.0
264 +X-COMMENT: Main-Class will be added automatically by build
266 diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/build-impl.xml
267 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
268 +++ b/hotswapinstaller/Installer/nbproject/build-impl.xml Fri Dec 17 13:23:04 2010 +0100
270 +<?xml version="1.0" encoding="UTF-8"?>
272 +*** GENERATED FROM project.xml - DO NOT EDIT ***
273 +*** EDIT ../build.xml INSTEAD ***
275 +For the purpose of easier reading the script
276 +is divided into following sections:
284 + - junit compilation
291 +<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">
292 + <fail message="Please build using Ant 1.7.1 or higher.">
295 + <antversion atleast="1.7.1"/>
299 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
301 + ======================
302 + INITIALIZATION SECTION
303 + ======================
305 + <target name="-pre-init">
306 + <!-- Empty placeholder for easier customization. -->
307 + <!-- You can override this target in the ../build.xml file. -->
309 + <target depends="-pre-init" name="-init-private">
310 + <property file="nbproject/private/config.properties"/>
311 + <property file="nbproject/private/configs/${config}.properties"/>
312 + <property file="nbproject/private/private.properties"/>
314 + <target depends="-pre-init,-init-private" name="-init-user">
315 + <property file="${user.properties.file}"/>
316 + <!-- The two properties below are usually overridden -->
317 + <!-- by the active platform. Just a fallback. -->
318 + <property name="default.javac.source" value="1.4"/>
319 + <property name="default.javac.target" value="1.4"/>
321 + <target depends="-pre-init,-init-private,-init-user" name="-init-project">
322 + <property file="nbproject/configs/${config}.properties"/>
323 + <property file="nbproject/project.properties"/>
325 + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
326 + <available file="${manifest.file}" property="manifest.available"/>
327 + <available file="${application.splash}" property="splashscreen.available"/>
328 + <condition property="main.class.available">
330 + <isset property="main.class"/>
332 + <equals arg1="${main.class}" arg2="" trim="true"/>
336 + <condition property="manifest.available+main.class">
338 + <isset property="manifest.available"/>
339 + <isset property="main.class.available"/>
342 + <condition property="do.mkdist">
344 + <isset property="libs.CopyLibs.classpath"/>
346 + <istrue value="${mkdist.disabled}"/>
350 + <condition property="manifest.available+main.class+mkdist.available">
352 + <istrue value="${manifest.available+main.class}"/>
353 + <isset property="do.mkdist"/>
356 + <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
358 + <istrue value="${manifest.available+main.class+mkdist.available}"/>
359 + <istrue value="${splashscreen.available}"/>
362 + <condition property="do.archive">
364 + <istrue value="${jar.archive.disabled}"/>
367 + <condition property="do.archive+manifest.available">
369 + <isset property="manifest.available"/>
370 + <istrue value="${do.archive}"/>
373 + <condition property="do.archive+manifest.available+main.class">
375 + <istrue value="${manifest.available+main.class}"/>
376 + <istrue value="${do.archive}"/>
379 + <condition property="do.archive+manifest.available+main.class+mkdist.available">
381 + <istrue value="${manifest.available+main.class+mkdist.available}"/>
382 + <istrue value="${do.archive}"/>
385 + <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
387 + <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
388 + <istrue value="${do.archive}"/>
391 + <condition property="have.tests">
393 + <available file="${test.src.dir}"/>
396 + <condition property="have.sources">
398 + <available file="${src.dir}"/>
401 + <condition property="netbeans.home+have.tests">
403 + <isset property="netbeans.home"/>
404 + <isset property="have.tests"/>
407 + <condition property="no.javadoc.preview">
409 + <isset property="javadoc.preview"/>
410 + <isfalse value="${javadoc.preview}"/>
413 + <property name="run.jvmargs" value=""/>
414 + <property name="javac.compilerargs" value=""/>
415 + <property name="work.dir" value="${basedir}"/>
416 + <condition property="no.deps">
418 + <istrue value="${no.dependencies}"/>
421 + <property name="javac.debug" value="true"/>
422 + <property name="javadoc.preview" value="true"/>
423 + <property name="application.args" value=""/>
424 + <property name="source.encoding" value="${file.encoding}"/>
425 + <property name="runtime.encoding" value="${source.encoding}"/>
426 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
428 + <isset property="javadoc.encoding"/>
430 + <equals arg1="${javadoc.encoding}" arg2=""/>
434 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
435 + <property name="includes" value="**"/>
436 + <property name="excludes" value=""/>
437 + <property name="do.depend" value="false"/>
438 + <condition property="do.depend.true">
439 + <istrue value="${do.depend}"/>
441 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
442 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
443 + <length length="0" string="${endorsed.classpath}" when="greater"/>
445 + <property name="javac.fork" value="false"/>
446 + <property name="jar.index" value="false"/>
447 + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
449 + <target name="-post-init">
450 + <!-- Empty placeholder for easier customization. -->
451 + <!-- You can override this target in the ../build.xml file. -->
453 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
454 + <fail unless="src.dir">Must set src.dir</fail>
455 + <fail unless="test.src.dir">Must set test.src.dir</fail>
456 + <fail unless="build.dir">Must set build.dir</fail>
457 + <fail unless="dist.dir">Must set dist.dir</fail>
458 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
459 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
460 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
461 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
462 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
463 + <fail unless="dist.jar">Must set dist.jar</fail>
465 + <target name="-init-macrodef-property">
466 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
467 + <attribute name="name"/>
468 + <attribute name="value"/>
470 + <property name="@{name}" value="${@{value}}"/>
474 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
475 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
476 + <attribute default="${src.dir}" name="srcdir"/>
477 + <attribute default="${build.classes.dir}" name="destdir"/>
478 + <attribute default="${javac.classpath}" name="classpath"/>
479 + <attribute default="${javac.processorpath}" name="processorpath"/>
480 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
481 + <attribute default="${includes}" name="includes"/>
482 + <attribute default="${excludes}" name="excludes"/>
483 + <attribute default="${javac.debug}" name="debug"/>
484 + <attribute default="${empty.dir}" name="sourcepath"/>
485 + <attribute default="${empty.dir}" name="gensrcdir"/>
486 + <element name="customize" optional="true"/>
488 + <property location="${build.dir}/empty" name="empty.dir"/>
489 + <mkdir dir="${empty.dir}"/>
490 + <mkdir dir="@{apgeneratedsrcdir}"/>
491 + <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}">
493 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
494 + <include name="*"/>
498 + <path path="@{classpath}"/>
500 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
501 + <compilerarg line="${javac.compilerargs}"/>
502 + <compilerarg value="-processorpath"/>
503 + <compilerarg path="@{processorpath}:${empty.dir}"/>
504 + <compilerarg line="${ap.processors.internal}"/>
505 + <compilerarg line="${annotation.processing.processor.options}"/>
506 + <compilerarg value="-s"/>
507 + <compilerarg path="@{apgeneratedsrcdir}"/>
508 + <compilerarg line="${ap.proc.none.internal}"/>
514 + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
515 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
516 + <attribute default="${src.dir}" name="srcdir"/>
517 + <attribute default="${build.classes.dir}" name="destdir"/>
518 + <attribute default="${javac.classpath}" name="classpath"/>
519 + <attribute default="${javac.processorpath}" name="processorpath"/>
520 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
521 + <attribute default="${includes}" name="includes"/>
522 + <attribute default="${excludes}" name="excludes"/>
523 + <attribute default="${javac.debug}" name="debug"/>
524 + <attribute default="${empty.dir}" name="sourcepath"/>
525 + <attribute default="${empty.dir}" name="gensrcdir"/>
526 + <element name="customize" optional="true"/>
528 + <property location="${build.dir}/empty" name="empty.dir"/>
529 + <mkdir dir="${empty.dir}"/>
530 + <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}">
532 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
533 + <include name="*"/>
537 + <path path="@{classpath}"/>
539 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
540 + <compilerarg line="${javac.compilerargs}"/>
546 + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
547 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
548 + <attribute default="${src.dir}" name="srcdir"/>
549 + <attribute default="${build.classes.dir}" name="destdir"/>
550 + <attribute default="${javac.classpath}" name="classpath"/>
552 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
554 + <path path="@{classpath}"/>
559 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
560 + <attribute default="${build.classes.dir}" name="destdir"/>
562 + <fail unless="javac.includes">Must set javac.includes</fail>
563 + <pathconvert pathsep="," property="javac.includes.binary">
565 + <filelist dir="@{destdir}" files="${javac.includes}"/>
567 + <globmapper from="*.java" to="*.class"/>
570 + <files includes="${javac.includes.binary}"/>
575 + <target name="-init-macrodef-junit">
576 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
577 + <attribute default="${includes}" name="includes"/>
578 + <attribute default="${excludes}" name="excludes"/>
579 + <attribute default="**" name="testincludes"/>
581 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
582 + <batchtest todir="${build.test.results.dir}">
583 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
584 + <filename name="@{testincludes}"/>
588 + <path path="${run.test.classpath}"/>
591 + <propertyref prefix="test-sys-prop."/>
592 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
594 + <formatter type="brief" usefile="false"/>
595 + <formatter type="xml"/>
596 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
597 + <jvmarg line="${run.jvmargs}"/>
602 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
603 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
604 + <attribute default="${main.class}" name="name"/>
605 + <attribute default="${debug.classpath}" name="classpath"/>
606 + <attribute default="" name="stopclassname"/>
608 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
610 + <path path="@{classpath}"/>
615 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
616 + <attribute default="${build.classes.dir}" name="dir"/>
619 + <fileset dir="@{dir}" includes="${fix.classes}">
620 + <include name="${fix.includes}*.class"/>
626 + <target name="-init-debug-args">
627 + <property name="version-output" value="java version "${ant.java.version}"/>
628 + <condition property="have-jdk-older-than-1.4">
630 + <contains string="${version-output}" substring="java version "1.0"/>
631 + <contains string="${version-output}" substring="java version "1.1"/>
632 + <contains string="${version-output}" substring="java version "1.2"/>
633 + <contains string="${version-output}" substring="java version "1.3"/>
636 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
637 + <istrue value="${have-jdk-older-than-1.4}"/>
639 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
640 + <os family="windows"/>
642 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
643 + <isset property="debug.transport"/>
646 + <target depends="-init-debug-args" name="-init-macrodef-debug">
647 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
648 + <attribute default="${main.class}" name="classname"/>
649 + <attribute default="${debug.classpath}" name="classpath"/>
650 + <element name="customize" optional="true"/>
652 + <java classname="@{classname}" dir="${work.dir}" fork="true">
653 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
654 + <jvmarg line="${debug-args-line}"/>
655 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
656 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
657 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
658 + <jvmarg line="${run.jvmargs}"/>
660 + <path path="@{classpath}"/>
663 + <propertyref prefix="run-sys-prop."/>
664 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
671 + <target name="-init-macrodef-java">
672 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
673 + <attribute default="${main.class}" name="classname"/>
674 + <attribute default="${run.classpath}" name="classpath"/>
675 + <element name="customize" optional="true"/>
677 + <java classname="@{classname}" dir="${work.dir}" fork="true">
678 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
679 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
680 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
681 + <jvmarg line="${run.jvmargs}"/>
683 + <path path="@{classpath}"/>
686 + <propertyref prefix="run-sys-prop."/>
687 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
694 + <target name="-init-macrodef-copylibs">
695 + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
696 + <element name="customize" optional="true"/>
698 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
699 + <pathconvert property="run.classpath.without.build.classes.dir">
700 + <path path="${run.classpath}"/>
701 + <map from="${build.classes.dir.resolved}" to=""/>
703 + <pathconvert pathsep=" " property="jar.classpath">
704 + <path path="${run.classpath.without.build.classes.dir}"/>
707 + <globmapper from="*" to="lib/*"/>
710 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
711 + <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
712 + <fileset dir="${build.classes.dir}"/>
714 + <attribute name="Class-Path" value="${jar.classpath}"/>
721 + <target name="-init-presetdef-jar">
722 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
723 + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
724 + <j2seproject1:fileset dir="${build.classes.dir}"/>
728 + <target name="-init-ap-cmdline-properties">
729 + <property name="annotation.processing.enabled" value="true"/>
730 + <property name="annotation.processing.processors.list" value=""/>
731 + <property name="annotation.processing.processor.options" value=""/>
732 + <property name="annotation.processing.run.all.processors" value="true"/>
733 + <property name="javac.processorpath" value="${javac.classpath}"/>
734 + <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
735 + <condition property="ap.supported.internal" value="true">
737 + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
741 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
742 + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
743 + <isfalse value="${annotation.processing.run.all.processors}"/>
745 + <condition else="" property="ap.proc.none.internal" value="-proc:none">
746 + <isfalse value="${annotation.processing.enabled}"/>
749 + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
750 + <property name="ap.cmd.line.internal" value=""/>
752 + <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"/>
754 + ===================
755 + COMPILATION SECTION
756 + ===================
758 + <target name="-deps-jar-init" unless="built-jar.properties">
759 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
760 + <delete file="${built-jar.properties}" quiet="true"/>
762 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
763 + <echo level="warn" message="Cycle detected: Installer was already built"/>
765 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
766 + <mkdir dir="${build.dir}"/>
767 + <touch file="${built-jar.properties}" verbose="false"/>
768 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
769 + <antcall target="-warn-already-built-jar"/>
770 + <propertyfile file="${built-jar.properties}">
771 + <entry key="${basedir}" value=""/>
774 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
775 + <target depends="init" name="-check-automatic-build">
776 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
778 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
779 + <antcall target="clean"/>
781 + <target depends="init,deps-jar" name="-pre-pre-compile">
782 + <mkdir dir="${build.classes.dir}"/>
784 + <target name="-pre-compile">
785 + <!-- Empty placeholder for easier customization. -->
786 + <!-- You can override this target in the ../build.xml file. -->
788 + <target if="do.depend.true" name="-compile-depend">
789 + <pathconvert property="build.generated.subdirs">
790 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
791 + <include name="*"/>
794 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
796 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
797 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
798 + <copy todir="${build.classes.dir}">
799 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
802 + <target if="has.persistence.xml" name="-copy-persistence-xml">
803 + <mkdir dir="${build.classes.dir}/META-INF"/>
804 + <copy todir="${build.classes.dir}/META-INF">
805 + <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
808 + <target name="-post-compile">
809 + <!-- Empty placeholder for easier customization. -->
810 + <!-- You can override this target in the ../build.xml file. -->
812 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
813 + <target name="-pre-compile-single">
814 + <!-- Empty placeholder for easier customization. -->
815 + <!-- You can override this target in the ../build.xml file. -->
817 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
818 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
819 + <j2seproject3:force-recompile/>
820 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
822 + <target name="-post-compile-single">
823 + <!-- Empty placeholder for easier customization. -->
824 + <!-- You can override this target in the ../build.xml file. -->
826 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
828 + ====================
829 + JAR BUILDING SECTION
830 + ====================
832 + <target depends="init" name="-pre-pre-jar">
833 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
834 + <mkdir dir="${dist.jar.dir}"/>
836 + <target name="-pre-jar">
837 + <!-- Empty placeholder for easier customization. -->
838 + <!-- You can override this target in the ../build.xml file. -->
840 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
841 + <j2seproject1:jar/>
843 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
844 + <j2seproject1:jar manifest="${manifest.file}"/>
846 + <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">
847 + <j2seproject1:jar manifest="${manifest.file}">
848 + <j2seproject1:manifest>
849 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
850 + </j2seproject1:manifest>
851 + </j2seproject1:jar>
852 + <echo>To run this application from the command line without Ant, try:</echo>
853 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
854 + <property location="${dist.jar}" name="dist.jar.resolved"/>
855 + <pathconvert property="run.classpath.with.dist.jar">
856 + <path path="${run.classpath}"/>
857 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
859 + <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
861 + <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">
862 + <basename file="${application.splash}" property="splashscreen.basename"/>
863 + <mkdir dir="${build.classes.dir}/META-INF"/>
864 + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
865 + <j2seproject3:copylibs>
867 + <attribute name="Main-Class" value="${main.class}"/>
868 + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
870 + </j2seproject3:copylibs>
871 + <echo>To run this application from the command line without Ant, try:</echo>
872 + <property location="${dist.jar}" name="dist.jar.resolved"/>
873 + <echo>java -jar "${dist.jar.resolved}"</echo>
875 + <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">
876 + <j2seproject3:copylibs>
878 + <attribute name="Main-Class" value="${main.class}"/>
880 + </j2seproject3:copylibs>
881 + <echo>To run this application from the command line without Ant, try:</echo>
882 + <property location="${dist.jar}" name="dist.jar.resolved"/>
883 + <echo>java -jar "${dist.jar.resolved}"</echo>
885 + <target name="-post-jar">
886 + <!-- Empty placeholder for easier customization. -->
887 + <!-- You can override this target in the ../build.xml file. -->
889 + <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"/>
895 + <target depends="init,compile" description="Run a main class." name="run">
896 + <j2seproject1:java>
898 + <arg line="${application.args}"/>
900 + </j2seproject1:java>
902 + <target name="-do-not-recompile">
903 + <property name="javac.includes.binary" value=""/>
905 + <target depends="init,compile-single" name="run-single">
906 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
907 + <j2seproject1:java classname="${run.class}"/>
909 + <target depends="init,compile-test-single" name="run-test-with-main">
910 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
911 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
918 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
919 + <j2seproject1:nbjpdastart name="${debug.class}"/>
921 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
922 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
924 + <target depends="init,compile" name="-debug-start-debuggee">
925 + <j2seproject3:debug>
927 + <arg line="${application.args}"/>
929 + </j2seproject3:debug>
931 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
932 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
933 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
935 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
936 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
937 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
938 + <j2seproject3:debug classname="${debug.class}"/>
940 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
941 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
942 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
943 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
945 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
946 + <target depends="init" name="-pre-debug-fix">
947 + <fail unless="fix.includes">Must set fix.includes</fail>
948 + <property name="javac.includes" value="${fix.includes}.java"/>
950 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
951 + <j2seproject1:nbjpdareload/>
953 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
959 + <target depends="init" if="have.sources" name="-javadoc-build">
960 + <mkdir dir="${dist.javadoc.dir}"/>
961 + <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}">
963 + <path path="${javac.classpath}"/>
965 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
966 + <filename name="**/*.java"/>
968 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
969 + <include name="**/*.java"/>
973 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
974 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
976 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
978 + =========================
979 + JUNIT COMPILATION SECTION
980 + =========================
982 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
983 + <mkdir dir="${build.test.classes.dir}"/>
985 + <target name="-pre-compile-test">
986 + <!-- Empty placeholder for easier customization. -->
987 + <!-- You can override this target in the ../build.xml file. -->
989 + <target if="do.depend.true" name="-compile-test-depend">
990 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
992 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
993 + <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}"/>
994 + <copy todir="${build.test.classes.dir}">
995 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
998 + <target name="-post-compile-test">
999 + <!-- Empty placeholder for easier customization. -->
1000 + <!-- You can override this target in the ../build.xml file. -->
1002 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
1003 + <target name="-pre-compile-test-single">
1004 + <!-- Empty placeholder for easier customization. -->
1005 + <!-- You can override this target in the ../build.xml file. -->
1007 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
1008 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
1009 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
1010 + <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}"/>
1011 + <copy todir="${build.test.classes.dir}">
1012 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
1015 + <target name="-post-compile-test-single">
1016 + <!-- Empty placeholder for easier customization. -->
1017 + <!-- You can override this target in the ../build.xml file. -->
1019 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
1021 + =======================
1022 + JUNIT EXECUTION SECTION
1023 + =======================
1025 + <target depends="init" if="have.tests" name="-pre-test-run">
1026 + <mkdir dir="${build.test.results.dir}"/>
1028 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
1029 + <j2seproject3:junit testincludes="**/*Test.java"/>
1031 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
1032 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
1034 + <target depends="init" if="have.tests" name="test-report"/>
1035 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
1036 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
1037 + <target depends="init" if="have.tests" name="-pre-test-run-single">
1038 + <mkdir dir="${build.test.results.dir}"/>
1040 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
1041 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
1042 + <j2seproject3:junit excludes="" includes="${test.includes}"/>
1044 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
1045 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
1047 + <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"/>
1049 + =======================
1050 + JUNIT DEBUGGING SECTION
1051 + =======================
1053 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
1054 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
1055 + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
1056 + <delete file="${test.report.file}"/>
1057 + <mkdir dir="${build.test.results.dir}"/>
1058 + <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}">
1061 + <propertyref prefix="test-sys-prop."/>
1062 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
1064 + <arg value="${test.class}"/>
1065 + <arg value="showoutput=true"/>
1066 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
1067 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
1069 + </j2seproject3:debug>
1071 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
1072 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
1074 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
1075 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
1076 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
1078 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
1080 + =========================
1081 + APPLET EXECUTION SECTION
1082 + =========================
1084 + <target depends="init,compile-single" name="run-applet">
1085 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
1086 + <j2seproject1:java classname="sun.applet.AppletViewer">
1088 + <arg value="${applet.url}"/>
1090 + </j2seproject1:java>
1093 + =========================
1094 + APPLET DEBUGGING SECTION
1095 + =========================
1097 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
1098 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
1099 + <j2seproject3:debug classname="sun.applet.AppletViewer">
1101 + <arg value="${applet.url}"/>
1103 + </j2seproject3:debug>
1105 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
1111 + <target name="-deps-clean-init" unless="built-clean.properties">
1112 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
1113 + <delete file="${built-clean.properties}" quiet="true"/>
1115 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
1116 + <echo level="warn" message="Cycle detected: Installer was already built"/>
1118 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
1119 + <mkdir dir="${build.dir}"/>
1120 + <touch file="${built-clean.properties}" verbose="false"/>
1121 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
1122 + <antcall target="-warn-already-built-clean"/>
1123 + <propertyfile file="${built-clean.properties}">
1124 + <entry key="${basedir}" value=""/>
1127 + <target depends="init" name="-do-clean">
1128 + <delete dir="${build.dir}"/>
1129 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
1131 + <target name="-post-clean">
1132 + <!-- Empty placeholder for easier customization. -->
1133 + <!-- You can override this target in the ../build.xml file. -->
1135 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
1136 + <target name="-check-call-dep">
1137 + <property file="${call.built.properties}" prefix="already.built."/>
1138 + <condition property="should.call.dep">
1140 + <isset property="already.built.${call.subproject}"/>
1144 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
1145 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
1147 + <propertyref prefix="transfer."/>
1148 + <mapper from="transfer.*" to="*" type="glob"/>
1153 diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/project.properties
1154 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1155 +++ b/hotswapinstaller/Installer/nbproject/project.properties Fri Dec 17 13:23:04 2010 +0100
1157 +build.classes.dir=${build.dir}/classes
1158 +build.classes.excludes=**/*.java,**/*.form
1159 +# This directory is removed when the project is cleaned:
1161 +build.generated.dir=${build.dir}/generated
1162 +build.generated.sources.dir=${build.dir}/generated-sources
1163 +# Only compile against the classpath explicitly listed here:
1164 +build.sysclasspath=ignore
1165 +build.test.classes.dir=${build.dir}/test/classes
1166 +build.test.results.dir=${build.dir}/test/results
1167 +# Uncomment to specify the preferred debugger connection transport:
1168 +#debug.transport=dt_socket
1171 +debug.test.classpath=\
1172 + ${run.test.classpath}
1173 +# This directory is removed when the project is cleaned:
1175 +dist.jar=${dist.dir}/Installer.jar
1176 +dist.javadoc.dir=${dist.dir}/javadoc
1181 +# Space-separated list of extra javac options
1182 +javac.compilerargs=
1183 +javac.deprecation=false
1186 +javac.test.classpath=\
1187 + ${javac.classpath}:\
1188 + ${build.classes.dir}:\
1189 + ${libs.junit.classpath}:\
1190 + ${libs.junit_4.classpath}
1191 +javadoc.additionalparam=
1192 +javadoc.author=false
1193 +javadoc.encoding=${source.encoding}
1194 +javadoc.noindex=false
1195 +javadoc.nonavbar=false
1196 +javadoc.notree=false
1197 +javadoc.private=false
1198 +javadoc.splitindex=true
1200 +javadoc.version=false
1201 +javadoc.windowtitle=
1202 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
1203 +main.class=at.ssw.hotswap.installer.Main
1204 +manifest.file=manifest.mf
1205 +meta.inf.dir=${src.dir}/META-INF
1206 +platform.active=default_platform
1208 + ${javac.classpath}:\
1209 + ${build.classes.dir}
1210 +# Space-separated list of JVM arguments used when running the project
1211 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
1212 +# or test-sys-prop.name=value to set system properties for unit tests):
1214 +run.test.classpath=\
1215 + ${javac.test.classpath}:\
1216 + ${build.test.classes.dir}
1217 +source.encoding=UTF-8
1220 diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/project.xml
1221 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1222 +++ b/hotswapinstaller/Installer/nbproject/project.xml Fri Dec 17 13:23:04 2010 +0100
1224 +<?xml version="1.0" encoding="UTF-8"?>
1225 +<project xmlns="http://www.netbeans.org/ns/project/1">
1226 + <type>org.netbeans.modules.java.j2seproject</type>
1228 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
1229 + <name>Installer</name>
1231 + <root id="src.dir"/>
1234 + <root id="test.src.dir"/>
1239 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installation.java
1240 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1241 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installation.java Fri Dec 17 13:23:04 2010 +0100
1244 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1245 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1247 + * This code is free software; you can redistribute it and/or modify it
1248 + * under the terms of the GNU General Public License version 2 only, as
1249 + * published by the Free Software Foundation.
1251 + * This code is distributed in the hope that it will be useful, but WITHOUT
1252 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1253 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1254 + * version 2 for more details (a copy is included in the LICENSE file that
1255 + * accompanied this code).
1257 + * You should have received a copy of the GNU General Public License version
1258 + * 2 along with this work; if not, write to the Free Software Foundation,
1259 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1261 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1262 + * or visit www.oracle.com if you need additional information or have any
1266 +package at.ssw.hotswap.installer;
1268 +import java.io.File;
1269 +import java.io.IOException;
1270 +import java.util.Observable;
1273 + * @author Kerstin Breiteneder
1274 + * @author Christoph Wimberger
1276 +public class Installation extends Observable {
1278 + private final File file;
1279 + private final boolean isJDK;
1280 + private final Installer installer;
1281 + private boolean installed;
1282 + private String version;
1283 + private String dceVersion;
1284 + private boolean is64Bit;
1286 + public Installation(File f, Installer i) throws InstallerException {
1289 + file = f.getCanonicalFile();
1290 + } catch (IOException ex) {
1291 + throw new InstallerException(f.getAbsolutePath() + " is no JRE or JDK-directory.");
1293 + isJDK = installer.isJDK(file);
1294 + if (!isJDK && !installer.isJRE(file)) {
1295 + throw new InstallerException(f.getAbsolutePath() + " is no JRE or JDK-directory.");
1298 + version = installer.getJavaVersion(file);
1302 + final public void update() throws InstallerException {
1303 + installed = installer.isDCEInstalled(file);
1305 + dceVersion = installer.getDCEVersion(file);
1307 + is64Bit = installer.is64Bit(file);
1310 + public File getPath() {
1314 + public String getVersion() {
1318 + public String getDCEVersion() {
1319 + return dceVersion;
1322 + public boolean isJDK() {
1326 + public boolean is64Bit() {
1330 + public void installDCE() throws InstallerException {
1332 + installer.install(file, is64Bit);
1333 + } catch (InstallerException ex) {
1334 + throw new InstallerException("Could not install DCE to " + file.getAbsolutePath() + ".", ex);
1339 + notifyObservers();
1342 + public void uninstallDCE() throws InstallerException {
1344 + installer.uninstall(file, is64Bit);
1345 + } catch (InstallerException ex) {
1346 + throw new InstallerException("Could not uninstall DCE to " + file.getAbsolutePath() + ".", ex);
1348 + installed = false;
1351 + notifyObservers();
1354 + public boolean isDCEInstalled() {
1359 + public boolean equals(Object obj) {
1360 + if (obj == null) {
1363 + if (getClass() != obj.getClass()) {
1366 + final Installation other = (Installation) obj;
1367 + if (this.file != other.file && (this.file == null || !this.file.equals(other.file))) {
1374 + public int hashCode() {
1376 + hash = 97 * hash + (this.file != null ? this.file.hashCode() : 0);
1380 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installer.java
1381 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1382 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installer.java Fri Dec 17 13:23:04 2010 +0100
1385 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1386 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1388 + * This code is free software; you can redistribute it and/or modify it
1389 + * under the terms of the GNU General Public License version 2 only, as
1390 + * published by the Free Software Foundation.
1392 + * This code is distributed in the hope that it will be useful, but WITHOUT
1393 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1394 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1395 + * version 2 for more details (a copy is included in the LICENSE file that
1396 + * accompanied this code).
1398 + * You should have received a copy of the GNU General Public License version
1399 + * 2 along with this work; if not, write to the Free Software Foundation,
1400 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1402 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1403 + * or visit www.oracle.com if you need additional information or have any
1407 +package at.ssw.hotswap.installer;
1409 +import java.io.BufferedReader;
1410 +import java.io.File;
1411 +import java.io.FileOutputStream;
1412 +import java.io.IOException;
1413 +import java.io.InputStream;
1414 +import java.io.InputStreamReader;
1415 +import java.util.ArrayList;
1416 +import java.util.Arrays;
1417 +import java.util.List;
1418 +import java.util.logging.Level;
1419 +import java.util.logging.Logger;
1420 +import java.util.regex.Matcher;
1421 +import java.util.regex.Pattern;
1424 + * @author Kerstin Breiteneder
1425 + * @author Christoph Wimberger
1427 +public abstract class Installer {
1429 + public String getJREDirectory() {
1433 + public String getBackupLibraryName() {
1434 + return getLibraryName() + ".backup";
1437 + public String getTemporaryLibraryName() {
1438 + return getLibraryName() + ".temp";
1441 + public abstract String getClientDirectory();
1443 + public abstract String getServerDirectory(boolean is64bit);
1445 + public abstract String getLibraryName();
1447 + public abstract String getJavaExecutable();
1449 + public abstract List<Installation> listAllInstallations();
1451 + public static Installer create() throws InstallerException {
1453 + String os = System.getProperty("os.name").toLowerCase();
1455 + if (os.contains("windows")) {
1456 + return new WindowsInstaller();
1457 + } else if (os.contains("mac") || os.contains("darwin")) {
1458 + return new MacInstaller();
1459 + } else if (os.contains("unix") || os.contains("linux")) {
1460 + return new LinuxInstaller();
1462 + throw new InstallerException("Unknown OS is unsupported.");
1465 + final protected void extractFile(String jarpath, String dest) throws InstallerException {
1466 + boolean fileCreated = false;
1467 + FileOutputStream output = null;
1468 + InputStream in = Main.class.getClassLoader().getResourceAsStream(jarpath);
1470 + throw new InstallerException("Could not find " + jarpath + " in jar-file.");
1473 + boolean failure = false;
1475 + output = new FileOutputStream(dest);
1476 + fileCreated = true;
1478 + byte[] cur = new byte[102400];
1479 + while ((len = in.read(cur)) != -1) {
1480 + output.write(cur, 0, len);
1482 + } catch (Exception ex) {
1484 + throw new InstallerException("Could not extract file " + dest + ".", ex);
1486 + if (output != null) {
1489 + } catch (Exception e) {
1492 + if (failure && fileCreated) {
1498 + public void install(File dir, boolean bit64) throws InstallerException {
1500 + dir = new File(dir, getJREDirectory());
1503 + String dcevm_jar = new File(dir, "lib" + File.separator + "ext" + File.separator + "dcevm.jar").getPath();
1504 + extractFile("data/dcevm.jar", dcevm_jar);
1506 + if (new File(dir, getServerDirectory(bit64)).exists()) {
1507 + installClientServer(dir, getServerDirectory(bit64), bit64);
1510 + if (new File(dir, getClientDirectory()).exists() && !bit64) {
1512 + installClientServer(dir, getClientDirectory(), false);
1513 + } catch (InstallerException e) {
1514 + uninstallClientServer(dir, getServerDirectory(bit64));
1520 + public void uninstall(File dir, boolean bit64) throws InstallerException {
1522 + dir = new File(dir, getJREDirectory());
1525 + if (new File(dir, getServerDirectory(bit64)).exists()) {
1526 + uninstallClientServer(dir, getServerDirectory(bit64));
1529 + if (new File(dir, getClientDirectory()).exists() && !bit64) {
1531 + uninstallClientServer(dir, getClientDirectory());
1532 + } catch (InstallerException e) {
1533 + if (new File(dir, getServerDirectory(bit64)).exists()) {
1534 + installClientServer(dir, getServerDirectory(bit64), bit64);
1540 + String dcevm_jar = new File(dir, "lib" + File.separator + "ext" + File.separator + "dcevm.jar").getPath();
1542 + deleteFile(dcevm_jar);
1543 + } catch (InstallerException e) {
1544 + install(dir, bit64);
1549 + private void installClientServer(File jreDir, String directory, boolean bit64) throws InstallerException {
1550 + String jarpath = "data/" + (bit64 ? "64/" : "") + directory.replace(File.separatorChar, '/') + "/" + getLibraryName();
1551 + File clientOrServerDir = new File(jreDir, directory);
1552 + String jvm_dll = new File(clientOrServerDir, getLibraryName()).getPath();
1553 + String jvm_dll_backup = new File(clientOrServerDir, getBackupLibraryName()).getPath();
1555 + renameFile(jvm_dll, jvm_dll_backup);
1558 + extractFile(jarpath, jvm_dll);
1559 + } catch (InstallerException e) {
1560 + renameFile(jvm_dll_backup, jvm_dll);
1565 + private void uninstallClientServer(File jreDir, String directory) throws InstallerException {
1566 + File clientOrServerDir = new File(jreDir, directory);
1567 + String jvm_dll = new File(clientOrServerDir, getLibraryName()).getPath();
1568 + String jvm_dll_backup = new File(clientOrServerDir, getBackupLibraryName()).getPath();
1569 + String jvm_dll_backup_temp = createTempFilename(clientOrServerDir, getBackupLibraryName() + "_", ".temp");
1571 + renameFile(jvm_dll_backup, jvm_dll_backup_temp);
1574 + deleteFile(jvm_dll);
1575 + } catch (InstallerException e) {
1576 + renameFile(jvm_dll_backup_temp, jvm_dll_backup);
1581 + renameFile(jvm_dll_backup_temp, jvm_dll);
1582 + } catch (InstallerException e) {
1583 + throw new InstallerException("Warning: JVM directory is in an inconistent state.", e);
1587 + private String createTempFilename(File dir, String prefix, String suffix){
1594 + filename = prefix + i + suffix;
1595 + } while(new File(dir, filename).exists() && i<1000);
1597 + return new File(dir, filename).getPath();
1600 + private void deleteFile(String file) throws InstallerException {
1601 + File f = new File(file);
1603 + boolean succ = false;
1605 + succ = f.delete();
1606 + } catch (Exception e) {
1607 + throw new InstallerException("Could not delete " + file + ".", e);
1611 + throw new InstallerException("Could not delete " + file + ".");
1615 + private void renameFile(String from, String to) throws InstallerException {
1616 + File ffr = new File(from);
1617 + File fto = new File(to);
1618 + if(!fto.isAbsolute()) fto = new File(ffr, to);
1620 + if (!ffr.exists()) {
1621 + throw new InstallerException("The file " + from + " does not exist.");
1624 + boolean succ = false;
1626 + succ = ffr.renameTo(fto);
1627 + } catch (Exception e) {
1628 + throw new InstallerException("Could not rename " + from + " to " + to + ".", e);
1632 + throw new InstallerException("Could not rename " + from + " to " + to + ".");
1636 + public boolean isJRE(File directory) {
1637 + if (directory.isDirectory() && directory.getName().startsWith("jre")) {
1639 + String[] files = {getJavaExecutable()};
1640 + for (int i = 0; i < files.length; i++) {
1641 + if (!new File(directory, files[i]).exists()) {
1646 + if (new File(directory, getClientDirectory()).exists()) {
1647 + if (!new File(directory, getClientDirectory() + File.separator + getLibraryName()).exists()) {
1648 + return new File(directory, getClientDirectory() + File.separator + getBackupLibraryName()).exists();
1652 + if (new File(directory, getServerDirectory(true)).exists()) {
1653 + if (!new File(directory, getServerDirectory(true) + File.separator + getLibraryName()).exists()) {
1654 + return new File(directory, getServerDirectory(true) + File.separator + getBackupLibraryName()).exists();
1662 + public boolean isJDK(File directory) {
1663 + if (directory.isDirectory()) {
1664 + File jreDir = new File(directory, getJREDirectory());
1665 + return isJRE(jreDir);
1670 + final public String executeJava(File jreDir, String... params) throws InstallerException {
1671 + File command = new File(jreDir, getJavaExecutable());
1673 + StringBuilder result = new StringBuilder();
1675 + ArrayList<String> pp = new ArrayList<String>();
1676 + pp.add(command.getAbsolutePath());
1677 + pp.addAll(Arrays.asList(params));
1678 + Process p = Runtime.getRuntime().exec(pp.toArray(new String[0]));
1679 + BufferedReader input =
1680 + new BufferedReader(new InputStreamReader(p.getErrorStream()));
1681 + while ((line = input.readLine()) != null) {
1682 + result.append(line);
1683 + result.append('\n');
1686 + return result.toString();
1687 + } catch (Exception err) {
1688 + throw new InstallerException("Could not execute " + command + ".", err);
1692 + public boolean isDCEInstalled(File dir) throws InstallerException {
1695 + jreDir = new File(dir, "jre");
1699 + File jvmDCEClientFile = new File(jreDir, getClientDirectory() + File.separator + getBackupLibraryName());
1700 + String serverDir = getServerDirectory(false);
1701 + if (!new File(jreDir, serverDir).exists()) {
1702 + serverDir = getServerDirectory(true);
1704 + File jvmDCEServerFile = new File(jreDir, serverDir + File.separator + getBackupLibraryName());
1706 + if (new File(jreDir, getClientDirectory()).exists() && new File(jreDir, serverDir).exists()) {
1707 + if (jvmDCEServerFile.exists() != jvmDCEClientFile.exists()) {
1708 + throw new InstallerException(jreDir.getAbsolutePath() + " has invalid state.");
1711 + return jvmDCEClientFile.exists() || jvmDCEServerFile.exists();
1714 + final public String getVersionString(File jreDir) throws InstallerException {
1715 + return executeJava(jreDir, "-version");
1718 + final public boolean is64Bit(File jreDir) throws InstallerException {
1719 + return getVersionString(jreDir).contains("64-Bit");
1722 + final public String getJavaVersion(File jreDir) throws InstallerException {
1723 + return getVersionHelper(jreDir, ".*java version.*\"(.*)\".*", true);
1726 + final public String getDCEVersion(File jreDir) throws InstallerException {
1727 + return getVersionHelper(jreDir, ".*Dynamic Code Evolution.*build ([^,]+),.*", false);
1730 + private String getVersionHelper(File jreDir, String regex, boolean javaVersion) throws InstallerException {
1731 + String version = getVersionString(jreDir);
1732 + version = version.replaceAll("\n", "");
1733 + Matcher matcher = Pattern.compile(regex).matcher(version);
1735 + if (!matcher.matches()) {
1736 + throw new InstallerException("Could not get " + (javaVersion ? "java" : "dce") + "version of " + jreDir.getAbsolutePath() + ".");
1739 + version = matcher.replaceFirst("$1");
1743 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/InstallerException.java
1744 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1745 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/InstallerException.java Fri Dec 17 13:23:04 2010 +0100
1748 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1749 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1751 + * This code is free software; you can redistribute it and/or modify it
1752 + * under the terms of the GNU General Public License version 2 only, as
1753 + * published by the Free Software Foundation.
1755 + * This code is distributed in the hope that it will be useful, but WITHOUT
1756 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1757 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1758 + * version 2 for more details (a copy is included in the LICENSE file that
1759 + * accompanied this code).
1761 + * You should have received a copy of the GNU General Public License version
1762 + * 2 along with this work; if not, write to the Free Software Foundation,
1763 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1765 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1766 + * or visit www.oracle.com if you need additional information or have any
1770 +package at.ssw.hotswap.installer;
1773 + * @author Kerstin Breiteneder
1774 + * @author Christoph Wimberger
1776 +public class InstallerException extends Exception {
1778 + InstallerException(String e) {
1782 + InstallerException(String e, Throwable t) {
1786 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/LinuxInstaller.java
1787 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1788 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/LinuxInstaller.java Fri Dec 17 13:23:04 2010 +0100
1791 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1792 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1794 + * This code is free software; you can redistribute it and/or modify it
1795 + * under the terms of the GNU General Public License version 2 only, as
1796 + * published by the Free Software Foundation.
1798 + * This code is distributed in the hope that it will be useful, but WITHOUT
1799 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1800 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1801 + * version 2 for more details (a copy is included in the LICENSE file that
1802 + * accompanied this code).
1804 + * You should have received a copy of the GNU General Public License version
1805 + * 2 along with this work; if not, write to the Free Software Foundation,
1806 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1808 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1809 + * or visit www.oracle.com if you need additional information or have any
1813 +package at.ssw.hotswap.installer;
1815 +import java.io.File;
1816 +import java.io.IOException;
1817 +import java.util.ArrayList;
1818 +import java.util.List;
1821 + * @author Kerstin Breiteneder
1822 + * @author Christoph Wimberger
1824 +public class LinuxInstaller extends Installer {
1826 + public String getClientDirectory() {
1827 + return "lib/i386/client";
1830 + public String getServerDirectory(boolean is64Bit) {
1832 + return "lib/amd64/server";
1834 + return "lib/i386/server";
1838 + public String getLibraryName() {
1839 + return "libjvm.so";
1842 + public String getJavaExecutable() {
1843 + return "bin/java";
1847 + public List<Installation> listAllInstallations() {
1848 + File dir = new File("/usr/java");
1850 + List<Installation> dirs = new ArrayList<Installation>();
1852 + if (dir.exists()) {
1853 + for (File f : dir.listFiles()) {
1855 + Installation i = new Installation(f.getCanonicalFile(), this);
1856 + if (!dirs.contains(i)) {
1859 + } catch (IOException ex) {
1860 + } catch (InstallerException ex) {
1868 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MacInstaller.java
1869 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1870 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MacInstaller.java Fri Dec 17 13:23:04 2010 +0100
1873 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1874 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1876 + * This code is free software; you can redistribute it and/or modify it
1877 + * under the terms of the GNU General Public License version 2 only, as
1878 + * published by the Free Software Foundation.
1880 + * This code is distributed in the hope that it will be useful, but WITHOUT
1881 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1882 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1883 + * version 2 for more details (a copy is included in the LICENSE file that
1884 + * accompanied this code).
1886 + * You should have received a copy of the GNU General Public License version
1887 + * 2 along with this work; if not, write to the Free Software Foundation,
1888 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1890 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1891 + * or visit www.oracle.com if you need additional information or have any
1895 +package at.ssw.hotswap.installer;
1897 +import java.io.File;
1898 +import java.util.ArrayList;
1899 +import java.util.List;
1902 + * @author Kerstin Breiteneder
1903 + * @author Christoph Wimberger
1905 +public class MacInstaller extends Installer {
1908 + public void install(File dir, boolean bit64) throws InstallerException {
1909 + if(bit64) throw new InstallerException("64 Bit Soylatte is not supported in this installer version.");
1910 + super.install(dir, bit64);
1913 + public String getClientDirectory() {
1914 + return "lib/i386/client";
1917 + public String getServerDirectory(boolean is64Bit) {
1919 + return "lib/amd64/server";
1921 + return "lib/i386/server";
1925 + public String getLibraryName() {
1926 + return "libjvm.dylib";
1929 + public String getJavaExecutable() {
1930 + return "bin/java";
1934 + public List<Installation> listAllInstallations() {
1935 + return new ArrayList<Installation>();
1938 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Main.java
1939 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1940 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Main.java Fri Dec 17 13:23:04 2010 +0100
1943 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1944 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1946 + * This code is free software; you can redistribute it and/or modify it
1947 + * under the terms of the GNU General Public License version 2 only, as
1948 + * published by the Free Software Foundation.
1950 + * This code is distributed in the hope that it will be useful, but WITHOUT
1951 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1952 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1953 + * version 2 for more details (a copy is included in the LICENSE file that
1954 + * accompanied this code).
1956 + * You should have received a copy of the GNU General Public License version
1957 + * 2 along with this work; if not, write to the Free Software Foundation,
1958 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1960 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1961 + * or visit www.oracle.com if you need additional information or have any
1965 +package at.ssw.hotswap.installer;
1967 +import javax.swing.JOptionPane;
1968 +import javax.swing.UIManager;
1969 +import javax.swing.UnsupportedLookAndFeelException;
1972 + * @author Kerstin Breiteneder
1973 + * @author Christoph Wimberger
1974 + * @author Thomas Wuerthinger
1976 +public class Main {
1978 + public static void main(String[] args) {
1980 + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
1981 + } catch (UnsupportedLookAndFeelException e) {
1982 + } catch (ClassNotFoundException e) {
1983 + } catch (InstantiationException e) {
1984 + } catch (IllegalAccessException e) {
1989 + Installer i = Installer.create();
1990 + w = new MainWindow(i);
1991 + w.setLocationRelativeTo(null);
1992 + w.setVisible(true);
1993 + } catch (InstallerException ex) {
1994 + JOptionPane.showMessageDialog(null, ex.getMessage(), ex.getMessage(), JOptionPane.ERROR_MESSAGE);
1999 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MainWindow.java
2000 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2001 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MainWindow.java Fri Dec 17 13:23:04 2010 +0100
2004 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2005 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2007 + * This code is free software; you can redistribute it and/or modify it
2008 + * under the terms of the GNU General Public License version 2 only, as
2009 + * published by the Free Software Foundation.
2011 + * This code is distributed in the hope that it will be useful, but WITHOUT
2012 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2013 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2014 + * version 2 for more details (a copy is included in the LICENSE file that
2015 + * accompanied this code).
2017 + * You should have received a copy of the GNU General Public License version
2018 + * 2 along with this work; if not, write to the Free Software Foundation,
2019 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2021 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2022 + * or visit www.oracle.com if you need additional information or have any
2026 +package at.ssw.hotswap.installer;
2028 +import java.awt.BorderLayout;
2029 +import java.awt.Color;
2030 +import java.awt.Component;
2031 +import java.awt.Dimension;
2032 +import java.awt.FlowLayout;
2033 +import java.awt.event.ActionEvent;
2034 +import java.awt.image.BufferedImage;
2035 +import java.io.File;
2036 +import java.io.IOException;
2037 +import java.util.ArrayList;
2038 +import java.util.Observable;
2039 +import java.util.Observer;
2040 +import java.util.prefs.Preferences;
2041 +import javax.imageio.ImageIO;
2042 +import javax.swing.AbstractAction;
2043 +import javax.swing.BorderFactory;
2044 +import javax.swing.ImageIcon;
2045 +import javax.swing.JButton;
2046 +import javax.swing.JComponent;
2047 +import javax.swing.JFileChooser;
2048 +import javax.swing.JFrame;
2049 +import javax.swing.JLabel;
2050 +import javax.swing.JOptionPane;
2051 +import javax.swing.JPanel;
2052 +import javax.swing.JScrollPane;
2053 +import javax.swing.JTable;
2054 +import javax.swing.JTextArea;
2055 +import javax.swing.ListSelectionModel;
2056 +import javax.swing.event.ListSelectionEvent;
2057 +import javax.swing.event.ListSelectionListener;
2058 +import javax.swing.table.AbstractTableModel;
2059 +import javax.swing.table.DefaultTableCellRenderer;
2062 + * @author Kerstin Breiteneder
2063 + * @author Christoph Wimberger
2065 +public class MainWindow extends JFrame {
2067 + private final InstallationsTableModel installations;
2068 + private final Installer installer;
2069 + private JTable table;
2071 + public MainWindow(Installer inst) {
2072 + super("Dynamic Code Evolution VM Installer");
2073 + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
2076 + installations = new InstallationsTableModel();
2077 + for (Installation i : installer.listAllInstallations()) {
2078 + installations.add(i);
2080 + add(getBanner(), BorderLayout.NORTH);
2081 + add(getCenterPanel(), BorderLayout.CENTER);
2082 + add(getBottomPanel(), BorderLayout.SOUTH);
2084 + if (table.getRowCount() > 0) {
2085 + table.setRowSelectionInterval(0, 0);
2089 + setMinimumSize(getSize());
2092 + static void showInstallerException(InstallerException ex, Component parent) {
2094 + String error = e.getMessage();
2097 + while (e != null) {
2098 + error += "\n" + e.getMessage();
2102 + ex.printStackTrace();
2104 + error += "\nPlease ensure that no other Java applications are running and you have sufficient permissions.";
2105 + JOptionPane.showMessageDialog(parent, error, ex.getMessage(), JOptionPane.ERROR_MESSAGE);
2108 + private JComponent getBanner() {
2110 + BufferedImage img = ImageIO.read(getClass().getResource("splash.png"));
2111 + JLabel title = new JLabel(new ImageIcon(img));
2112 + title.setPreferredSize(new Dimension(img.getWidth() + 10, img.getHeight()));
2113 + title.setOpaque(true);
2114 + title.setBackground(new Color(238, 238, 255));
2116 + } catch (IOException ex) {
2118 + return new JLabel();
2121 + private JComponent getCenterPanel() {
2122 + JPanel center = new JPanel(new BorderLayout());
2123 + center.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
2124 + center.setBackground(Color.WHITE);
2125 + JTextArea license = new javax.swing.JTextArea();
2126 + license.setLineWrap(true);
2127 + license.setWrapStyleWord(true);
2128 + license.setEditable(false);
2129 + license.setFont(license.getFont().deriveFont(11.0f));
2130 + StringBuilder licenseText = new StringBuilder();
2131 + 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.");
2132 + 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.");
2133 + license.setText(licenseText.toString());
2134 + JScrollPane licenses = new JScrollPane(license, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
2135 + licenses.setPreferredSize(new Dimension(150, 150));
2136 + center.add(licenses, BorderLayout.NORTH);
2137 + center.add(getChooserPanel(), BorderLayout.CENTER);
2141 + private JComponent getChooserPanel() {
2142 + JPanel p = new JPanel(new BorderLayout());
2143 + p.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
2144 + p.setOpaque(false);
2146 + JLabel l = new JLabel("Please choose installation directory:");
2147 + l.setVerticalAlignment(JLabel.NORTH);
2148 + l.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
2149 + p.add(l, BorderLayout.WEST);
2151 + table = new JTable(installations);
2152 + table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
2153 + table.setColumnSelectionAllowed(false);
2154 + table.setDefaultRenderer(Object.class, new InstallationTableCellRenderer());
2155 + table.getColumnModel().getColumn(0).setHeaderValue("Directory");
2156 + table.getColumnModel().getColumn(0).setPreferredWidth(300);
2157 + table.getColumnModel().getColumn(1).setHeaderValue("Java Version");
2158 + table.getColumnModel().getColumn(2).setHeaderValue("Type");
2159 + table.getColumnModel().getColumn(3).setHeaderValue("DCE");
2160 + JScrollPane lists = new JScrollPane(table);
2161 + lists.setPreferredSize(new Dimension(200, 200));
2162 + p.add(lists, BorderLayout.CENTER);
2167 + private JComponent getBottomPanel() {
2169 + JPanel left = new JPanel(new FlowLayout());
2170 + left.add(new JButton(new AddDirectoryAction(this, installations, installer)));
2172 + JPanel right = new JPanel(new FlowLayout());
2173 + right.add(new JButton(new TestAction(table, installer)));
2174 + right.add(new JButton(new InstallUninstallAction(false, table)));
2175 + right.add(new JButton(new InstallUninstallAction(true, table)));
2177 + JPanel bottom = new JPanel(new BorderLayout());
2178 + bottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
2179 + bottom.add(left, BorderLayout.WEST);
2180 + bottom.add(right, BorderLayout.EAST);
2186 +class AddDirectoryAction extends AbstractAction {
2188 + private final Component parent;
2189 + private final InstallationsTableModel installations;
2190 + private final Installer installer;
2192 + public AddDirectoryAction(Component parent, InstallationsTableModel inst, Installer installer) {
2193 + super("Add installation directory...");
2194 + this.parent = parent;
2195 + installations = inst;
2196 + this.installer = installer;
2199 + public void actionPerformed(ActionEvent e) {
2200 + JFileChooser fc = new JFileChooser();
2201 + fc.setDialogTitle("Select a Java installation directory...");
2202 + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
2203 + fc.setAcceptAllFileFilterUsed(false);
2204 + Preferences p = Preferences.userNodeForPackage(Installer.class);
2205 + final String prefID = "defaultDirectory";
2206 + fc.setCurrentDirectory(new File(p.get(prefID, ".")));
2208 + if (fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
2210 + File dir = fc.getSelectedFile();
2211 + p.put(prefID, dir.getParent());
2213 + installations.add(new Installation(dir, installer));
2214 + } catch (InstallerException ex) {
2215 + MainWindow.showInstallerException(ex, parent);
2221 +class InstallUninstallAction extends AbstractAction implements ListSelectionListener, Observer {
2223 + private final JTable table;
2224 + private final boolean install;
2225 + private Installation installation;
2227 + public InstallUninstallAction(boolean install, JTable t) {
2228 + super(install ? "Install" : "Uninstall");
2229 + this.install = install;
2230 + setEnabled(false);
2232 + t.getSelectionModel().addListSelectionListener(this);
2235 + private Installation getSelectedInstallation() {
2236 + InstallationsTableModel itm = (InstallationsTableModel) table.getModel();
2237 + int sel = table.getSelectedRow();
2241 + return itm.getInstallationAt(sel);
2245 + public void actionPerformed(ActionEvent e) {
2248 + getSelectedInstallation().installDCE();
2250 + getSelectedInstallation().uninstallDCE();
2252 + } catch (InstallerException ex) {
2253 + MainWindow.showInstallerException(ex, table);
2257 + private void setCurrentInstallation(Installation i) {
2258 + if (installation != null) {
2259 + installation.deleteObserver(this);
2262 + if (installation != null) {
2263 + installation.addObserver(this);
2268 + public void valueChanged(ListSelectionEvent e) {
2269 + Installation i = getSelectedInstallation();
2270 + setCurrentInstallation(i);
2273 + private void update() {
2275 + setEnabled(installation != null && !installation.isDCEInstalled());
2277 + setEnabled(installation != null && installation.isDCEInstalled());
2281 + public void update(Observable o, Object arg) {
2286 +class TestAction extends AbstractAction implements ListSelectionListener, Observer {
2288 + private final JTable table;
2289 + private Installation installation;
2290 + private final Installer installer;
2292 + public TestAction(JTable t, Installer i) {
2293 + super("Test Installation");
2294 + setEnabled(false);
2297 + t.getSelectionModel().addListSelectionListener(this);
2300 + private Installation getSelectedInstallation() {
2301 + InstallationsTableModel itm = (InstallationsTableModel) table.getModel();
2302 + int sel = table.getSelectedRow();
2306 + return itm.getInstallationAt(sel);
2310 + public void actionPerformed(ActionEvent e) {
2311 + File p = installation.getPath();
2312 + if(installation.isJDK()) p = new File(p, "jre");
2314 + String result = "";
2316 + String agentparam = "-javaagent:" + p.getAbsolutePath() + "/lib/ext/dcevm.jar";
2317 + result = installer.executeJava(p, agentparam, "at.ssw.mixin.fasttest.FastTest");
2318 + } catch (InstallerException ex) {
2319 + MainWindow.showInstallerException(ex, table);
2322 + if(result.length()>0) {
2323 + String msg = "Tests failed:\n" + result;
2324 + JOptionPane.showMessageDialog(table.getTopLevelAncestor(), msg, "Error", JOptionPane.ERROR_MESSAGE);
2326 + JOptionPane.showMessageDialog(table.getTopLevelAncestor(), "All tests succeeded.", "Information", JOptionPane.INFORMATION_MESSAGE);
2330 + private void setCurrentInstallation(Installation i) {
2331 + if (installation != null) {
2332 + installation.deleteObserver(this);
2335 + if (installation != null) {
2336 + installation.addObserver(this);
2341 + public void valueChanged(ListSelectionEvent e) {
2342 + Installation i = getSelectedInstallation();
2343 + setCurrentInstallation(i);
2346 + private void update() {
2347 + setEnabled(installation != null && installation.isDCEInstalled());
2350 + public void update(Observable o, Object arg) {
2355 +class InstallationsTableModel extends AbstractTableModel implements Observer {
2357 + private final ArrayList<Installation> installations;
2359 + public InstallationsTableModel() {
2360 + installations = new ArrayList<Installation>();
2363 + public int getRowCount() {
2364 + return installations.size();
2367 + public int getColumnCount() {
2371 + public Object getValueAt(int rowIndex, int columnIndex) {
2372 + return installations.get(rowIndex);
2375 + public Installation getInstallationAt(int row) {
2376 + return installations.get(row);
2379 + public void add(Installation i) {
2380 + installations.add(i);
2381 + i.addObserver(this);
2382 + fireTableDataChanged();
2385 + public void update(Observable o, Object arg) {
2386 + int row = installations.indexOf(o);
2387 + fireTableRowsUpdated(row, row);
2391 +class InstallationTableCellRenderer extends DefaultTableCellRenderer {
2394 + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
2395 + Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
2397 + if (c instanceof JLabel && value instanceof Installation) {
2398 + JLabel l = (JLabel) c;
2399 + Installation i = (Installation) value;
2403 + l.setText(i.getPath().getAbsolutePath());
2406 + l.setText(i.getVersion());
2409 + l.setText(i.isJDK() ? "JDK" : "JRE");
2410 + if (i.is64Bit()) {
2411 + l.setText(l.getText() + " (64 Bit)");
2415 + if (i.isDCEInstalled()) {
2416 + l.setText("Yes (" + i.getDCEVersion() + ")");
2428 + public void setText(String text) {
2429 + super.setText(text);
2430 + setToolTipText(text);
2433 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/WindowsInstaller.java
2434 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2435 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/WindowsInstaller.java Fri Dec 17 13:23:04 2010 +0100
2438 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2439 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2441 + * This code is free software; you can redistribute it and/or modify it
2442 + * under the terms of the GNU General Public License version 2 only, as
2443 + * published by the Free Software Foundation.
2445 + * This code is distributed in the hope that it will be useful, but WITHOUT
2446 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2447 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2448 + * version 2 for more details (a copy is included in the LICENSE file that
2449 + * accompanied this code).
2451 + * You should have received a copy of the GNU General Public License version
2452 + * 2 along with this work; if not, write to the Free Software Foundation,
2453 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2455 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2456 + * or visit www.oracle.com if you need additional information or have any
2460 +package at.ssw.hotswap.installer;
2462 +import java.io.File;
2463 +import java.util.ArrayList;
2464 +import java.util.List;
2467 + * @author Kerstin Breiteneder
2468 + * @author Christoph Wimberger
2470 +public class WindowsInstaller extends Installer {
2472 + public String getClientDirectory() {
2473 + return "bin\\client";
2476 + public String getServerDirectory(boolean is64bit) {
2477 + return "bin\\server";
2480 + public String getJavaExecutable() {
2481 + return "bin\\java.exe";
2484 + public String getLibraryName() {
2488 + public List<Installation> listAllInstallations() {
2489 + List<Installation> installations = new ArrayList<Installation>();
2490 + String[] searchForJavaString = new String[]{
2491 + System.getenv("JAVA_HOME") + "\\..",
2492 + System.getenv("PROGRAMW6432") + "\\JAVA",
2493 + System.getenv("PROGRAMFILES") + "\\JAVA",
2494 + System.getenv("SYSTEMDRIVE") + "\\JAVA"};
2496 + for (String fileString : searchForJavaString) {
2497 + File javaDir = new File(fileString);
2499 + if (javaDir.exists() && javaDir.isDirectory()) {
2500 + for (File f : javaDir.listFiles()) {
2501 + if (f.getName().startsWith("jdk") || f.getName().startsWith("jre")) {
2503 + Installation i = new Installation(f, this);
2504 + if (!installations.contains(i)) {
2505 + installations.add(i);
2507 + } catch (InstallerException ex) {
2513 + return installations;
2517 + public boolean isJDK(File directory) {
2518 + if (directory.isDirectory() && directory.getName().startsWith("jdk")) {
2519 + File jreDir = new File(directory, "jre");
2520 + return isJRE(jreDir);
2525 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/splash.png
2526 Binary file hotswapinstaller/Installer/src/at/ssw/hotswap/installer/splash.png has changed
2527 diff -r f5603a6e5042 hotswaptest/HotSwapTests/build.xml
2528 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2529 +++ b/hotswaptest/HotSwapTests/build.xml Fri Dec 17 13:23:04 2010 +0100
2531 +<?xml version="1.0" encoding="UTF-8"?>
2532 +<!-- You may freely edit this file. See commented blocks below for -->
2533 +<!-- some examples of how to customize the build. -->
2534 +<!-- (If you delete it and reopen the project it will be recreated.) -->
2535 +<!-- By default, only the Clean and Build commands use this build script. -->
2536 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
2537 +<!-- the Compile on Save feature is turned off for the project. -->
2538 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
2539 +<!-- in the project's Project Properties dialog box.-->
2540 +<project name="HotSwapTests" default="default" basedir=".">
2541 + <description>Builds, tests, and runs the project HotSwapTests.</description>
2542 + <import file="nbproject/build-impl.xml"/>
2545 + There exist several targets which are by default empty and which can be
2546 + used for execution of your tasks. These targets are usually executed
2547 + before and after some main targets. They are:
2549 + -pre-init: called before initialization of project properties
2550 + -post-init: called after initialization of project properties
2551 + -pre-compile: called before javac compilation
2552 + -post-compile: called after javac compilation
2553 + -pre-compile-single: called before javac compilation of single file
2554 + -post-compile-single: called after javac compilation of single file
2555 + -pre-compile-test: called before javac compilation of JUnit tests
2556 + -post-compile-test: called after javac compilation of JUnit tests
2557 + -pre-compile-test-single: called before javac compilation of single JUnit test
2558 + -post-compile-test-single: called after javac compilation of single JUunit test
2559 + -pre-jar: called before JAR building
2560 + -post-jar: called after JAR building
2561 + -post-clean: called after cleaning build products
2563 + (Targets beginning with '-' are not intended to be called on their own.)
2565 + Example of inserting an obfuscator after compilation could look like this:
2567 + <target name="-post-compile">
2569 + <fileset dir="${build.classes.dir}"/>
2573 + For list of available properties check the imported
2574 + nbproject/build-impl.xml file.
2577 + Another way to customize the build is by overriding existing main targets.
2578 + The targets of interest are:
2580 + -init-macrodef-javac: defines macro for javac compilation
2581 + -init-macrodef-junit: defines macro for junit execution
2582 + -init-macrodef-debug: defines macro for class debugging
2583 + -init-macrodef-java: defines macro for class execution
2584 + -do-jar-with-manifest: JAR building (if you are using a manifest)
2585 + -do-jar-without-manifest: JAR building (if you are not using a manifest)
2586 + run: execution of project
2587 + -javadoc-build: Javadoc generation
2588 + test-report: JUnit report generation
2590 + An example of overriding the target for project execution could look like this:
2592 + <target name="run" depends="HotSwapTests-impl.jar">
2593 + <exec dir="bin" executable="launcher.exe">
2594 + <arg file="${dist.jar}"/>
2598 + Notice that the overridden target depends on the jar target and not only on
2599 + the compile target as the regular run target does. Again, for a list of available
2600 + properties which you can use, check the target you are overriding in the
2601 + nbproject/build-impl.xml file.
2605 diff -r f5603a6e5042 hotswaptest/HotSwapTests/manifest.mf
2606 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2607 +++ b/hotswaptest/HotSwapTests/manifest.mf Fri Dec 17 13:23:04 2010 +0100
2609 +Manifest-Version: 1.0
2610 +X-COMMENT: Main-Class will be added automatically by build
2612 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/build-impl.xml
2613 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2614 +++ b/hotswaptest/HotSwapTests/nbproject/build-impl.xml Fri Dec 17 13:23:04 2010 +0100
2616 +<?xml version="1.0" encoding="UTF-8"?>
2618 +*** GENERATED FROM project.xml - DO NOT EDIT ***
2619 +*** EDIT ../build.xml INSTEAD ***
2621 +For the purpose of easier reading the script
2622 +is divided into following sections:
2630 + - junit compilation
2637 +<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">
2638 + <fail message="Please build using Ant 1.7.1 or higher.">
2641 + <antversion atleast="1.7.1"/>
2645 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
2647 + ======================
2648 + INITIALIZATION SECTION
2649 + ======================
2651 + <target name="-pre-init">
2652 + <!-- Empty placeholder for easier customization. -->
2653 + <!-- You can override this target in the ../build.xml file. -->
2655 + <target depends="-pre-init" name="-init-private">
2656 + <property file="nbproject/private/config.properties"/>
2657 + <property file="nbproject/private/configs/${config}.properties"/>
2658 + <property file="nbproject/private/private.properties"/>
2660 + <target depends="-pre-init,-init-private" name="-init-user">
2661 + <property file="${user.properties.file}"/>
2662 + <!-- The two properties below are usually overridden -->
2663 + <!-- by the active platform. Just a fallback. -->
2664 + <property name="default.javac.source" value="1.4"/>
2665 + <property name="default.javac.target" value="1.4"/>
2667 + <target depends="-pre-init,-init-private,-init-user" name="-init-project">
2668 + <property file="nbproject/configs/${config}.properties"/>
2669 + <property file="nbproject/project.properties"/>
2671 + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
2672 + <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
2673 + <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
2674 + <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
2675 + <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
2676 + <condition property="platform.javac" value="${platform.home}/bin/javac">
2677 + <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
2679 + <property name="platform.javac" value="${platform.javac.tmp}"/>
2680 + <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
2681 + <condition property="platform.java" value="${platform.home}/bin/java">
2682 + <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
2684 + <property name="platform.java" value="${platform.java.tmp}"/>
2685 + <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
2686 + <condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
2687 + <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
2689 + <property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
2690 + <condition property="platform.invalid" value="true">
2692 + <contains string="${platform.javac}" substring="$${platforms."/>
2693 + <contains string="${platform.java}" substring="$${platforms."/>
2694 + <contains string="${platform.javadoc}" substring="$${platforms."/>
2697 + <fail unless="platform.home">Must set platform.home</fail>
2698 + <fail unless="platform.bootcp">Must set platform.bootcp</fail>
2699 + <fail unless="platform.java">Must set platform.java</fail>
2700 + <fail unless="platform.javac">Must set platform.javac</fail>
2701 + <fail if="platform.invalid">
2702 + The J2SE Platform is not correctly set up.
2703 + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files.
2704 + Either open the project in the IDE and setup the Platform with the same name or add it manually.
2705 + For example like this:
2706 + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
2707 + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used)
2709 + <available file="${manifest.file}" property="manifest.available"/>
2710 + <condition property="splashscreen.available">
2713 + <equals arg1="${application.splash}" arg2="" trim="true"/>
2715 + <available file="${application.splash}"/>
2718 + <condition property="main.class.available">
2720 + <isset property="main.class"/>
2722 + <equals arg1="${main.class}" arg2="" trim="true"/>
2726 + <condition property="manifest.available+main.class">
2728 + <isset property="manifest.available"/>
2729 + <isset property="main.class.available"/>
2732 + <condition property="do.mkdist">
2734 + <isset property="libs.CopyLibs.classpath"/>
2736 + <istrue value="${mkdist.disabled}"/>
2740 + <condition property="manifest.available+main.class+mkdist.available">
2742 + <istrue value="${manifest.available+main.class}"/>
2743 + <isset property="do.mkdist"/>
2746 + <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
2748 + <istrue value="${manifest.available+main.class+mkdist.available}"/>
2749 + <istrue value="${splashscreen.available}"/>
2752 + <condition property="do.archive">
2754 + <istrue value="${jar.archive.disabled}"/>
2757 + <condition property="do.archive+manifest.available">
2759 + <isset property="manifest.available"/>
2760 + <istrue value="${do.archive}"/>
2763 + <condition property="do.archive+manifest.available+main.class">
2765 + <istrue value="${manifest.available+main.class}"/>
2766 + <istrue value="${do.archive}"/>
2769 + <condition property="do.archive+manifest.available+main.class+mkdist.available">
2771 + <istrue value="${manifest.available+main.class+mkdist.available}"/>
2772 + <istrue value="${do.archive}"/>
2775 + <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
2777 + <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
2778 + <istrue value="${do.archive}"/>
2781 + <condition property="have.tests">
2784 + <condition property="have.sources">
2786 + <available file="${src.dir}"/>
2789 + <condition property="netbeans.home+have.tests">
2791 + <isset property="netbeans.home"/>
2792 + <isset property="have.tests"/>
2795 + <condition property="no.javadoc.preview">
2797 + <isset property="javadoc.preview"/>
2798 + <isfalse value="${javadoc.preview}"/>
2801 + <property name="run.jvmargs" value=""/>
2802 + <property name="javac.compilerargs" value=""/>
2803 + <property name="work.dir" value="${basedir}"/>
2804 + <condition property="no.deps">
2806 + <istrue value="${no.dependencies}"/>
2809 + <property name="javac.debug" value="true"/>
2810 + <property name="javadoc.preview" value="true"/>
2811 + <property name="application.args" value=""/>
2812 + <property name="source.encoding" value="${file.encoding}"/>
2813 + <property name="runtime.encoding" value="${source.encoding}"/>
2814 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
2816 + <isset property="javadoc.encoding"/>
2818 + <equals arg1="${javadoc.encoding}" arg2=""/>
2822 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
2823 + <property name="includes" value="**"/>
2824 + <property name="excludes" value=""/>
2825 + <property name="do.depend" value="false"/>
2826 + <condition property="do.depend.true">
2827 + <istrue value="${do.depend}"/>
2829 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
2830 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
2831 + <length length="0" string="${endorsed.classpath}" when="greater"/>
2833 + <property name="jar.index" value="false"/>
2834 + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
2836 + <target name="-post-init">
2837 + <!-- Empty placeholder for easier customization. -->
2838 + <!-- You can override this target in the ../build.xml file. -->
2840 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
2841 + <fail unless="src.dir">Must set src.dir</fail>
2842 + <fail unless="build.dir">Must set build.dir</fail>
2843 + <fail unless="dist.dir">Must set dist.dir</fail>
2844 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
2845 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
2846 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
2847 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
2848 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
2849 + <fail unless="dist.jar">Must set dist.jar</fail>
2851 + <target name="-init-macrodef-property">
2852 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
2853 + <attribute name="name"/>
2854 + <attribute name="value"/>
2856 + <property name="@{name}" value="${@{value}}"/>
2860 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
2861 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
2862 + <attribute default="${src.dir}" name="srcdir"/>
2863 + <attribute default="${build.classes.dir}" name="destdir"/>
2864 + <attribute default="${javac.classpath}" name="classpath"/>
2865 + <attribute default="${javac.processorpath}" name="processorpath"/>
2866 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
2867 + <attribute default="${includes}" name="includes"/>
2868 + <attribute default="${excludes}" name="excludes"/>
2869 + <attribute default="${javac.debug}" name="debug"/>
2870 + <attribute default="${empty.dir}" name="sourcepath"/>
2871 + <attribute default="${empty.dir}" name="gensrcdir"/>
2872 + <element name="customize" optional="true"/>
2874 + <property location="${build.dir}/empty" name="empty.dir"/>
2875 + <mkdir dir="${empty.dir}"/>
2876 + <mkdir dir="@{apgeneratedsrcdir}"/>
2877 + <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}">
2879 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
2880 + <include name="*"/>
2884 + <path path="@{classpath}"/>
2886 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
2887 + <compilerarg line="${javac.compilerargs}"/>
2888 + <compilerarg value="-processorpath"/>
2889 + <compilerarg path="@{processorpath}:${empty.dir}"/>
2890 + <compilerarg line="${ap.processors.internal}"/>
2891 + <compilerarg line="${annotation.processing.processor.options}"/>
2892 + <compilerarg value="-s"/>
2893 + <compilerarg path="@{apgeneratedsrcdir}"/>
2894 + <compilerarg line="${ap.proc.none.internal}"/>
2900 + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
2901 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
2902 + <attribute default="${src.dir}" name="srcdir"/>
2903 + <attribute default="${build.classes.dir}" name="destdir"/>
2904 + <attribute default="${javac.classpath}" name="classpath"/>
2905 + <attribute default="${javac.processorpath}" name="processorpath"/>
2906 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
2907 + <attribute default="${includes}" name="includes"/>
2908 + <attribute default="${excludes}" name="excludes"/>
2909 + <attribute default="${javac.debug}" name="debug"/>
2910 + <attribute default="${empty.dir}" name="sourcepath"/>
2911 + <attribute default="${empty.dir}" name="gensrcdir"/>
2912 + <element name="customize" optional="true"/>
2914 + <property location="${build.dir}/empty" name="empty.dir"/>
2915 + <mkdir dir="${empty.dir}"/>
2916 + <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}">
2918 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
2919 + <include name="*"/>
2923 + <path path="@{classpath}"/>
2925 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
2926 + <compilerarg line="${javac.compilerargs}"/>
2932 + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
2933 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
2934 + <attribute default="${src.dir}" name="srcdir"/>
2935 + <attribute default="${build.classes.dir}" name="destdir"/>
2936 + <attribute default="${javac.classpath}" name="classpath"/>
2938 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
2940 + <path path="@{classpath}"/>
2945 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
2946 + <attribute default="${build.classes.dir}" name="destdir"/>
2948 + <fail unless="javac.includes">Must set javac.includes</fail>
2949 + <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
2951 + <filelist dir="@{destdir}" files="${javac.includes}"/>
2953 + <globmapper from="*.java" to="*.class"/>
2955 + <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
2956 + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
2958 + <files includesfile="${javac.includesfile.binary}"/>
2960 + <delete file="${javac.includesfile.binary}"/>
2964 + <target name="-init-macrodef-junit">
2965 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
2966 + <attribute default="${includes}" name="includes"/>
2967 + <attribute default="${excludes}" name="excludes"/>
2968 + <attribute default="**" name="testincludes"/>
2970 + <property name="junit.forkmode" value="perTest"/>
2971 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
2972 + <batchtest todir="${build.test.results.dir}"/>
2974 + <path path="${run.test.classpath}"/>
2977 + <propertyref prefix="test-sys-prop."/>
2978 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
2980 + <formatter type="brief" usefile="false"/>
2981 + <formatter type="xml"/>
2982 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
2983 + <jvmarg line="${run.jvmargs}"/>
2988 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
2989 + <target name="-profile-pre-init">
2990 + <!-- Empty placeholder for easier customization. -->
2991 + <!-- You can override this target in the ../build.xml file. -->
2993 + <target name="-profile-post-init">
2994 + <!-- Empty placeholder for easier customization. -->
2995 + <!-- You can override this target in the ../build.xml file. -->
2997 + <target name="-profile-init-macrodef-profile">
2998 + <macrodef name="resolve">
2999 + <attribute name="name"/>
3000 + <attribute name="value"/>
3002 + <property name="@{name}" value="${env.@{value}}"/>
3005 + <macrodef name="profile">
3006 + <attribute default="${main.class}" name="classname"/>
3007 + <element name="customize" optional="true"/>
3009 + <property environment="env"/>
3010 + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
3011 + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
3012 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
3013 + <jvmarg line="${profiler.info.jvmargs}"/>
3014 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
3015 + <arg line="${application.args}"/>
3017 + <path path="${run.classpath}"/>
3020 + <propertyref prefix="run-sys-prop."/>
3021 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
3028 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
3029 + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
3030 + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
3032 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
3033 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
3034 + <attribute default="${main.class}" name="name"/>
3035 + <attribute default="${debug.classpath}" name="classpath"/>
3036 + <attribute default="" name="stopclassname"/>
3038 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
3040 + <path path="@{classpath}"/>
3043 + <path path="${platform.bootcp}"/>
3048 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
3049 + <attribute default="${build.classes.dir}" name="dir"/>
3052 + <fileset dir="@{dir}" includes="${fix.classes}">
3053 + <include name="${fix.includes}*.class"/>
3059 + <target name="-init-debug-args">
3060 + <exec executable="${platform.java}" outputproperty="version-output">
3061 + <arg value="-version"/>
3063 + <condition property="have-jdk-older-than-1.4">
3065 + <contains string="${version-output}" substring="java version "1.0"/>
3066 + <contains string="${version-output}" substring="java version "1.1"/>
3067 + <contains string="${version-output}" substring="java version "1.2"/>
3068 + <contains string="${version-output}" substring="java version "1.3"/>
3071 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
3072 + <istrue value="${have-jdk-older-than-1.4}"/>
3074 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
3075 + <os family="windows"/>
3077 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
3078 + <isset property="debug.transport"/>
3081 + <target depends="-init-debug-args" name="-init-macrodef-debug">
3082 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3083 + <attribute default="${main.class}" name="classname"/>
3084 + <attribute default="${debug.classpath}" name="classpath"/>
3085 + <element name="customize" optional="true"/>
3087 + <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
3088 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3089 + <jvmarg line="${debug-args-line}"/>
3090 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
3091 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
3092 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
3093 + <jvmarg line="${run.jvmargs}"/>
3095 + <path path="@{classpath}"/>
3098 + <propertyref prefix="run-sys-prop."/>
3099 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
3106 + <target name="-init-macrodef-java">
3107 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
3108 + <attribute default="${main.class}" name="classname"/>
3109 + <attribute default="${run.classpath}" name="classpath"/>
3110 + <element name="customize" optional="true"/>
3112 + <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
3113 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3114 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
3115 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
3116 + <jvmarg line="${run.jvmargs}"/>
3118 + <path path="@{classpath}"/>
3121 + <propertyref prefix="run-sys-prop."/>
3122 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
3129 + <target name="-init-macrodef-copylibs">
3130 + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
3131 + <element name="customize" optional="true"/>
3133 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
3134 + <pathconvert property="run.classpath.without.build.classes.dir">
3135 + <path path="${run.classpath}"/>
3136 + <map from="${build.classes.dir.resolved}" to=""/>
3138 + <pathconvert pathsep=" " property="jar.classpath">
3139 + <path path="${run.classpath.without.build.classes.dir}"/>
3142 + <globmapper from="*" to="lib/*"/>
3145 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
3146 + <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
3147 + <fileset dir="${build.classes.dir}"/>
3149 + <attribute name="Class-Path" value="${jar.classpath}"/>
3156 + <target name="-init-presetdef-jar">
3157 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
3158 + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
3159 + <j2seproject1:fileset dir="${build.classes.dir}"/>
3163 + <target name="-init-ap-cmdline-properties">
3164 + <property name="annotation.processing.enabled" value="true"/>
3165 + <property name="annotation.processing.processors.list" value=""/>
3166 + <property name="annotation.processing.processor.options" value=""/>
3167 + <property name="annotation.processing.run.all.processors" value="true"/>
3168 + <property name="javac.processorpath" value="${javac.classpath}"/>
3169 + <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
3170 + <condition property="ap.supported.internal" value="true">
3172 + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
3176 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
3177 + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
3178 + <isfalse value="${annotation.processing.run.all.processors}"/>
3180 + <condition else="" property="ap.proc.none.internal" value="-proc:none">
3181 + <isfalse value="${annotation.processing.enabled}"/>
3184 + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
3185 + <property name="ap.cmd.line.internal" value=""/>
3187 + <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"/>
3189 + ===================
3190 + COMPILATION SECTION
3191 + ===================
3193 + <target name="-deps-jar-init" unless="built-jar.properties">
3194 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
3195 + <delete file="${built-jar.properties}" quiet="true"/>
3197 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
3198 + <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
3200 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
3201 + <mkdir dir="${build.dir}"/>
3202 + <touch file="${built-jar.properties}" verbose="false"/>
3203 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
3204 + <antcall target="-warn-already-built-jar"/>
3205 + <propertyfile file="${built-jar.properties}">
3206 + <entry key="${basedir}" value=""/>
3208 + <antcall target="-maybe-call-dep">
3209 + <param name="call.built.properties" value="${built-jar.properties}"/>
3210 + <param location="${project.HotSwapTool}" name="call.subproject"/>
3211 + <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
3212 + <param name="call.target" value="jar"/>
3213 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
3216 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
3217 + <target depends="init" name="-check-automatic-build">
3218 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
3220 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
3221 + <antcall target="clean"/>
3223 + <target depends="init,deps-jar" name="-pre-pre-compile">
3224 + <mkdir dir="${build.classes.dir}"/>
3226 + <target name="-pre-compile">
3227 + <!-- Empty placeholder for easier customization. -->
3228 + <!-- You can override this target in the ../build.xml file. -->
3230 + <target if="do.depend.true" name="-compile-depend">
3231 + <pathconvert property="build.generated.subdirs">
3232 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3233 + <include name="*"/>
3236 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
3238 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
3239 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
3240 + <copy todir="${build.classes.dir}">
3241 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
3244 + <target if="has.persistence.xml" name="-copy-persistence-xml">
3245 + <mkdir dir="${build.classes.dir}/META-INF"/>
3246 + <copy todir="${build.classes.dir}/META-INF">
3247 + <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
3250 + <target name="-post-compile">
3251 + <!-- Empty placeholder for easier customization. -->
3252 + <!-- You can override this target in the ../build.xml file. -->
3254 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
3255 + <target name="-pre-compile-single">
3256 + <!-- Empty placeholder for easier customization. -->
3257 + <!-- You can override this target in the ../build.xml file. -->
3259 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
3260 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
3261 + <j2seproject3:force-recompile/>
3262 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
3264 + <target name="-post-compile-single">
3265 + <!-- Empty placeholder for easier customization. -->
3266 + <!-- You can override this target in the ../build.xml file. -->
3268 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
3270 + ====================
3271 + JAR BUILDING SECTION
3272 + ====================
3274 + <target depends="init" name="-pre-pre-jar">
3275 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
3276 + <mkdir dir="${dist.jar.dir}"/>
3278 + <target name="-pre-jar">
3279 + <!-- Empty placeholder for easier customization. -->
3280 + <!-- You can override this target in the ../build.xml file. -->
3282 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
3283 + <j2seproject1:jar/>
3285 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
3286 + <j2seproject1:jar manifest="${manifest.file}"/>
3288 + <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">
3289 + <j2seproject1:jar manifest="${manifest.file}">
3290 + <j2seproject1:manifest>
3291 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
3292 + </j2seproject1:manifest>
3293 + </j2seproject1:jar>
3294 + <echo>To run this application from the command line without Ant, try:</echo>
3295 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
3296 + <property location="${dist.jar}" name="dist.jar.resolved"/>
3297 + <pathconvert property="run.classpath.with.dist.jar">
3298 + <path path="${run.classpath}"/>
3299 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
3301 + <echo>${platform.java} -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
3303 + <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">
3304 + <basename file="${application.splash}" property="splashscreen.basename"/>
3305 + <mkdir dir="${build.classes.dir}/META-INF"/>
3306 + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
3307 + <j2seproject3:copylibs>
3309 + <attribute name="Main-Class" value="${main.class}"/>
3310 + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
3312 + </j2seproject3:copylibs>
3313 + <echo>To run this application from the command line without Ant, try:</echo>
3314 + <property location="${dist.jar}" name="dist.jar.resolved"/>
3315 + <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
3317 + <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">
3318 + <j2seproject3:copylibs>
3320 + <attribute name="Main-Class" value="${main.class}"/>
3322 + </j2seproject3:copylibs>
3323 + <echo>To run this application from the command line without Ant, try:</echo>
3324 + <property location="${dist.jar}" name="dist.jar.resolved"/>
3325 + <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
3327 + <target name="-post-jar">
3328 + <!-- Empty placeholder for easier customization. -->
3329 + <!-- You can override this target in the ../build.xml file. -->
3331 + <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"/>
3337 + <target depends="init,compile" description="Run a main class." name="run">
3338 + <j2seproject1:java>
3340 + <arg line="${application.args}"/>
3342 + </j2seproject1:java>
3344 + <target name="-do-not-recompile">
3345 + <property name="javac.includes.binary" value=""/>
3347 + <target depends="init,compile-single" name="run-single">
3348 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3349 + <j2seproject1:java classname="${run.class}"/>
3351 + <target depends="init,compile-test-single" name="run-test-with-main">
3352 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3353 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
3360 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
3361 + <j2seproject1:nbjpdastart name="${debug.class}"/>
3363 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
3364 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
3366 + <target depends="init,compile" name="-debug-start-debuggee">
3367 + <j2seproject3:debug>
3369 + <arg line="${application.args}"/>
3371 + </j2seproject3:debug>
3373 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
3374 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
3375 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
3377 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
3378 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
3379 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
3380 + <j2seproject3:debug classname="${debug.class}"/>
3382 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
3383 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
3384 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
3385 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
3387 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
3388 + <target depends="init" name="-pre-debug-fix">
3389 + <fail unless="fix.includes">Must set fix.includes</fail>
3390 + <property name="javac.includes" value="${fix.includes}.java"/>
3392 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
3393 + <j2seproject1:nbjpdareload/>
3395 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
3401 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
3404 + <path path="${run.classpath}"/>
3406 + </nbprofiledirect>
3409 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
3410 + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
3413 + <path path="${run.classpath}"/>
3415 + </nbprofiledirect>
3416 + <profile classname="${profile.class}"/>
3419 + =========================
3420 + APPLET PROFILING SECTION
3421 + =========================
3423 + <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
3426 + <path path="${run.classpath}"/>
3428 + </nbprofiledirect>
3429 + <profile classname="sun.applet.AppletViewer">
3431 + <arg value="${applet.url}"/>
3436 + =========================
3437 + TESTS PROFILING SECTION
3438 + =========================
3440 + <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
3443 + <path path="${run.test.classpath}"/>
3445 + </nbprofiledirect>
3446 + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
3447 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
3448 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
3449 + <jvmarg line="${profiler.info.jvmargs}"/>
3450 + <test name="${profile.class}"/>
3452 + <path path="${run.test.classpath}"/>
3455 + <propertyref prefix="test-sys-prop."/>
3456 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3458 + <formatter type="brief" usefile="false"/>
3459 + <formatter type="xml"/>
3467 + <target depends="init" if="have.sources" name="-javadoc-build">
3468 + <mkdir dir="${dist.javadoc.dir}"/>
3469 + <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}">
3471 + <path path="${javac.classpath}"/>
3473 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
3474 + <filename name="**/*.java"/>
3476 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3477 + <include name="**/*.java"/>
3480 + <copy todir="${dist.javadoc.dir}">
3481 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
3482 + <filename name="**/doc-files/**"/>
3484 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3485 + <include name="**/doc-files/**"/>
3489 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
3490 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
3492 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
3494 + =========================
3495 + JUNIT COMPILATION SECTION
3496 + =========================
3498 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
3499 + <mkdir dir="${build.test.classes.dir}"/>
3501 + <target name="-pre-compile-test">
3502 + <!-- Empty placeholder for easier customization. -->
3503 + <!-- You can override this target in the ../build.xml file. -->
3505 + <target if="do.depend.true" name="-compile-test-depend">
3506 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
3508 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
3509 + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir=""/>
3510 + <copy todir="${build.test.classes.dir}"/>
3512 + <target name="-post-compile-test">
3513 + <!-- Empty placeholder for easier customization. -->
3514 + <!-- You can override this target in the ../build.xml file. -->
3516 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
3517 + <target name="-pre-compile-test-single">
3518 + <!-- Empty placeholder for easier customization. -->
3519 + <!-- You can override this target in the ../build.xml file. -->
3521 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
3522 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
3523 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
3524 + <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=""/>
3525 + <copy todir="${build.test.classes.dir}"/>
3527 + <target name="-post-compile-test-single">
3528 + <!-- Empty placeholder for easier customization. -->
3529 + <!-- You can override this target in the ../build.xml file. -->
3531 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
3533 + =======================
3534 + JUNIT EXECUTION SECTION
3535 + =======================
3537 + <target depends="init" if="have.tests" name="-pre-test-run">
3538 + <mkdir dir="${build.test.results.dir}"/>
3540 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
3541 + <j2seproject3:junit testincludes="**/*Test.java"/>
3543 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
3544 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
3546 + <target depends="init" if="have.tests" name="test-report"/>
3547 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
3548 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
3549 + <target depends="init" if="have.tests" name="-pre-test-run-single">
3550 + <mkdir dir="${build.test.results.dir}"/>
3552 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
3553 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
3554 + <j2seproject3:junit excludes="" includes="${test.includes}"/>
3556 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
3557 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
3559 + <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"/>
3561 + =======================
3562 + JUNIT DEBUGGING SECTION
3563 + =======================
3565 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
3566 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
3567 + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
3568 + <delete file="${test.report.file}"/>
3569 + <mkdir dir="${build.test.results.dir}"/>
3570 + <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}">
3573 + <propertyref prefix="test-sys-prop."/>
3574 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3576 + <arg value="${test.class}"/>
3577 + <arg value="showoutput=true"/>
3578 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
3579 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
3581 + </j2seproject3:debug>
3583 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
3584 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
3586 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
3587 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
3588 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
3590 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
3592 + =========================
3593 + APPLET EXECUTION SECTION
3594 + =========================
3596 + <target depends="init,compile-single" name="run-applet">
3597 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
3598 + <j2seproject1:java classname="sun.applet.AppletViewer">
3600 + <arg value="${applet.url}"/>
3602 + </j2seproject1:java>
3605 + =========================
3606 + APPLET DEBUGGING SECTION
3607 + =========================
3609 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
3610 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
3611 + <j2seproject3:debug classname="sun.applet.AppletViewer">
3613 + <arg value="${applet.url}"/>
3615 + </j2seproject3:debug>
3617 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
3623 + <target name="-deps-clean-init" unless="built-clean.properties">
3624 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
3625 + <delete file="${built-clean.properties}" quiet="true"/>
3627 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
3628 + <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
3630 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
3631 + <mkdir dir="${build.dir}"/>
3632 + <touch file="${built-clean.properties}" verbose="false"/>
3633 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
3634 + <antcall target="-warn-already-built-clean"/>
3635 + <propertyfile file="${built-clean.properties}">
3636 + <entry key="${basedir}" value=""/>
3638 + <antcall target="-maybe-call-dep">
3639 + <param name="call.built.properties" value="${built-clean.properties}"/>
3640 + <param location="${project.HotSwapTool}" name="call.subproject"/>
3641 + <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
3642 + <param name="call.target" value="clean"/>
3643 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
3646 + <target depends="init" name="-do-clean">
3647 + <delete dir="${build.dir}"/>
3648 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
3650 + <target name="-post-clean">
3651 + <!-- Empty placeholder for easier customization. -->
3652 + <!-- You can override this target in the ../build.xml file. -->
3654 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
3655 + <target name="-check-call-dep">
3656 + <property file="${call.built.properties}" prefix="already.built."/>
3657 + <condition property="should.call.dep">
3659 + <isset property="already.built.${call.subproject}"/>
3663 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
3664 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
3666 + <propertyref prefix="transfer."/>
3667 + <mapper from="transfer.*" to="*" type="glob"/>
3672 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/configs/Run_All_Tests.properties
3673 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3674 +++ b/hotswaptest/HotSwapTests/nbproject/configs/Run_All_Tests.properties Fri Dec 17 13:23:04 2010 +0100
3676 +$label=Run All Tests
3677 +run.jvmargs=\ -Xdebug -XX:TraceRedefineClasses=4 -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n
3678 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/configs/Run_Natives_Tests.properties
3679 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3680 +++ b/hotswaptest/HotSwapTests/nbproject/configs/Run_Natives_Tests.properties Fri Dec 17 13:23:04 2010 +0100
3682 +$label=Run Natives Tests
3683 +run.jvmargs=\ -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n
3684 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/genfiles.properties
3685 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3686 +++ b/hotswaptest/HotSwapTests/nbproject/genfiles.properties Fri Dec 17 13:23:04 2010 +0100
3688 +nbbuild.xml.data.CRC32=c8ab650e
3689 +nbbuild.xml.script.CRC32=2ea92a55
3690 +nbbuild.xml.stylesheet.CRC32=958a1d3e@1.26.2.45
3691 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
3692 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
3693 +nbproject/build-impl.xml.data.CRC32=c46425e2
3694 +nbproject/build-impl.xml.script.CRC32=2aba14d0
3695 +nbproject/build-impl.xml.stylesheet.CRC32=fce8b508@1.40.0.45
3696 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/project.properties
3697 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3698 +++ b/hotswaptest/HotSwapTests/nbproject/project.properties Fri Dec 17 13:23:04 2010 +0100
3700 +application.title=HotSwapTests
3701 +application.vendor=Thomas
3702 +build.classes.dir=${build.dir}/classes
3703 +build.classes.excludes=**/*.java,**/*.form
3704 +# This directory is removed when the project is cleaned:
3706 +build.generated.dir=${build.dir}/generated
3707 +build.generated.sources.dir=${build.dir}/generated-sources
3708 +# Only compile against the classpath explicitly listed here:
3709 +build.sysclasspath=ignore
3710 +build.test.classes.dir=${build.dir}/test/classes
3711 +build.test.results.dir=${build.dir}/test/results
3712 +buildfile=build.xml
3713 +# Uncomment to specify the preferred debugger connection transport:
3714 +#debug.transport=dt_socket
3717 +debug.test.classpath=\
3718 + ${run.test.classpath}
3719 +# This directory is removed when the project is cleaned:
3721 +dist.jar=${dist.dir}/HotSwapTests.jar
3722 +dist.javadoc.dir=${dist.dir}/javadoc
3723 +endorsed.classpath=
3725 +file.reference.asm-all-3.2.jar=../lib/asm-all-3.2.jar
3726 +file.reference.HotSwapTests-src=src
3727 +file.reference.tools.jar=../lib/tools.jar
3731 + ${libs.junit_4.classpath}:\
3732 + ${reference.HotSwapTool.jar}:\
3733 + ${file.reference.asm-all-3.2.jar}:\
3734 + ${file.reference.tools.jar}
3735 +# Space-separated list of extra javac options
3736 +javac.compilerargs=
3737 +javac.deprecation=false
3740 +javac.test.classpath=\
3741 + ${javac.classpath}:\
3742 + ${build.classes.dir}:\
3743 + ${libs.junit.classpath}:\
3744 + ${libs.junit_4.classpath}
3745 +javadoc.additionalparam=
3746 +javadoc.author=false
3747 +javadoc.encoding=${source.encoding}
3748 +javadoc.noindex=false
3749 +javadoc.nonavbar=false
3750 +javadoc.notree=false
3751 +javadoc.private=false
3752 +javadoc.splitindex=true
3754 +javadoc.version=false
3755 +javadoc.windowtitle=
3756 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
3757 +jnlp.codebase.type=local
3758 +jnlp.descriptor=application
3760 +jnlp.offline-allowed=false
3762 +main.class=at.ssw.hotswap.test.Main
3763 +manifest.file=manifest.mf
3764 +meta.inf.dir=${src.dir}/META-INF
3765 +platform.active=JDK_1.7_HotSwap
3766 +project.HotSwapTool=../HotSwapTool
3767 +reference.HotSwapTool.jar=${project.HotSwapTool}/dist/HotSwapTool.jar
3769 + ${javac.classpath}:\
3770 + ${build.classes.dir}
3771 +run.test.classpath=\
3772 + ${javac.test.classpath}:\
3773 + ${build.test.classes.dir}
3774 +source.encoding=UTF-8
3775 +src.dir=${file.reference.HotSwapTests-src}
3776 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/project.xml
3777 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3778 +++ b/hotswaptest/HotSwapTests/nbproject/project.xml Fri Dec 17 13:23:04 2010 +0100
3780 +<?xml version="1.0" encoding="UTF-8"?>
3781 +<project xmlns="http://www.netbeans.org/ns/project/1">
3782 + <type>org.netbeans.modules.java.j2seproject</type>
3784 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
3785 + <name>HotSwapTests</name>
3786 + <minimum-ant-version>1.6.5</minimum-ant-version>
3787 + <explicit-platform explicit-source-supported="true"/>
3789 + <root id="src.dir"/>
3793 + <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
3795 + <foreign-project>HotSwapTool</foreign-project>
3796 + <artifact-type>jar</artifact-type>
3797 + <script>build.xml</script>
3798 + <target>jar</target>
3799 + <clean-target>clean</clean-target>
3805 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java
3806 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3807 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java Fri Dec 17 13:23:04 2010 +0100
3810 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3811 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3813 + * This code is free software; you can redistribute it and/or modify it
3814 + * under the terms of the GNU General Public License version 2 only, as
3815 + * published by the Free Software Foundation.
3817 + * This code is distributed in the hope that it will be useful, but WITHOUT
3818 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3819 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3820 + * version 2 for more details (a copy is included in the LICENSE file that
3821 + * accompanied this code).
3823 + * You should have received a copy of the GNU General Public License version
3824 + * 2 along with this work; if not, write to the Free Software Foundation,
3825 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3827 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3828 + * or visit www.oracle.com if you need additional information or have any
3833 +package at.ssw.hotswap.test;
3835 +import at.ssw.hotswap.test.accesstests.AccessTestSuite;
3836 +import org.junit.runner.RunWith;
3837 +import org.junit.runners.Suite;
3839 +import at.ssw.hotswap.test.body.BodyTestSuite;
3840 +import at.ssw.hotswap.test.eval.EvalTestSuite;
3841 +import at.ssw.hotswap.test.fields.FieldsTestSuite;
3842 +import at.ssw.hotswap.test.methods.MethodsTestSuite;
3843 +import at.ssw.hotswap.test.natives.NativesTestSuite;
3844 +import at.ssw.hotswap.test.transformer.TransformerTestSuite;
3845 +import at.ssw.hotswap.test.structural.StructuralTestSuite;
3848 + * Summarizes all available test suites.
3850 + * @author Thomas Wuerthinger
3852 +@RunWith(Suite.class)
3853 +@Suite.SuiteClasses({
3854 + BodyTestSuite.class,
3855 + EvalTestSuite.class,
3856 + MethodsTestSuite.class,
3857 + FieldsTestSuite.class,
3858 + StructuralTestSuite.class,
3859 + TransformerTestSuite.class,
3860 + NativesTestSuite.class,
3861 + AccessTestSuite.class
3863 +public class CompleteTestSuite {
3865 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java
3866 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3867 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java Fri Dec 17 13:23:04 2010 +0100
3870 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3871 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3873 + * This code is free software; you can redistribute it and/or modify it
3874 + * under the terms of the GNU General Public License version 2 only, as
3875 + * published by the Free Software Foundation.
3877 + * This code is distributed in the hope that it will be useful, but WITHOUT
3878 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3879 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3880 + * version 2 for more details (a copy is included in the LICENSE file that
3881 + * accompanied this code).
3883 + * You should have received a copy of the GNU General Public License version
3884 + * 2 along with this work; if not, write to the Free Software Foundation,
3885 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3887 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3888 + * or visit www.oracle.com if you need additional information or have any
3893 +package at.ssw.hotswap.test;
3895 +import at.ssw.hotswap.HotSwapTool;
3896 +import java.io.File;
3897 +import java.util.HashSet;
3898 +import java.util.Set;
3899 +import org.junit.runner.Description;
3900 +import org.junit.runner.JUnitCore;
3901 +import org.junit.runner.Request;
3902 +import org.junit.runner.manipulation.Filter;
3903 +import org.junit.runner.notification.Failure;
3904 +import org.junit.runner.notification.RunListener;
3907 + * Main class for running class redefinition tests. Make sure that the execution directory is set such that this class file
3908 + * can be reached via "at/ssw/hotswap/test/Main.class".
3910 + * There are different levels of redefinition:
3911 + * Swap method bodies < add/remove methods < add/remove fields < add/remove super type
3913 + * Make sure that the application is started with a Java debug agent on port 4000. If you specify an argument, only tests
3914 + * containing the specified string are executed.
3917 + * <pre>java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n at.ssw.hotswap.test.Main SimpleTest</pre>
3919 + * @author Thomas Wuerthinger
3922 + * If a first parameter is given, then only tests with a name containing this parameter are executed.
3924 + * Default values of system properties that can be overwritten:
3925 + * -Dhotswap.trace=0
3928 +public class Main {
3930 + private static int failedCount;
3931 + private static int finishedCount;
3932 + private static String failureString = "";
3934 + public static void main(final String[] args) {
3936 + boolean runNativeTests = true;
3937 + String nativeLibraryName = new File("../../../HotSwapTestsNatives/dist/" + System.mapLibraryName("libHotSwapTestsNatives")).getAbsolutePath();
3939 + System.out.println("Load native library: ");
3940 + System.load(nativeLibraryName);
3941 + } catch(UnsatisfiedLinkError e) {
3942 + System.out.println("WARNING: Could not load native library from path " + nativeLibraryName);
3943 + System.out.println("Disabling native tests");
3944 + runNativeTests = false;
3947 + System.out.println("Running JUnit tests: ");
3949 + JUnitCore core = new JUnitCore();
3950 + core.addListener(runListener);
3951 + Request request = Request.classes(CompleteTestSuite.class);
3952 + HotSwapTool.setTraceLevel(Integer.parseInt(System.getProperty("hotswap.trace", "0")));
3954 + // Filter the request?
3955 + if (args.length > 0) {
3957 + System.out.println("Only run tests containing \"" + args[0] + "\"");
3959 + request = request.filterWith(new Filter() {
3962 + public String describe() {
3966 + private Set<Description> childrenToRun = new HashSet<Description>();
3969 + public boolean shouldRun(Description d) {
3970 + System.out.println(d.getDisplayName());
3972 + if (d.getDisplayName().contains(args[0]) || childrenToRun.contains(d)) {
3973 + childrenToRun.addAll(d.getChildren());
3977 + // explicitly check if any children want to run
3978 + for (Description each : d.getChildren()) {
3979 + if (shouldRun(each)) {
3989 + long startTime = System.currentTimeMillis();
3990 + core.run(request);
3991 + long time = System.currentTimeMillis() - startTime;
3993 + System.out.println("" + (finishedCount - failedCount) + " of " + finishedCount + " tests are OK!");
3994 + System.out.println("Time: " + ((double) time) / 1000);
3995 + if (failedCount == 0) {
3996 + System.out.println("ALL OK");
3998 + System.out.println(failedCount + " FAILURES: " + failureString);
4002 + private static RunListener runListener = new RunListener() {
4005 + public void testStarted(Description description) throws Exception {
4006 + System.out.println("============================================================");
4007 + System.out.println("Test started: " + description.getDisplayName());
4011 + public void testFailure(Failure failure) throws Exception {
4012 + System.out.println("Test failure: " + failure.getMessage());
4013 + failure.getException().printStackTrace();
4015 + failureString += failure.getDescription().getDisplayName() + " ";
4019 + public void testFinished(Description description) throws Exception {
4020 + System.out.println("Test finished: " + description.getDisplayName());
4025 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java
4026 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4027 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java Fri Dec 17 13:23:04 2010 +0100
4030 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4031 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4033 + * This code is free software; you can redistribute it and/or modify it
4034 + * under the terms of the GNU General Public License version 2 only, as
4035 + * published by the Free Software Foundation.
4037 + * This code is distributed in the hope that it will be useful, but WITHOUT
4038 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4039 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4040 + * version 2 for more details (a copy is included in the LICENSE file that
4041 + * accompanied this code).
4043 + * You should have received a copy of the GNU General Public License version
4044 + * 2 along with this work; if not, write to the Free Software Foundation,
4045 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4047 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4048 + * or visit www.oracle.com if you need additional information or have any
4053 +package at.ssw.hotswap.test;
4055 +import junit.framework.Assert;
4059 + * Utility methods for unit testing.
4061 + * @author Thomas Wuerthinger
4063 +public class TestUtil {
4065 + public static int assertException(Class exceptionClass, Runnable run) {
4069 + } catch(Throwable t) {
4070 + if (t.getClass().equals(exceptionClass)) {
4071 + return t.getStackTrace()[0].getLineNumber();
4073 + Assert.assertTrue("An exception of type " + t.getClass().getSimpleName() + " instead of " + exceptionClass.getSimpleName() + " has been thrown!", false);
4076 + Assert.assertTrue("No exception has been thrown!", false);
4080 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/ClassAccess.java
4081 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4082 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/ClassAccess.java Fri Dec 17 13:23:04 2010 +0100
4085 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4086 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4088 + * This code is free software; you can redistribute it and/or modify it
4089 + * under the terms of the GNU General Public License version 2 only, as
4090 + * published by the Free Software Foundation.
4092 + * This code is distributed in the hope that it will be useful, but WITHOUT
4093 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4094 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4095 + * version 2 for more details (a copy is included in the LICENSE file that
4096 + * accompanied this code).
4098 + * You should have received a copy of the GNU General Public License version
4099 + * 2 along with this work; if not, write to the Free Software Foundation,
4100 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4102 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4103 + * or visit www.oracle.com if you need additional information or have any
4107 +package at.ssw.hotswap.test.access;
4109 +import java.util.List;
4112 + * @author Kerstin Breiteneder
4113 + * @author Christoph Wimberger
4115 +public interface ClassAccess {
4117 + public String getName();
4119 + public MethodAccess findMethod(String method);
4121 + public List<MethodAccess> getMethods();
4123 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/MethodAccess.java
4124 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4125 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/MethodAccess.java Fri Dec 17 13:23:04 2010 +0100
4128 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4129 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4131 + * This code is free software; you can redistribute it and/or modify it
4132 + * under the terms of the GNU General Public License version 2 only, as
4133 + * published by the Free Software Foundation.
4135 + * This code is distributed in the hope that it will be useful, but WITHOUT
4136 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4137 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4138 + * version 2 for more details (a copy is included in the LICENSE file that
4139 + * accompanied this code).
4141 + * You should have received a copy of the GNU General Public License version
4142 + * 2 along with this work; if not, write to the Free Software Foundation,
4143 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4145 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4146 + * or visit www.oracle.com if you need additional information or have any
4150 +package at.ssw.hotswap.test.access;
4152 +import java.util.List;
4155 + * @author Kerstin Breiteneder
4156 + * @author Christoph Wimberger
4158 +public interface MethodAccess {
4160 + public String getName();
4162 + public String getSignature();
4164 + public boolean canCheckObsoletness();
4166 + public boolean isObsolete();
4168 + public Object invoke(Object[] o, Object instance);
4170 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/StackFrameAccess.java
4171 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4172 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/StackFrameAccess.java Fri Dec 17 13:23:04 2010 +0100
4175 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4176 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4178 + * This code is free software; you can redistribute it and/or modify it
4179 + * under the terms of the GNU General Public License version 2 only, as
4180 + * published by the Free Software Foundation.
4182 + * This code is distributed in the hope that it will be useful, but WITHOUT
4183 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4184 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4185 + * version 2 for more details (a copy is included in the LICENSE file that
4186 + * accompanied this code).
4188 + * You should have received a copy of the GNU General Public License version
4189 + * 2 along with this work; if not, write to the Free Software Foundation,
4190 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4192 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4193 + * or visit www.oracle.com if you need additional information or have any
4197 +package at.ssw.hotswap.test.access;
4200 + * @author Kerstin Breiteneder
4201 + * @author Christoph Wimberger
4203 +public interface StackFrameAccess {
4205 + public MethodAccess getMethod() throws ClassNotFoundException;
4207 + public ClassAccess getClazz();
4209 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/VMAccess.java
4210 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4211 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/VMAccess.java Fri Dec 17 13:23:04 2010 +0100
4214 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4215 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4217 + * This code is free software; you can redistribute it and/or modify it
4218 + * under the terms of the GNU General Public License version 2 only, as
4219 + * published by the Free Software Foundation.
4221 + * This code is distributed in the hope that it will be useful, but WITHOUT
4222 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4223 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4224 + * version 2 for more details (a copy is included in the LICENSE file that
4225 + * accompanied this code).
4227 + * You should have received a copy of the GNU General Public License version
4228 + * 2 along with this work; if not, write to the Free Software Foundation,
4229 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4231 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4232 + * or visit www.oracle.com if you need additional information or have any
4236 +package at.ssw.hotswap.test.access;
4238 +import java.util.List;
4241 + * @author Kerstin Breiteneder
4242 + * @author Christoph Wimberger
4244 +public interface VMAccess {
4246 + public boolean canGetFrames();
4248 + public List<StackFrameAccess> getFrames(final String threadName);
4250 + public List<String> getThreadNames();
4252 + public ClassAccess findClass(String clazz);
4254 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIClassAccess.java
4255 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4256 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIClassAccess.java Fri Dec 17 13:23:04 2010 +0100
4259 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4260 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4262 + * This code is free software; you can redistribute it and/or modify it
4263 + * under the terms of the GNU General Public License version 2 only, as
4264 + * published by the Free Software Foundation.
4266 + * This code is distributed in the hope that it will be useful, but WITHOUT
4267 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4268 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4269 + * version 2 for more details (a copy is included in the LICENSE file that
4270 + * accompanied this code).
4272 + * You should have received a copy of the GNU General Public License version
4273 + * 2 along with this work; if not, write to the Free Software Foundation,
4274 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4276 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4277 + * or visit www.oracle.com if you need additional information or have any
4281 +package at.ssw.hotswap.test.access.jdi;
4283 +import at.ssw.hotswap.test.access.ClassAccess;
4284 +import at.ssw.hotswap.test.access.MethodAccess;
4285 +import com.sun.jdi.Method;
4286 +import com.sun.jdi.ReferenceType;
4287 +import java.util.ArrayList;
4288 +import java.util.List;
4291 + * @author Kerstin Breiteneder
4292 + * @author Christoph Wimberger
4294 +public class JDIClassAccess implements ClassAccess {
4296 + private ReferenceType clazz;
4298 + public JDIClassAccess(ReferenceType clazz) {
4299 + this.clazz = clazz;
4303 + public String getName() {
4304 + return clazz.name();
4308 + public MethodAccess findMethod(String method) {
4309 + List<Method> methods = clazz.methodsByName(method);
4310 + List<Method> newMethods = new ArrayList<Method>();
4311 + for (Method m : methods) {
4312 + if (!m.isObsolete()) {
4313 + newMethods.add(m);
4316 + if (newMethods.size() > 1) {
4317 + throw new RuntimeException("ambiguous methods: " + newMethods.get(0) + ", " + newMethods.get(1));
4319 + if (newMethods.isEmpty()) {
4322 + return new JDIMethodAccess(newMethods.get(0), clazz);
4326 + public List<MethodAccess> getMethods() {
4327 + List<MethodAccess> methodAccesses = new ArrayList<MethodAccess>();
4328 + for (Method m : clazz.methods()) {
4329 + if (!m.name().equals("<init>")) {
4330 + methodAccesses.add(new JDIMethodAccess(m, clazz));
4333 + return methodAccesses;
4336 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIMethodAccess.java
4337 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4338 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIMethodAccess.java Fri Dec 17 13:23:04 2010 +0100
4341 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4342 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4344 + * This code is free software; you can redistribute it and/or modify it
4345 + * under the terms of the GNU General Public License version 2 only, as
4346 + * published by the Free Software Foundation.
4348 + * This code is distributed in the hope that it will be useful, but WITHOUT
4349 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4350 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4351 + * version 2 for more details (a copy is included in the LICENSE file that
4352 + * accompanied this code).
4354 + * You should have received a copy of the GNU General Public License version
4355 + * 2 along with this work; if not, write to the Free Software Foundation,
4356 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4358 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4359 + * or visit www.oracle.com if you need additional information or have any
4363 +package at.ssw.hotswap.test.access.jdi;
4365 +import at.ssw.hotswap.JDIProxy;
4366 +import at.ssw.hotswap.test.access.MethodAccess;
4367 +import com.sun.jdi.ClassNotLoadedException;
4368 +import com.sun.jdi.ClassType;
4369 +import com.sun.jdi.IncompatibleThreadStateException;
4370 +import com.sun.jdi.InvalidTypeException;
4371 +import com.sun.jdi.InvocationException;
4372 +import com.sun.jdi.Method;
4373 +import com.sun.jdi.ReferenceType;
4374 +import com.sun.jdi.ThreadReference;
4375 +import com.sun.jdi.Type;
4376 +import java.lang.reflect.Modifier;
4377 +import java.util.ArrayList;
4378 +import java.util.logging.Level;
4379 +import java.util.logging.Logger;
4382 + * @author Kerstin Breiteneder
4383 + * @author Christoph Wimberger
4385 +public class JDIMethodAccess implements MethodAccess {
4387 + private Method method;
4389 + public JDIMethodAccess(Method m, ReferenceType clazz) {
4394 + public String toString() {
4395 + return method.toString();
4399 + public String getName() {
4400 + return method.name();
4404 + public String getSignature() {
4405 + String methodString = Modifier.toString(method.modifiers()) + " " + method.returnTypeName() + " " + method.name() + "(";
4406 + boolean paramFound = false;
4408 + for (Type type : method.argumentTypes()) {
4410 + methodString += ", ";
4412 + paramFound = true;
4413 + methodString += type.name();
4415 + } catch (ClassNotLoadedException ex) {
4416 + throw new RuntimeException(ex);
4418 + return methodString + ")";
4422 + public boolean canCheckObsoletness() {
4427 + public boolean isObsolete() {
4428 + return method.isObsolete();
4432 + public Object invoke(Object[] o, Object instance) {
4433 + Thread tempthread = new Thread("invokeThread") {
4436 + public void run() {
4439 + } catch (InterruptedException ex) {
4440 + Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
4444 + tempthread.start();
4446 + // get Main-Thread
4447 + final JDIProxy jdi = JDIProxy.getJDI();
4448 + ThreadReference reference = null;
4449 + for (ThreadReference t : jdi.getVM().allThreads()) {
4450 + if (t.name().equals("invokeThread")) {
4455 + // reference.suspend();
4457 + Object obj = null;
4459 + obj = ((ClassType) method.declaringType()).invokeMethod(reference, method, new ArrayList(), ClassType.INVOKE_SINGLE_THREADED);
4460 + } catch (InvalidTypeException ex) {
4461 + Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
4462 + } catch (ClassNotLoadedException ex) {
4463 + Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
4464 + } catch (IncompatibleThreadStateException ex) {
4465 + Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
4466 + } catch (InvocationException ex) {
4467 + Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
4469 + // reference.resume();
4473 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIStackFrameAccess.java
4474 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4475 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIStackFrameAccess.java Fri Dec 17 13:23:04 2010 +0100
4478 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4479 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4481 + * This code is free software; you can redistribute it and/or modify it
4482 + * under the terms of the GNU General Public License version 2 only, as
4483 + * published by the Free Software Foundation.
4485 + * This code is distributed in the hope that it will be useful, but WITHOUT
4486 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4487 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4488 + * version 2 for more details (a copy is included in the LICENSE file that
4489 + * accompanied this code).
4491 + * You should have received a copy of the GNU General Public License version
4492 + * 2 along with this work; if not, write to the Free Software Foundation,
4493 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4495 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4496 + * or visit www.oracle.com if you need additional information or have any
4500 +package at.ssw.hotswap.test.access.jdi;
4502 +import at.ssw.hotswap.test.access.ClassAccess;
4503 +import at.ssw.hotswap.test.access.MethodAccess;
4504 +import at.ssw.hotswap.test.access.StackFrameAccess;
4505 +import com.sun.jdi.Method;
4506 +import com.sun.jdi.ReferenceType;
4507 +import com.sun.jdi.StackFrame;
4510 + * @author Kerstin Breiteneder
4511 + * @author Christoph Wimberger
4513 +public class JDIStackFrameAccess implements StackFrameAccess {
4515 + private ReferenceType clazz;
4516 + private Method method;
4517 + private MethodAccess methodAccess;
4518 + private ClassAccess classAccess;
4520 + JDIStackFrameAccess(StackFrame s) {
4521 + method = s.location().method();
4522 + clazz = s.location().method().declaringType();
4526 + public MethodAccess getMethod() {
4527 + if (methodAccess == null) {
4528 + methodAccess = new JDIMethodAccess(method, clazz);
4530 + return methodAccess;
4534 + public ClassAccess getClazz() {
4535 + if (classAccess == null) {
4536 + classAccess = new JDIClassAccess(clazz);
4538 + return classAccess;
4542 + public String toString() {
4543 + return method.toString();
4546 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIVMAccess.java
4547 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4548 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIVMAccess.java Fri Dec 17 13:23:04 2010 +0100
4551 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4552 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4554 + * This code is free software; you can redistribute it and/or modify it
4555 + * under the terms of the GNU General Public License version 2 only, as
4556 + * published by the Free Software Foundation.
4558 + * This code is distributed in the hope that it will be useful, but WITHOUT
4559 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4560 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4561 + * version 2 for more details (a copy is included in the LICENSE file that
4562 + * accompanied this code).
4564 + * You should have received a copy of the GNU General Public License version
4565 + * 2 along with this work; if not, write to the Free Software Foundation,
4566 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4568 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4569 + * or visit www.oracle.com if you need additional information or have any
4573 +package at.ssw.hotswap.test.access.jdi;
4575 +import at.ssw.hotswap.JDIProxy;
4576 +import at.ssw.hotswap.test.access.ClassAccess;
4577 +import at.ssw.hotswap.test.access.StackFrameAccess;
4578 +import at.ssw.hotswap.test.access.VMAccess;
4579 +import com.sun.jdi.IncompatibleThreadStateException;
4580 +import com.sun.jdi.ReferenceType;
4581 +import com.sun.jdi.StackFrame;
4582 +import com.sun.jdi.ThreadReference;
4583 +import java.util.ArrayList;
4584 +import java.util.List;
4585 +import java.util.logging.Level;
4586 +import java.util.logging.Logger;
4589 + * @author Kerstin Breiteneder
4590 + * @author Christoph Wimberger
4592 +public class JDIVMAccess implements VMAccess {
4594 + private List<ThreadReference> getThreads() {
4595 + final JDIProxy jdi = JDIProxy.getJDI();
4596 + return jdi.getVM().allThreads();
4600 + public boolean canGetFrames() {
4605 + public List<StackFrameAccess> getFrames(final String threadName) {
4606 + final JDIProxy jdi = JDIProxy.getJDI();
4607 + final Exception[] exception = new Exception[1];
4608 + final Object[] object = new Object[1];
4610 + exception[0] = null;
4612 + Runnable r = new Runnable() {
4614 + public void run() {
4615 + List<StackFrameAccess> stackAccesses = new ArrayList<StackFrameAccess>();
4616 + for (ThreadReference t : getThreads()) {
4617 + if (t.name().equals(threadName)) {
4619 + for (StackFrame stack : t.frames()) {
4620 + StackFrameAccess stackAccess = new JDIStackFrameAccess(stack);
4621 + stackAccesses.add(stackAccess);
4623 + } catch (IncompatibleThreadStateException ex) {
4624 + exception[0] = ex;
4626 + object[0] = stackAccesses;
4633 + jdi.executeSuspended(r);
4635 + if (exception[0] != null) {
4636 + throw new RuntimeException(exception[0]);
4638 + return (List<StackFrameAccess>) object[0];
4642 + public List<String> getThreadNames() {
4643 + List<String> threadNames = new ArrayList<String>();
4645 + for (ThreadReference t : getThreads()) {
4646 + threadNames.add(t.name());
4648 + return threadNames;
4652 + public ClassAccess findClass(String clazz) {
4653 + final JDIProxy jdi = JDIProxy.getJDI();
4654 + ReferenceType found = null;
4655 + // ensures, that all classes are retrieved
4656 + jdi.refreshAllClasses();
4657 + for (ReferenceType referenceType : jdi.getVM().allClasses()) {
4658 + if (referenceType.name().equals(clazz)) {
4659 + if (found != null) {
4660 + throw new RuntimeException("ambiguous class name");
4662 + found = referenceType;
4665 + if (found == null) {
4668 + return new JDIClassAccess(found);
4671 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIClassAccess.java
4672 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4673 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIClassAccess.java Fri Dec 17 13:23:04 2010 +0100
4676 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4677 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4679 + * This code is free software; you can redistribute it and/or modify it
4680 + * under the terms of the GNU General Public License version 2 only, as
4681 + * published by the Free Software Foundation.
4683 + * This code is distributed in the hope that it will be useful, but WITHOUT
4684 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4685 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4686 + * version 2 for more details (a copy is included in the LICENSE file that
4687 + * accompanied this code).
4689 + * You should have received a copy of the GNU General Public License version
4690 + * 2 along with this work; if not, write to the Free Software Foundation,
4691 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4693 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4694 + * or visit www.oracle.com if you need additional information or have any
4698 +package at.ssw.hotswap.test.access.jni;
4700 +import at.ssw.hotswap.test.access.ClassAccess;
4701 +import at.ssw.hotswap.test.access.MethodAccess;
4702 +import java.lang.reflect.Method;
4703 +import java.util.ArrayList;
4704 +import java.util.List;
4707 + * @author Kerstin Breiteneder
4708 + * @author Christoph Wimberger
4710 +public class JNIClassAccess implements ClassAccess {
4714 + public JNIClassAccess(Class clazz) {
4715 + this.clazz = clazz;
4719 + public String getName() {
4720 + return clazz.getName();
4723 + public static native Method findMethodNative(Class clazz, String methodName);
4726 + public MethodAccess findMethod(String methodName) {
4729 + m = findMethodNative(clazz, methodName);
4730 + } catch (NoSuchMethodError ex) {
4733 + return new JNIMethodAccess(m);
4736 + public static native Method[] getMethodsNative(Class clazz);
4739 + public List<MethodAccess> getMethods() {
4740 + Method[] array = getMethodsNative(clazz);
4741 + List<MethodAccess> mAccesses = new ArrayList<MethodAccess>();
4742 + for (int i = 0; i < array.length; i++) {
4743 + mAccesses.add(new JNIMethodAccess(array[i]));
4748 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIMethodAccess.java
4749 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4750 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIMethodAccess.java Fri Dec 17 13:23:04 2010 +0100
4753 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4754 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4756 + * This code is free software; you can redistribute it and/or modify it
4757 + * under the terms of the GNU General Public License version 2 only, as
4758 + * published by the Free Software Foundation.
4760 + * This code is distributed in the hope that it will be useful, but WITHOUT
4761 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4762 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4763 + * version 2 for more details (a copy is included in the LICENSE file that
4764 + * accompanied this code).
4766 + * You should have received a copy of the GNU General Public License version
4767 + * 2 along with this work; if not, write to the Free Software Foundation,
4768 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4770 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4771 + * or visit www.oracle.com if you need additional information or have any
4775 +package at.ssw.hotswap.test.access.jni;
4777 +import at.ssw.hotswap.test.access.MethodAccess;
4778 +import java.lang.reflect.Method;
4779 +import java.lang.reflect.Modifier;
4780 +import org.objectweb.asm.Type;
4783 + * @author Kerstin Breiteneder
4784 + * @author Christoph Wimberger
4786 +public class JNIMethodAccess implements MethodAccess {
4790 + public JNIMethodAccess(Method m) {
4795 + public String getName() {
4796 + return method.getName();
4800 + public String getSignature() {
4801 + String methodString = Modifier.toString(method.getModifiers()) + " " + method.getReturnType().getName() + " " + method.getName() + "(";
4802 + boolean paramFound = false;
4803 + for (Class c : method.getParameterTypes()) {
4805 + methodString += ", ";
4807 + paramFound = true;
4808 + methodString += c.getName();
4810 + return methodString + ")";
4814 + public boolean canCheckObsoletness() {
4815 + throw new UnsupportedOperationException("Not supported yet.");
4819 + public boolean isObsolete() {
4820 + throw new UnsupportedOperationException("Not supported yet.");
4823 + public static native Object invokeMethodNative(Class clazz, Object obj, String methodName, String retValue, boolean staticValue, String descriptor, Object[] params);
4826 + public Object invoke(Object[] o, Object instance) {
4827 + boolean staticValue = java.lang.reflect.Modifier.isStatic(method.getModifiers());
4828 + String retValue = method.getReturnType().getName();
4829 + String descriptor = new org.objectweb.asm.commons.Method(method.getName(), Type.getReturnType(method), Type.getArgumentTypes(method)).getDescriptor();
4831 + return invokeMethodNative(method.getDeclaringClass(), instance, method.getName(), retValue, staticValue, descriptor, o);
4834 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIStackFrameAccess.java
4835 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4836 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIStackFrameAccess.java Fri Dec 17 13:23:04 2010 +0100
4839 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4840 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4842 + * This code is free software; you can redistribute it and/or modify it
4843 + * under the terms of the GNU General Public License version 2 only, as
4844 + * published by the Free Software Foundation.
4846 + * This code is distributed in the hope that it will be useful, but WITHOUT
4847 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4848 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4849 + * version 2 for more details (a copy is included in the LICENSE file that
4850 + * accompanied this code).
4852 + * You should have received a copy of the GNU General Public License version
4853 + * 2 along with this work; if not, write to the Free Software Foundation,
4854 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4856 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4857 + * or visit www.oracle.com if you need additional information or have any
4861 +package at.ssw.hotswap.test.access.jni;
4863 +import at.ssw.hotswap.test.access.ClassAccess;
4864 +import at.ssw.hotswap.test.access.MethodAccess;
4865 +import at.ssw.hotswap.test.access.StackFrameAccess;
4868 + * @author Kerstin Breiteneder
4869 + * @author Christoph Wimberger
4871 +public class JNIStackFrameAccess implements StackFrameAccess {
4874 + public MethodAccess getMethod() throws ClassNotFoundException {
4875 + throw new UnsupportedOperationException("Not supported yet.");
4879 + public ClassAccess getClazz() {
4880 + throw new UnsupportedOperationException("Not supported yet.");
4883 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIVMAccess.java
4884 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4885 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIVMAccess.java Fri Dec 17 13:23:04 2010 +0100
4888 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4889 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4891 + * This code is free software; you can redistribute it and/or modify it
4892 + * under the terms of the GNU General Public License version 2 only, as
4893 + * published by the Free Software Foundation.
4895 + * This code is distributed in the hope that it will be useful, but WITHOUT
4896 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4897 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4898 + * version 2 for more details (a copy is included in the LICENSE file that
4899 + * accompanied this code).
4901 + * You should have received a copy of the GNU General Public License version
4902 + * 2 along with this work; if not, write to the Free Software Foundation,
4903 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4905 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4906 + * or visit www.oracle.com if you need additional information or have any
4910 +package at.ssw.hotswap.test.access.jni;
4912 +import at.ssw.hotswap.test.access.ClassAccess;
4913 +import at.ssw.hotswap.test.access.StackFrameAccess;
4914 +import at.ssw.hotswap.test.access.VMAccess;
4915 +import java.io.File;
4916 +import java.util.List;
4919 + * @author Kerstin Breiteneder
4920 + * @author Christoph Wimberger
4922 +public class JNIVMAccess implements VMAccess {
4925 + public boolean canGetFrames() {
4930 + public List<StackFrameAccess> getFrames(String threadName) {
4931 + throw new UnsupportedOperationException("Not supported yet.");
4935 + public List<String> getThreadNames() {
4936 + throw new UnsupportedOperationException("Not supported yet.");
4939 + public static native Class findClassNative(String clazz) throws ClassNotFoundException, NoClassDefFoundError;
4942 + public ClassAccess findClass(String clazz) {
4944 + return new JNIClassAccess(findClassNative(clazz.replace('.', '/')));
4945 + } catch (ClassNotFoundException ex) {
4947 + } catch (NoClassDefFoundError ex) {
4952 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionClassAccess.java
4953 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4954 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionClassAccess.java Fri Dec 17 13:23:04 2010 +0100
4957 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4958 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4960 + * This code is free software; you can redistribute it and/or modify it
4961 + * under the terms of the GNU General Public License version 2 only, as
4962 + * published by the Free Software Foundation.
4964 + * This code is distributed in the hope that it will be useful, but WITHOUT
4965 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4966 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4967 + * version 2 for more details (a copy is included in the LICENSE file that
4968 + * accompanied this code).
4970 + * You should have received a copy of the GNU General Public License version
4971 + * 2 along with this work; if not, write to the Free Software Foundation,
4972 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4974 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4975 + * or visit www.oracle.com if you need additional information or have any
4979 +package at.ssw.hotswap.test.access.reflection;
4981 +import at.ssw.hotswap.test.access.ClassAccess;
4982 +import at.ssw.hotswap.test.access.MethodAccess;
4983 +import java.lang.reflect.Method;
4984 +import java.util.ArrayList;
4985 +import java.util.List;
4988 + * @author Kerstin Breiteneder
4989 + * @author Christoph Wimberger
4991 +public class ReflectionClassAccess implements ClassAccess {
4993 + private Class clazz;
4995 + public ReflectionClassAccess() {
4997 + public ReflectionClassAccess(String name) throws ClassNotFoundException {
4998 + clazz = Class.forName(name);
5002 + public String getName() {
5003 + return clazz.getName();
5007 + public MethodAccess findMethod(String method) {
5009 + return new ReflectionMethodAccess(method, clazz.getName());
5010 + } catch (ClassNotFoundException ex) {
5012 + } catch (NoSuchMethodError ex) {
5018 + public List<MethodAccess> getMethods() {
5019 + List<MethodAccess> methodAccesses = new ArrayList<MethodAccess>();
5020 + for (Method m : clazz.getDeclaredMethods()) {
5021 + methodAccesses.add(new ReflectionMethodAccess(m, clazz));
5023 + return methodAccesses;
5026 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionMethodAccess.java
5027 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5028 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionMethodAccess.java Fri Dec 17 13:23:04 2010 +0100
5031 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5032 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5034 + * This code is free software; you can redistribute it and/or modify it
5035 + * under the terms of the GNU General Public License version 2 only, as
5036 + * published by the Free Software Foundation.
5038 + * This code is distributed in the hope that it will be useful, but WITHOUT
5039 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5040 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5041 + * version 2 for more details (a copy is included in the LICENSE file that
5042 + * accompanied this code).
5044 + * You should have received a copy of the GNU General Public License version
5045 + * 2 along with this work; if not, write to the Free Software Foundation,
5046 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5048 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5049 + * or visit www.oracle.com if you need additional information or have any
5053 +package at.ssw.hotswap.test.access.reflection;
5055 +import at.ssw.hotswap.test.access.MethodAccess;
5056 +import java.lang.reflect.InvocationTargetException;
5057 +import java.lang.reflect.Method;
5058 +import java.lang.reflect.Modifier;
5061 + * @author Kerstin Breiteneder
5062 + * @author Christoph Wimberger
5064 +public class ReflectionMethodAccess implements MethodAccess {
5066 + private Method method;
5068 + public ReflectionMethodAccess(String methodName, String className) throws ClassNotFoundException, NoSuchMethodError {
5070 + Class clazz = Class.forName(className);
5072 + Method found = null;
5073 + for (Method m : clazz.getDeclaredMethods()) {
5074 + if (m.getName().equals(methodName)) {
5075 + if (found != null) {
5076 + throw new RuntimeException("ambiguous method name");
5081 + if (found == null) {
5082 + throw new NoSuchMethodError(methodName);
5084 + this.method = found;
5087 + public ReflectionMethodAccess(Method m, Class clazz) {
5092 + public String getSignature() {
5093 + String methodString = Modifier.toString(method.getModifiers()) + " " + method.getReturnType().getName() + " " + method.getName() + "(";
5094 + boolean paramFound = false;
5095 + for (Class c : method.getParameterTypes()) {
5097 + methodString += ", ";
5099 + paramFound = true;
5100 + methodString += c.getName();
5102 + return methodString + ")";
5106 + public String getName() {
5107 + return method.getName();
5111 + public boolean canCheckObsoletness() {
5116 + public boolean isObsolete() {
5117 + throw new UnsupportedOperationException("Not supported yet.");
5121 + public Object invoke(Object[] o, Object instance) {
5123 + boolean acc = method.isAccessible();
5124 + method.setAccessible(true);
5125 + Object obj = method.invoke(instance, o);
5126 + method.setAccessible(acc);
5128 + } catch (IllegalAccessException ex) {
5129 + throw new RuntimeException(ex);
5130 + } catch (IllegalArgumentException ex) {
5131 + throw new RuntimeException(ex);
5132 + } catch (InvocationTargetException ex) {
5133 + throw new RuntimeException(ex);
5137 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionStackFrameAccess.java
5138 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5139 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionStackFrameAccess.java Fri Dec 17 13:23:04 2010 +0100
5142 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5143 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5145 + * This code is free software; you can redistribute it and/or modify it
5146 + * under the terms of the GNU General Public License version 2 only, as
5147 + * published by the Free Software Foundation.
5149 + * This code is distributed in the hope that it will be useful, but WITHOUT
5150 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5151 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5152 + * version 2 for more details (a copy is included in the LICENSE file that
5153 + * accompanied this code).
5155 + * You should have received a copy of the GNU General Public License version
5156 + * 2 along with this work; if not, write to the Free Software Foundation,
5157 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5159 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5160 + * or visit www.oracle.com if you need additional information or have any
5164 +package at.ssw.hotswap.test.access.reflection;
5166 +import at.ssw.hotswap.test.access.ClassAccess;
5167 +import at.ssw.hotswap.test.access.MethodAccess;
5168 +import at.ssw.hotswap.test.access.StackFrameAccess;
5171 + * @author Kerstin Breiteneder
5172 + * @author Christoph Wimberger
5174 +public class ReflectionStackFrameAccess implements StackFrameAccess {
5176 + private String methodName;
5177 + private String className;
5178 + private MethodAccess methodAccess;
5179 + private ClassAccess classAccess;
5181 + ReflectionStackFrameAccess(StackTraceElement element) {
5182 + methodName = element.getMethodName();
5183 + className = element.getClassName();
5187 + public MethodAccess getMethod() throws ClassNotFoundException {
5188 + if (methodAccess == null) {
5189 + methodAccess = new ReflectionMethodAccess(methodName, className);
5191 + return methodAccess;
5195 + public ClassAccess getClazz() {
5196 + if (classAccess == null) {
5198 + classAccess = new ReflectionClassAccess(className);
5199 + } catch (ClassNotFoundException ex) {
5203 + return classAccess;
5207 + public String toString() {
5208 + return methodName;
5211 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionVMAccess.java
5212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5213 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionVMAccess.java Fri Dec 17 13:23:04 2010 +0100
5216 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5217 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5219 + * This code is free software; you can redistribute it and/or modify it
5220 + * under the terms of the GNU General Public License version 2 only, as
5221 + * published by the Free Software Foundation.
5223 + * This code is distributed in the hope that it will be useful, but WITHOUT
5224 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5225 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5226 + * version 2 for more details (a copy is included in the LICENSE file that
5227 + * accompanied this code).
5229 + * You should have received a copy of the GNU General Public License version
5230 + * 2 along with this work; if not, write to the Free Software Foundation,
5231 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5233 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5234 + * or visit www.oracle.com if you need additional information or have any
5238 +package at.ssw.hotswap.test.access.reflection;
5240 +import at.ssw.hotswap.test.access.ClassAccess;
5241 +import at.ssw.hotswap.test.access.VMAccess;
5242 +import at.ssw.hotswap.test.access.StackFrameAccess;
5243 +import java.util.ArrayList;
5244 +import java.util.List;
5247 + * @author Kerstin Breiteneder
5248 + * @author Christoph Wimberger
5250 +public class ReflectionVMAccess implements VMAccess {
5252 + private List<Thread> getThreads() {
5253 + ThreadGroup root = Thread.currentThread().getThreadGroup();
5254 + while (root.getParent() != null) {
5255 + root = root.getParent();
5260 + int estsize = root.activeCount();
5264 + threads = new Thread[estsize];
5266 + cnt = root.enumerate(threads, true);
5267 + } while (cnt == estsize);
5269 + List<Thread> ret = new ArrayList<Thread>();
5270 + for (int i = 0; i < cnt; i++) {
5271 + ret.add(threads[i]);
5277 + public List<String> getThreadNames() {
5278 + List<String> threadNames = new ArrayList<String>();
5279 + List<Thread> threads = getThreads();
5280 + for (Thread t : threads) {
5281 + threadNames.add(t.getName());
5283 + return threadNames;
5287 + public boolean canGetFrames() {
5292 + public List<StackFrameAccess> getFrames(String threadName) {
5294 + List<Thread> threads = getThreads();
5295 + List<StackFrameAccess> stackAccesses = new ArrayList<StackFrameAccess>();
5296 + for (Thread t : threads) {
5297 + if (t.getName().equals(threadName)) {
5298 + for (StackTraceElement stackElement : t.getStackTrace()) {
5299 + StackFrameAccess stackAccess = new ReflectionStackFrameAccess(stackElement);
5300 + stackAccesses.add(stackAccess);
5304 + return stackAccesses;
5308 + public ClassAccess findClass(String clazz) {
5310 + return new ReflectionClassAccess(clazz);
5311 + } catch (ClassNotFoundException ex) {
5316 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTest.java
5317 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5318 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTest.java Fri Dec 17 13:23:04 2010 +0100
5321 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5322 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5324 + * This code is free software; you can redistribute it and/or modify it
5325 + * under the terms of the GNU General Public License version 2 only, as
5326 + * published by the Free Software Foundation.
5328 + * This code is distributed in the hope that it will be useful, but WITHOUT
5329 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5330 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5331 + * version 2 for more details (a copy is included in the LICENSE file that
5332 + * accompanied this code).
5334 + * You should have received a copy of the GNU General Public License version
5335 + * 2 along with this work; if not, write to the Free Software Foundation,
5336 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5338 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5339 + * or visit www.oracle.com if you need additional information or have any
5343 +package at.ssw.hotswap.test.accesstests;
5345 +import static org.junit.Assert.*;
5346 +import org.junit.Before;
5347 +import org.junit.Test;
5348 +import at.ssw.hotswap.HotSwapTool;
5349 +import at.ssw.hotswap.test.access.ClassAccess;
5350 +import at.ssw.hotswap.test.access.MethodAccess;
5351 +import at.ssw.hotswap.test.access.StackFrameAccess;
5352 +import at.ssw.hotswap.test.access.VMAccess;
5353 +import at.ssw.hotswap.test.access.jdi.JDIVMAccess;
5354 +import at.ssw.hotswap.test.access.jni.JNIVMAccess;
5355 +import at.ssw.hotswap.test.access.reflection.ReflectionVMAccess;
5356 +import java.util.Arrays;
5357 +import java.util.Collection;
5358 +import java.util.Comparator;
5359 +import java.util.List;
5360 +import org.junit.runner.RunWith;
5361 +import org.junit.runners.Parameterized;
5362 +import org.junit.runners.Parameterized.Parameters;
5365 + * @author Kerstin Breiteneder
5366 + * @author Christoph Wimberger
5368 +@RunWith(Parameterized.class)
5369 +public class AccessTest {
5371 + private static VMAccess vma;
5373 + public AccessTest(VMAccess vma) {
5378 + public static class A {
5380 + //needed for StackTraceTest
5381 + public static String stackTraceHelper() {
5382 + return getParentMethodSignature();
5385 + //needed for FindMethodTest
5386 + public static String method_Version0() {
5387 + return "Version0";
5390 + //needed for SignatureTest
5391 + public static String signatureHelper(String y, int x) {
5392 + return "Version0";
5395 + //needed for invokeMethodIntTest()
5396 + private int testIntRetValue() {
5400 + //needed for invokeMethodObjectTest
5401 + private Object testObjectRetValue() {
5402 + return new Integer(2);
5405 + //needed for invokeMethodVoidTest
5406 + private static void testVoidRetValue() {
5407 + System.out.println("Version 0");
5410 + //needed for invokeMethodParameterTest()
5411 + private static int testMethodParameter(Integer x) {
5417 + public static class A___1 {
5419 + //needed for StackTraceTest
5420 + protected static String stackTraceHelper() {
5421 + return getParentMethodSignature();
5424 + //needed for FindMethodTest, SignatureTest
5425 + public static String method_Version1() {
5426 + return "Version1";
5429 + //needed for SignatureTest
5430 + private static String signatureHelper(int y, int x) {
5431 + return "Version1";
5434 + //needed for invokeMethodIntTest
5435 + private int testIntRetValue() {
5439 + //needed for invokeMethodObjectTest
5440 + private Object testObjectRetValue() {
5441 + return new Integer(3);
5444 + //needed for invokeMethodVoidTest
5445 + private static void testVoidRetValue() {
5446 + System.out.println("Version 1");
5449 + //needed for invokeMethodParameterTest()
5450 + private static int testMethodParameter(Integer x) {
5455 + //needed for StackTraceTest
5456 + private static String getParentMethodSignature() {
5460 + for (StackFrameAccess stack : vma.getFrames("main")) {
5461 + if (stack.getMethod().getName().equals("access$000")) {
5467 + return vma.getFrames("main").get(++i).getMethod().getSignature();
5468 + } catch (ClassNotFoundException ex) {
5474 + public static Collection accessValues() {
5475 + return Arrays.asList(new Object[][]{{new JDIVMAccess()}, {new JNIVMAccess()}, {new ReflectionVMAccess()}});
5476 + //return Arrays.asList(new Object[][]{{new JDIVMAccess()}});
5480 + public void setUp() throws Exception {
5481 + HotSwapTool.toVersion(AccessTest.class, 0);
5485 + public void FindClassTest() {
5488 + ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$XYZ");
5489 + assertNull(classAccess);
5491 + classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5492 + assertNotNull(classAccess);
5494 + HotSwapTool.toVersion(AccessTest.class, 1);
5496 + classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5497 + assertNotNull(classAccess);
5501 + public void FindMethodTest() {
5503 + ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5504 + assertNotNull(classAccess);
5506 + assertNotNull(classAccess.findMethod("method_Version0"));
5507 + assertNull(classAccess.findMethod("method_Version1"));
5509 + HotSwapTool.toVersion(AccessTest.class, 1);
5511 + assertNull(classAccess.findMethod("method_Version0"));
5512 + assertNotNull(classAccess.findMethod("method_Version1"));
5516 + public void StackTraceTest() {
5517 + if (vma.canGetFrames()) {
5518 + assertEquals("public static java.lang.String stackTraceHelper()", A.stackTraceHelper());
5520 + HotSwapTool.toVersion(AccessTest.class, 1);
5522 + assertEquals("protected static java.lang.String stackTraceHelper()", A.stackTraceHelper());
5527 + public void SignatureTest() {
5528 + MethodAccess mAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A").findMethod("signatureHelper");
5529 + assertEquals("public static java.lang.String signatureHelper(java.lang.String, int)", mAccess.getSignature());
5531 + HotSwapTool.toVersion(AccessTest.class, 1);
5533 + mAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A").findMethod("signatureHelper");
5534 + assertEquals("private static java.lang.String signatureHelper(int, int)", mAccess.getSignature());
5538 + public void invokeMethodIntTest() {
5539 + if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
5543 + ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5544 + assertEquals(2, classAccess.findMethod("testIntRetValue").invoke(new Object[0], new A()));
5546 + HotSwapTool.toVersion(AccessTest.class, 1);
5548 + assertEquals(3, classAccess.findMethod("testIntRetValue").invoke(new Object[0], new A()));
5552 + public void invokeMethodObjectTest() {
5553 + if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
5557 + ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5558 + assertEquals(2, classAccess.findMethod("testObjectRetValue").invoke(new Object[0], new A()));
5560 + HotSwapTool.toVersion(AccessTest.class, 1);
5562 + assertEquals(3, classAccess.findMethod("testObjectRetValue").invoke(new Object[0], new A()));
5566 + public void invokeMethodVoidTest() {
5567 + if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
5571 + ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5572 + assertNull(classAccess.findMethod("testVoidRetValue").invoke(new Object[0], new A()));
5574 + HotSwapTool.toVersion(AccessTest.class, 1);
5576 + assertNull(classAccess.findMethod("testVoidRetValue").invoke(new Object[0], new A()));
5580 + public void invokeMethodParameterTest() {
5581 + if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
5585 + ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5586 + assertEquals(6, classAccess.findMethod("testMethodParameter").invoke(new Object[]{6}, new A()));
5588 + HotSwapTool.toVersion(AccessTest.class, 1);
5590 + assertEquals(7, classAccess.findMethod("testMethodParameter").invoke(new Object[]{6}, new A()));
5595 + public void getMethodsTest() {
5597 + ClassAccess cAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
5598 + List<MethodAccess> list = cAccess.getMethods();
5600 + assertEquals(7, list.size());
5602 + Object[] mAccesses = list.toArray();
5604 + Arrays.sort(mAccesses, new Comparator() {
5607 + public int compare(Object o1, Object o2) {
5608 + return ((MethodAccess) o1).getName().compareTo(((MethodAccess) o2).getName());
5612 + assertEquals("method_Version0", ((MethodAccess) mAccesses[0]).getName());
5613 + assertEquals("signatureHelper", ((MethodAccess) mAccesses[1]).getName());
5614 + assertEquals("stackTraceHelper", ((MethodAccess) mAccesses[2]).getName());
5615 + assertEquals("testIntRetValue", ((MethodAccess) mAccesses[3]).getName());
5616 + assertEquals("testMethodParameter", ((MethodAccess) mAccesses[4]).getName());
5617 + assertEquals("testObjectRetValue", ((MethodAccess) mAccesses[5]).getName());
5618 + assertEquals("testVoidRetValue", ((MethodAccess) mAccesses[6]).getName());
5620 + HotSwapTool.toVersion(AccessTest.class, 1);
5622 + list = cAccess.getMethods();
5624 + assertEquals(7, list.size());
5626 + mAccesses = list.toArray();
5627 + Arrays.sort(mAccesses, new Comparator() {
5630 + public int compare(Object o1, Object o2) {
5631 + return ((MethodAccess) o1).getName().compareTo(((MethodAccess) o2).getName());
5635 + assertEquals("method_Version1", ((MethodAccess) mAccesses[0]).getName());
5636 + assertEquals("signatureHelper", ((MethodAccess) mAccesses[1]).getName());
5637 + assertEquals("stackTraceHelper", ((MethodAccess) mAccesses[2]).getName());
5638 + assertEquals("testIntRetValue", ((MethodAccess) mAccesses[3]).getName());
5639 + assertEquals("testMethodParameter", ((MethodAccess) mAccesses[4]).getName());
5640 + assertEquals("testObjectRetValue", ((MethodAccess) mAccesses[5]).getName());
5641 + assertEquals("testVoidRetValue", ((MethodAccess) mAccesses[6]).getName());
5645 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTestSuite.java
5646 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5647 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTestSuite.java Fri Dec 17 13:23:04 2010 +0100
5650 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5651 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5653 + * This code is free software; you can redistribute it and/or modify it
5654 + * under the terms of the GNU General Public License version 2 only, as
5655 + * published by the Free Software Foundation.
5657 + * This code is distributed in the hope that it will be useful, but WITHOUT
5658 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5659 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5660 + * version 2 for more details (a copy is included in the LICENSE file that
5661 + * accompanied this code).
5663 + * You should have received a copy of the GNU General Public License version
5664 + * 2 along with this work; if not, write to the Free Software Foundation,
5665 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5667 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5668 + * or visit www.oracle.com if you need additional information or have any
5672 +package at.ssw.hotswap.test.accesstests;
5674 +import org.junit.runner.RunWith;
5675 +import org.junit.runners.Suite;
5678 + * @author Kerstin Breiteneder
5679 + * @author Christoph Wimberger
5681 +@RunWith(Suite.class)
5682 +@Suite.SuiteClasses({
5685 +public class AccessTestSuite {
5687 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java
5688 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5689 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java Fri Dec 17 13:23:04 2010 +0100
5692 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5693 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5695 + * This code is free software; you can redistribute it and/or modify it
5696 + * under the terms of the GNU General Public License version 2 only, as
5697 + * published by the Free Software Foundation.
5699 + * This code is distributed in the hope that it will be useful, but WITHOUT
5700 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5701 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5702 + * version 2 for more details (a copy is included in the LICENSE file that
5703 + * accompanied this code).
5705 + * You should have received a copy of the GNU General Public License version
5706 + * 2 along with this work; if not, write to the Free Software Foundation,
5707 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5709 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5710 + * or visit www.oracle.com if you need additional information or have any
5715 +package at.ssw.hotswap.test.body;
5717 +import org.junit.runner.RunWith;
5718 +import org.junit.runners.Suite;
5722 + * Class redefinition tests that swap only method bodies and change nothing else. This test cases should also
5723 + * run with the current version of HotSpot.
5725 + * @author Thomas Wuerthinger
5728 +@RunWith(Suite.class)
5729 +@Suite.SuiteClasses(
5732 + SimpleStaticTest.class,
5733 + MultipleThreadsTest.class,
5734 + OldActivationTest.class,
5735 + RefactorActiveMethodTest.class,
5739 + RedefinePrivateMethodTest.class,
5740 + ClassRenamingTestCase.class,
5743 +public class BodyTestSuite {
5745 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/ClassRenamingTestCase.java
5746 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5747 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/ClassRenamingTestCase.java Fri Dec 17 13:23:04 2010 +0100
5750 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5751 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5753 + * This code is free software; you can redistribute it and/or modify it
5754 + * under the terms of the GNU General Public License version 2 only, as
5755 + * published by the Free Software Foundation.
5757 + * This code is distributed in the hope that it will be useful, but WITHOUT
5758 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5759 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5760 + * version 2 for more details (a copy is included in the LICENSE file that
5761 + * accompanied this code).
5763 + * You should have received a copy of the GNU General Public License version
5764 + * 2 along with this work; if not, write to the Free Software Foundation,
5765 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5767 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5768 + * or visit www.oracle.com if you need additional information or have any
5772 +package at.ssw.hotswap.test.body;
5774 +import at.ssw.hotswap.ClassRedefinitionPolicy;
5775 +import at.ssw.hotswap.HotSwapTool;
5776 +import static org.junit.Assert.*;
5777 +import org.junit.Test;
5781 + * @author Kerstin Breiteneder
5782 + * @author Christoph Wimberger
5785 +public class ClassRenamingTestCase {
5787 + public static class B {
5794 + @ClassRedefinitionPolicy(alias = B.class)
5795 + public static class A___1 {
5803 + public void testRenaming() {
5804 + HotSwapTool.toVersion(ClassRenamingTestCase.class, 0);
5807 + assertEquals(1, b.a());
5809 + HotSwapTool.toVersion(ClassRenamingTestCase.class, 1);
5811 + assertEquals(2, b.a());
5813 + HotSwapTool.toVersion(ClassRenamingTestCase.class, 0);
5815 + assertEquals(1, b.a());
5818 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/EMCPTest.java
5819 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5820 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/EMCPTest.java Fri Dec 17 13:23:04 2010 +0100
5823 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5824 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5826 + * This code is free software; you can redistribute it and/or modify it
5827 + * under the terms of the GNU General Public License version 2 only, as
5828 + * published by the Free Software Foundation.
5830 + * This code is distributed in the hope that it will be useful, but WITHOUT
5831 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5832 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5833 + * version 2 for more details (a copy is included in the LICENSE file that
5834 + * accompanied this code).
5836 + * You should have received a copy of the GNU General Public License version
5837 + * 2 along with this work; if not, write to the Free Software Foundation,
5838 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5840 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5841 + * or visit www.oracle.com if you need additional information or have any
5845 +package at.ssw.hotswap.test.body;
5847 +import at.ssw.hotswap.HotSwapTool;
5848 +import at.ssw.hotswap.test.TestUtil;
5849 +import java.io.PrintStream;
5850 +import static org.junit.Assert.*;
5851 +import org.junit.Test;
5855 + * EMCP (Equivalent modulo Constant Pool) tests.
5857 + * @author Thomas Wuerthinger
5860 +public class EMCPTest {
5862 + public static class A {
5864 + public static int EMCPReturn() {
5866 + PrintStream s = System.out;
5871 + public static class B {
5873 + public static int b() {
5875 + throw new RuntimeException();
5879 + public static class C {
5881 + public static int c() {
5887 + public static class D {
5889 + private static int value = 1;
5891 + public static int EMCPReturn() {
5897 + public static class A___1 {
5899 + public static int EMCPReturn() {
5901 + PrintStream s = System.out;
5906 + public static class B___1 {
5908 + public static int b() {
5910 + throw new RuntimeException();
5914 + public static class C___1 {
5916 + public static int c() {
5922 + public static class D___1 {
5923 + private static int value = 1;
5925 + public static int EMCPReturn() {
5931 + public static class D___2 {
5932 + private static int value = 1;
5934 + public static int EMCPReturn() {
5940 + public static class D___3 {
5941 + private static int value = 1;
5943 + public static int EMCPReturn() {
5949 + public static void change() {
5951 + HotSwapTool.toVersion(EMCPTest.class, 1);
5954 + public static void change3() {
5956 + HotSwapTool.toVersion(EMCPTest.class, 1);
5957 + HotSwapTool.toVersion(EMCPTest.class, 2);
5958 + HotSwapTool.toVersion(EMCPTest.class, 3);
5961 + public static void changeAndThrow() {
5963 + HotSwapTool.toVersion(EMCPTest.class, 1);
5965 + throw new RuntimeException();
5970 + public void testEMCPReturn() {
5971 + HotSwapTool.toVersion(EMCPTest.class, 0);
5973 + assertEquals(1, A.EMCPReturn());
5975 + HotSwapTool.toVersion(EMCPTest.class, 0);
5977 + assertEquals(1, A.EMCPReturn());
5979 + HotSwapTool.toVersion(EMCPTest.class, 0);
5983 + public void testEMCPMultiChangeReturn() {
5984 + HotSwapTool.toVersion(EMCPTest.class, 0);
5986 + assertEquals(1, D.EMCPReturn());
5988 + HotSwapTool.toVersion(EMCPTest.class, 0);
5990 + assertEquals(1, D.EMCPReturn());
5992 + HotSwapTool.toVersion(EMCPTest.class, 0);
5996 + public void testEMCPException() {
5997 + HotSwapTool.toVersion(EMCPTest.class, 0);
5999 + TestUtil.assertException(RuntimeException.class, new Runnable(){
6001 + public void run() {
6006 + HotSwapTool.toVersion(EMCPTest.class, 0);
6008 + TestUtil.assertException(RuntimeException.class, new Runnable(){
6010 + public void run() {
6015 + HotSwapTool.toVersion(EMCPTest.class, 0);
6019 + public void testEMCPExceptionInCallee() {
6020 + HotSwapTool.toVersion(EMCPTest.class, 0);
6022 + TestUtil.assertException(RuntimeException.class, new Runnable(){
6024 + public void run() {
6029 + HotSwapTool.toVersion(EMCPTest.class, 0);
6031 + TestUtil.assertException(RuntimeException.class, new Runnable(){
6033 + public void run() {
6038 + HotSwapTool.toVersion(EMCPTest.class, 0);
6041 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java
6042 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6043 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java Fri Dec 17 13:23:04 2010 +0100
6046 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6047 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6049 + * This code is free software; you can redistribute it and/or modify it
6050 + * under the terms of the GNU General Public License version 2 only, as
6051 + * published by the Free Software Foundation.
6053 + * This code is distributed in the hope that it will be useful, but WITHOUT
6054 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6055 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6056 + * version 2 for more details (a copy is included in the LICENSE file that
6057 + * accompanied this code).
6059 + * You should have received a copy of the GNU General Public License version
6060 + * 2 along with this work; if not, write to the Free Software Foundation,
6061 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6063 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6064 + * or visit www.oracle.com if you need additional information or have any
6069 +package at.ssw.hotswap.test.body;
6071 +import static org.junit.Assert.*;
6073 +import org.junit.Before;
6075 +import org.junit.Test;
6077 +import at.ssw.hotswap.HotSwapTool;
6080 + * Recursive implementation of the factorial function using class redefinition.
6082 + * @author Thomas Wuerthinger
6084 +public class FacTest {
6086 + public static abstract class Base {
6088 + protected int calc() {
6089 + return calc(HotSwapTool.getCurrentVersion(FacTest.class));
6092 + public int calcAt(int version) {
6093 + HotSwapTool.toVersion(FacTest.class, version);
6094 + int result = calc();
6095 + HotSwapTool.toVersion(FacTest.class, 0);
6099 + protected int calc(int version) {
6104 + public static class Factorial extends Base {
6107 + protected int calc(int n) {
6108 + return n * calcAt(n - 1);
6112 + public static class Factorial___1 extends Base {
6115 + protected int calc() {
6121 + public void setUp() throws Exception {
6122 + HotSwapTool.toVersion(FacTest.class, 0);
6126 + public void testFac() {
6128 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
6129 + Factorial f = new Factorial();
6131 + assertEquals(1, f.calcAt(1));
6133 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
6134 + assertEquals(2, f.calcAt(2));
6136 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
6137 + assertEquals(6, f.calcAt(3));
6139 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
6140 + assertEquals(24, f.calcAt(4));
6142 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
6143 + assertEquals(120, f.calcAt(5));
6145 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
6146 + assertEquals(479001600, f.calcAt(12));
6149 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java
6150 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6151 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java Fri Dec 17 13:23:04 2010 +0100
6154 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6155 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6157 + * This code is free software; you can redistribute it and/or modify it
6158 + * under the terms of the GNU General Public License version 2 only, as
6159 + * published by the Free Software Foundation.
6161 + * This code is distributed in the hope that it will be useful, but WITHOUT
6162 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6163 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6164 + * version 2 for more details (a copy is included in the LICENSE file that
6165 + * accompanied this code).
6167 + * You should have received a copy of the GNU General Public License version
6168 + * 2 along with this work; if not, write to the Free Software Foundation,
6169 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6171 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6172 + * or visit www.oracle.com if you need additional information or have any
6177 +package at.ssw.hotswap.test.body;
6179 +import static org.junit.Assert.*;
6181 +import org.junit.Before;
6183 +import org.junit.Test;
6185 +import at.ssw.hotswap.HotSwapTool;
6188 + * Recursive implementation of the fibonacci function using class redefinition.
6190 + * @author Thomas Wuerthinger
6192 +public class FibTest {
6194 + public static abstract class Base {
6196 + protected int calc() {
6197 + return calc(HotSwapTool.getCurrentVersion(FibTest.class));
6200 + public int calcAt(int version) {
6201 + HotSwapTool.toVersion(FibTest.class, version);
6202 + int result = calc();
6203 + HotSwapTool.toVersion(FibTest.class, 0);
6207 + protected int calc(int version) {
6212 + public static class Fib extends Base {
6215 + protected int calc(int n) {
6216 + return calcAt(n - 1) + calcAt(n - 2);
6220 + public static class Fib___1 extends Base {
6223 + protected int calc() {
6228 + public static class Fib___2 extends Base {
6231 + protected int calc() {
6237 + public void setUp() throws Exception {
6238 + HotSwapTool.toVersion(FibTest.class, 0);
6242 + public void testFib() {
6246 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
6247 + Fib f = new Fib();
6249 + assertEquals(1, f.calcAt(1));
6251 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
6252 + assertEquals(2, f.calcAt(2));
6254 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
6255 + assertEquals(3, f.calcAt(3));
6257 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
6258 + assertEquals(5, f.calcAt(4));
6260 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
6261 + assertEquals(8, f.calcAt(5));
6264 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java
6265 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6266 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java Fri Dec 17 13:23:04 2010 +0100
6269 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6270 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6272 + * This code is free software; you can redistribute it and/or modify it
6273 + * under the terms of the GNU General Public License version 2 only, as
6274 + * published by the Free Software Foundation.
6276 + * This code is distributed in the hope that it will be useful, but WITHOUT
6277 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6278 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6279 + * version 2 for more details (a copy is included in the LICENSE file that
6280 + * accompanied this code).
6282 + * You should have received a copy of the GNU General Public License version
6283 + * 2 along with this work; if not, write to the Free Software Foundation,
6284 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6286 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6287 + * or visit www.oracle.com if you need additional information or have any
6292 +package at.ssw.hotswap.test.body;
6294 +import static org.junit.Assert.*;
6296 +import org.junit.Before;
6297 +import org.junit.Test;
6299 +import at.ssw.hotswap.HotSwapTool;
6300 +import at.ssw.hotswap.test.methods.OverrideMethodTest;
6303 + * Class for testing redefining methods of classes that extend the Thread class. In the test setup the run method
6304 + * calls the doit method in a loop until this methods returns false.
6306 + * @author Thomas Wuerthinger
6308 +public class MultipleThreadsTest {
6310 + public static final int COUNT = 10;
6313 + public static class A extends Thread {
6315 + private int value;
6316 + private int value2;
6317 + private boolean flag = false;
6320 + public void run() {
6326 + public boolean doit() {
6328 + throw new RuntimeException("Must not reach here");
6333 + } catch (InterruptedException e) {
6340 + public int getValue() {
6344 + public int getValue2() {
6350 + public static class A___1 extends Thread {
6352 + private int value;
6353 + private int value2;
6354 + private boolean flag = false;
6357 + public void run() {
6363 + public boolean doit() {
6365 + throw new RuntimeException("Must not reach here");
6370 + } catch (InterruptedException e) {
6377 + public int getValue() {
6381 + public int getValue2() {
6387 + public static class A___2 extends Thread {
6389 + private int value;
6390 + private int value2;
6391 + private boolean flag = false;
6394 + public void run() {
6400 + public boolean doit() {
6404 + public int getValue() {
6408 + public int getValue2() {
6414 + public void setUp() throws Exception {
6415 + HotSwapTool.toVersion(MultipleThreadsTest.class, 0);
6419 + public void testOneThread() {
6424 + public void testThreads() {
6428 + private void test(int count) {
6430 + assert HotSwapTool.getCurrentVersion(MultipleThreadsTest.class) == 0;
6432 + A[] arr = new A[count];
6433 + for (int i = 0; i < count; i++) {
6439 + Thread.sleep(500);
6440 + } catch (InterruptedException e) {
6443 + for (int i = 0; i < count; i++) {
6444 + //assertTrue(arr[i].getValue() > 0);
6447 + HotSwapTool.toVersion(MultipleThreadsTest.class, 1);
6450 + Thread.sleep(500);
6451 + } catch (InterruptedException e) {
6454 + for (int i = 0; i < count; i++) {
6455 + assertTrue(arr[i].getValue2() > 0);
6458 + HotSwapTool.toVersion(MultipleThreadsTest.class, 2);
6461 + Thread.sleep(500);
6462 + } catch (InterruptedException e) {
6466 + for (int i = 0; i < count; i++) {
6467 + assertFalse(arr[i].isAlive());
6470 + HotSwapTool.toVersion(OverrideMethodTest.class, 0);
6475 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java
6476 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6477 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java Fri Dec 17 13:23:04 2010 +0100
6480 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6481 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6483 + * This code is free software; you can redistribute it and/or modify it
6484 + * under the terms of the GNU General Public License version 2 only, as
6485 + * published by the Free Software Foundation.
6487 + * This code is distributed in the hope that it will be useful, but WITHOUT
6488 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6489 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6490 + * version 2 for more details (a copy is included in the LICENSE file that
6491 + * accompanied this code).
6493 + * You should have received a copy of the GNU General Public License version
6494 + * 2 along with this work; if not, write to the Free Software Foundation,
6495 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6497 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6498 + * or visit www.oracle.com if you need additional information or have any
6503 +package at.ssw.hotswap.test.body;
6505 +import static org.junit.Assert.*;
6507 +import org.junit.Before;
6508 +import org.junit.Test;
6510 +import at.ssw.hotswap.HotSwapTool;
6513 + * 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.
6515 + * @author Thomas Wuerthinger
6517 +public class OldActivationTest {
6520 + public static class A {
6522 + public int value() {
6523 + HotSwapTool.toVersion(OldActivationTest.class, 1);
6524 + return 1 + this.value();
6529 + public static class A___1 {
6531 + public int value() {
6532 + HotSwapTool.toVersion(OldActivationTest.class, 2);
6533 + return 2 + this.value();
6538 + public static class A___2 {
6540 + public int value() {
6541 + HotSwapTool.toVersion(OldActivationTest.class, 3);
6542 + return 3 + this.value();
6547 + public static class A___3 {
6549 + public int value() {
6550 + HotSwapTool.toVersion(OldActivationTest.class, 4);
6551 + return 4 + this.value();
6556 + public static class A___4 {
6558 + public int value() {
6559 + HotSwapTool.toVersion(OldActivationTest.class, 5);
6560 + return 5 + this.value();
6565 + public static class A___5 {
6567 + public int value() {
6568 + HotSwapTool.toVersion(OldActivationTest.class, 6);
6569 + return 6 + this.value();
6574 + public static class A___6 {
6576 + public int value() {
6577 + HotSwapTool.toVersion(OldActivationTest.class, 7);
6578 + return 7 + this.value();
6583 + public static class A___7 {
6585 + public int value() {
6586 + HotSwapTool.toVersion(OldActivationTest.class, 8);
6587 + return 8 + this.value();
6592 + public static class A___8 {
6594 + public int value() {
6595 + HotSwapTool.toVersion(OldActivationTest.class, 9);
6596 + return 9 + this.value();
6601 + public static class A___9 {
6603 + public int value() {
6604 + HotSwapTool.toVersion(OldActivationTest.class, 0);
6610 + public void setUp() throws Exception {
6611 + HotSwapTool.toVersion(OldActivationTest.class, 0);
6615 + public void testOldActivationTest() {
6617 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
6621 + assertEquals(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
6622 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
6624 + HotSwapTool.toVersion(OldActivationTest.class, 1);
6625 + assertEquals(2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
6626 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
6628 + HotSwapTool.toVersion(OldActivationTest.class, 8);
6629 + assertEquals(9 + 10, a.value());
6630 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
6632 + HotSwapTool.toVersion(OldActivationTest.class, 4);
6633 + assertEquals(5 + 6 + 7 + 8 + 9 + 10, a.value());
6634 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
6637 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java
6638 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6639 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java Fri Dec 17 13:23:04 2010 +0100
6642 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6643 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6645 + * This code is free software; you can redistribute it and/or modify it
6646 + * under the terms of the GNU General Public License version 2 only, as
6647 + * published by the Free Software Foundation.
6649 + * This code is distributed in the hope that it will be useful, but WITHOUT
6650 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6651 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6652 + * version 2 for more details (a copy is included in the LICENSE file that
6653 + * accompanied this code).
6655 + * You should have received a copy of the GNU General Public License version
6656 + * 2 along with this work; if not, write to the Free Software Foundation,
6657 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6659 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6660 + * or visit www.oracle.com if you need additional information or have any
6665 +package at.ssw.hotswap.test.body;
6667 +import static org.junit.Assert.*;
6669 +import org.junit.Before;
6670 +import org.junit.Test;
6672 +import at.ssw.hotswap.HotSwapTool;
6675 + * Tests redefinition of a class such that old code still accesses a redefined private method.
6677 + * @author Thomas Wuerthinger
6679 +public class RedefinePrivateMethodTest {
6682 + public static class A {
6684 + public int foo() {
6685 + int result = bar();
6686 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 1);
6691 + private int bar() {
6697 + public static class A___1 {
6699 + public int foo() {
6703 + private int bar() {
6709 + public void setUp() throws Exception {
6710 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
6714 + public void testRedefinePrivateMethod() {
6716 + assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 0;
6720 + assertEquals(3, a.foo());
6722 + assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
6724 + assertEquals(-1, a.foo());
6726 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
6728 + assertEquals(3, a.foo());
6730 + assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
6732 + assertEquals(-1, a.foo());
6734 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
6737 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java
6738 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6739 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java Fri Dec 17 13:23:04 2010 +0100
6742 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6743 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6745 + * This code is free software; you can redistribute it and/or modify it
6746 + * under the terms of the GNU General Public License version 2 only, as
6747 + * published by the Free Software Foundation.
6749 + * This code is distributed in the hope that it will be useful, but WITHOUT
6750 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6751 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6752 + * version 2 for more details (a copy is included in the LICENSE file that
6753 + * accompanied this code).
6755 + * You should have received a copy of the GNU General Public License version
6756 + * 2 along with this work; if not, write to the Free Software Foundation,
6757 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6759 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6760 + * or visit www.oracle.com if you need additional information or have any
6765 +package at.ssw.hotswap.test.body;
6767 +import static org.junit.Assert.*;
6769 +import org.junit.Before;
6770 +import org.junit.Test;
6772 +import at.ssw.hotswap.HotSwapTool;
6775 + * @author Thomas Wuerthinger
6777 +public class RefactorActiveMethodTest {
6780 + public static class A {
6782 + public int value() {
6783 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 1);
6787 + public int secondValue() {
6793 + public static class A___1 {
6795 + public int value() {
6796 + return secondValue() * 2;
6799 + public int secondValue() {
6805 + public void setUp() throws Exception {
6806 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
6810 + public void testActiveMethodReplacement() {
6812 + assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 0;
6816 + assertEquals(5, a.value());
6818 + assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
6820 + assertEquals(2, a.secondValue());
6821 + assertEquals(4, a.value());
6822 + assertEquals(2, a.secondValue());
6824 + assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
6826 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
6828 + assertEquals(1, a.secondValue());
6829 + assertEquals(5, a.value());
6830 + assertEquals(4, a.value());
6832 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
6834 + assertEquals(1, a.secondValue());
6837 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java
6838 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6839 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java Fri Dec 17 13:23:04 2010 +0100
6842 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6843 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6845 + * This code is free software; you can redistribute it and/or modify it
6846 + * under the terms of the GNU General Public License version 2 only, as
6847 + * published by the Free Software Foundation.
6849 + * This code is distributed in the hope that it will be useful, but WITHOUT
6850 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6851 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6852 + * version 2 for more details (a copy is included in the LICENSE file that
6853 + * accompanied this code).
6855 + * You should have received a copy of the GNU General Public License version
6856 + * 2 along with this work; if not, write to the Free Software Foundation,
6857 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6859 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA