1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/java/RAII/build.xml Tue Sep 09 14:51:08 2014 +0200
1.3 @@ -0,0 +1,73 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!-- You may freely edit this file. See commented blocks below for -->
1.6 +<!-- some examples of how to customize the build. -->
1.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
1.8 +<!-- By default, only the Clean and Build commands use this build script. -->
1.9 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
1.10 +<!-- the Compile on Save feature is turned off for the project. -->
1.11 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
1.12 +<!-- in the project's Project Properties dialog box.-->
1.13 +<project name="RAII" default="default" basedir=".">
1.14 + <description>Builds, tests, and runs the project RAII.</description>
1.15 + <import file="nbproject/build-impl.xml"/>
1.16 + <!--
1.17 +
1.18 + There exist several targets which are by default empty and which can be
1.19 + used for execution of your tasks. These targets are usually executed
1.20 + before and after some main targets. They are:
1.21 +
1.22 + -pre-init: called before initialization of project properties
1.23 + -post-init: called after initialization of project properties
1.24 + -pre-compile: called before javac compilation
1.25 + -post-compile: called after javac compilation
1.26 + -pre-compile-single: called before javac compilation of single file
1.27 + -post-compile-single: called after javac compilation of single file
1.28 + -pre-compile-test: called before javac compilation of JUnit tests
1.29 + -post-compile-test: called after javac compilation of JUnit tests
1.30 + -pre-compile-test-single: called before javac compilation of single JUnit test
1.31 + -post-compile-test-single: called after javac compilation of single JUunit test
1.32 + -pre-jar: called before JAR building
1.33 + -post-jar: called after JAR building
1.34 + -post-clean: called after cleaning build products
1.35 +
1.36 + (Targets beginning with '-' are not intended to be called on their own.)
1.37 +
1.38 + Example of inserting an obfuscator after compilation could look like this:
1.39 +
1.40 + <target name="-post-compile">
1.41 + <obfuscate>
1.42 + <fileset dir="${build.classes.dir}"/>
1.43 + </obfuscate>
1.44 + </target>
1.45 +
1.46 + For list of available properties check the imported
1.47 + nbproject/build-impl.xml file.
1.48 +
1.49 +
1.50 + Another way to customize the build is by overriding existing main targets.
1.51 + The targets of interest are:
1.52 +
1.53 + -init-macrodef-javac: defines macro for javac compilation
1.54 + -init-macrodef-junit: defines macro for junit execution
1.55 + -init-macrodef-debug: defines macro for class debugging
1.56 + -init-macrodef-java: defines macro for class execution
1.57 + -do-jar: JAR building
1.58 + run: execution of project
1.59 + -javadoc-build: Javadoc generation
1.60 + test-report: JUnit report generation
1.61 +
1.62 + An example of overriding the target for project execution could look like this:
1.63 +
1.64 + <target name="run" depends="RAII-impl.jar">
1.65 + <exec dir="bin" executable="launcher.exe">
1.66 + <arg file="${dist.jar}"/>
1.67 + </exec>
1.68 + </target>
1.69 +
1.70 + Notice that the overridden target depends on the jar target and not only on
1.71 + the compile target as the regular run target does. Again, for a list of available
1.72 + properties which you can use, check the target you are overriding in the
1.73 + nbproject/build-impl.xml file.
1.74 +
1.75 + -->
1.76 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/java/RAII/manifest.mf Tue Sep 09 14:51:08 2014 +0200
2.3 @@ -0,0 +1,3 @@
2.4 +Manifest-Version: 1.0
2.5 +X-COMMENT: Main-Class will be added automatically by build
2.6 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/java/RAII/nbproject/build-impl.xml Tue Sep 09 14:51:08 2014 +0200
3.3 @@ -0,0 +1,1413 @@
3.4 +<?xml version="1.0" encoding="UTF-8"?>
3.5 +<!--
3.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
3.7 +*** EDIT ../build.xml INSTEAD ***
3.8 +
3.9 +For the purpose of easier reading the script
3.10 +is divided into following sections:
3.11 +
3.12 + - initialization
3.13 + - compilation
3.14 + - jar
3.15 + - execution
3.16 + - debugging
3.17 + - javadoc
3.18 + - test compilation
3.19 + - test execution
3.20 + - test debugging
3.21 + - applet
3.22 + - cleanup
3.23 +
3.24 + -->
3.25 +<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="RAII-impl">
3.26 + <fail message="Please build using Ant 1.8.0 or higher.">
3.27 + <condition>
3.28 + <not>
3.29 + <antversion atleast="1.8.0"/>
3.30 + </not>
3.31 + </condition>
3.32 + </fail>
3.33 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
3.34 + <!--
3.35 + ======================
3.36 + INITIALIZATION SECTION
3.37 + ======================
3.38 + -->
3.39 + <target name="-pre-init">
3.40 + <!-- Empty placeholder for easier customization. -->
3.41 + <!-- You can override this target in the ../build.xml file. -->
3.42 + </target>
3.43 + <target depends="-pre-init" name="-init-private">
3.44 + <property file="nbproject/private/config.properties"/>
3.45 + <property file="nbproject/private/configs/${config}.properties"/>
3.46 + <property file="nbproject/private/private.properties"/>
3.47 + </target>
3.48 + <target depends="-pre-init,-init-private" name="-init-user">
3.49 + <property file="${user.properties.file}"/>
3.50 + <!-- The two properties below are usually overridden -->
3.51 + <!-- by the active platform. Just a fallback. -->
3.52 + <property name="default.javac.source" value="1.4"/>
3.53 + <property name="default.javac.target" value="1.4"/>
3.54 + </target>
3.55 + <target depends="-pre-init,-init-private,-init-user" name="-init-project">
3.56 + <property file="nbproject/configs/${config}.properties"/>
3.57 + <property file="nbproject/project.properties"/>
3.58 + </target>
3.59 + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
3.60 + <property name="platform.java" value="${java.home}/bin/java"/>
3.61 + <available file="${manifest.file}" property="manifest.available"/>
3.62 + <condition property="splashscreen.available">
3.63 + <and>
3.64 + <not>
3.65 + <equals arg1="${application.splash}" arg2="" trim="true"/>
3.66 + </not>
3.67 + <available file="${application.splash}"/>
3.68 + </and>
3.69 + </condition>
3.70 + <condition property="main.class.available">
3.71 + <and>
3.72 + <isset property="main.class"/>
3.73 + <not>
3.74 + <equals arg1="${main.class}" arg2="" trim="true"/>
3.75 + </not>
3.76 + </and>
3.77 + </condition>
3.78 + <condition property="profile.available">
3.79 + <and>
3.80 + <isset property="javac.profile"/>
3.81 + <length length="0" string="${javac.profile}" when="greater"/>
3.82 + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/>
3.83 + </and>
3.84 + </condition>
3.85 + <condition property="do.archive">
3.86 + <or>
3.87 + <not>
3.88 + <istrue value="${jar.archive.disabled}"/>
3.89 + </not>
3.90 + <istrue value="${not.archive.disabled}"/>
3.91 + </or>
3.92 + </condition>
3.93 + <condition property="do.mkdist">
3.94 + <and>
3.95 + <isset property="do.archive"/>
3.96 + <isset property="libs.CopyLibs.classpath"/>
3.97 + <not>
3.98 + <istrue value="${mkdist.disabled}"/>
3.99 + </not>
3.100 + </and>
3.101 + </condition>
3.102 + <condition property="do.archive+manifest.available">
3.103 + <and>
3.104 + <isset property="manifest.available"/>
3.105 + <istrue value="${do.archive}"/>
3.106 + </and>
3.107 + </condition>
3.108 + <condition property="do.archive+main.class.available">
3.109 + <and>
3.110 + <isset property="main.class.available"/>
3.111 + <istrue value="${do.archive}"/>
3.112 + </and>
3.113 + </condition>
3.114 + <condition property="do.archive+splashscreen.available">
3.115 + <and>
3.116 + <isset property="splashscreen.available"/>
3.117 + <istrue value="${do.archive}"/>
3.118 + </and>
3.119 + </condition>
3.120 + <condition property="do.archive+profile.available">
3.121 + <and>
3.122 + <isset property="profile.available"/>
3.123 + <istrue value="${do.archive}"/>
3.124 + </and>
3.125 + </condition>
3.126 + <condition property="have.tests">
3.127 + <or>
3.128 + <available file="${test.src.dir}"/>
3.129 + </or>
3.130 + </condition>
3.131 + <condition property="have.sources">
3.132 + <or>
3.133 + <available file="${src.dir}"/>
3.134 + </or>
3.135 + </condition>
3.136 + <condition property="netbeans.home+have.tests">
3.137 + <and>
3.138 + <isset property="netbeans.home"/>
3.139 + <isset property="have.tests"/>
3.140 + </and>
3.141 + </condition>
3.142 + <condition property="no.javadoc.preview">
3.143 + <and>
3.144 + <isset property="javadoc.preview"/>
3.145 + <isfalse value="${javadoc.preview}"/>
3.146 + </and>
3.147 + </condition>
3.148 + <property name="run.jvmargs" value=""/>
3.149 + <property name="run.jvmargs.ide" value=""/>
3.150 + <property name="javac.compilerargs" value=""/>
3.151 + <property name="work.dir" value="${basedir}"/>
3.152 + <condition property="no.deps">
3.153 + <and>
3.154 + <istrue value="${no.dependencies}"/>
3.155 + </and>
3.156 + </condition>
3.157 + <property name="javac.debug" value="true"/>
3.158 + <property name="javadoc.preview" value="true"/>
3.159 + <property name="application.args" value=""/>
3.160 + <property name="source.encoding" value="${file.encoding}"/>
3.161 + <property name="runtime.encoding" value="${source.encoding}"/>
3.162 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
3.163 + <and>
3.164 + <isset property="javadoc.encoding"/>
3.165 + <not>
3.166 + <equals arg1="${javadoc.encoding}" arg2=""/>
3.167 + </not>
3.168 + </and>
3.169 + </condition>
3.170 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
3.171 + <property name="includes" value="**"/>
3.172 + <property name="excludes" value=""/>
3.173 + <property name="do.depend" value="false"/>
3.174 + <condition property="do.depend.true">
3.175 + <istrue value="${do.depend}"/>
3.176 + </condition>
3.177 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
3.178 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
3.179 + <and>
3.180 + <isset property="endorsed.classpath"/>
3.181 + <not>
3.182 + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/>
3.183 + </not>
3.184 + </and>
3.185 + </condition>
3.186 + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
3.187 + <isset property="profile.available"/>
3.188 + </condition>
3.189 + <condition else="false" property="jdkBug6558476">
3.190 + <and>
3.191 + <matches pattern="1\.[56]" string="${java.specification.version}"/>
3.192 + <not>
3.193 + <os family="unix"/>
3.194 + </not>
3.195 + </and>
3.196 + </condition>
3.197 + <property name="javac.fork" value="${jdkBug6558476}"/>
3.198 + <property name="jar.index" value="false"/>
3.199 + <property name="jar.index.metainf" value="${jar.index}"/>
3.200 + <property name="copylibs.rebase" value="true"/>
3.201 + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
3.202 + <condition property="junit.available">
3.203 + <or>
3.204 + <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
3.205 + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
3.206 + </or>
3.207 + </condition>
3.208 + <condition property="testng.available">
3.209 + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
3.210 + </condition>
3.211 + <condition property="junit+testng.available">
3.212 + <and>
3.213 + <istrue value="${junit.available}"/>
3.214 + <istrue value="${testng.available}"/>
3.215 + </and>
3.216 + </condition>
3.217 + <condition else="testng" property="testng.mode" value="mixed">
3.218 + <istrue value="${junit+testng.available}"/>
3.219 + </condition>
3.220 + <condition else="" property="testng.debug.mode" value="-mixed">
3.221 + <istrue value="${junit+testng.available}"/>
3.222 + </condition>
3.223 + </target>
3.224 + <target name="-post-init">
3.225 + <!-- Empty placeholder for easier customization. -->
3.226 + <!-- You can override this target in the ../build.xml file. -->
3.227 + </target>
3.228 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
3.229 + <fail unless="src.dir">Must set src.dir</fail>
3.230 + <fail unless="test.src.dir">Must set test.src.dir</fail>
3.231 + <fail unless="build.dir">Must set build.dir</fail>
3.232 + <fail unless="dist.dir">Must set dist.dir</fail>
3.233 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
3.234 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
3.235 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
3.236 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
3.237 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
3.238 + <fail unless="dist.jar">Must set dist.jar</fail>
3.239 + </target>
3.240 + <target name="-init-macrodef-property">
3.241 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
3.242 + <attribute name="name"/>
3.243 + <attribute name="value"/>
3.244 + <sequential>
3.245 + <property name="@{name}" value="${@{value}}"/>
3.246 + </sequential>
3.247 + </macrodef>
3.248 + </target>
3.249 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
3.250 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
3.251 + <attribute default="${src.dir}" name="srcdir"/>
3.252 + <attribute default="${build.classes.dir}" name="destdir"/>
3.253 + <attribute default="${javac.classpath}" name="classpath"/>
3.254 + <attribute default="${javac.processorpath}" name="processorpath"/>
3.255 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
3.256 + <attribute default="${includes}" name="includes"/>
3.257 + <attribute default="${excludes}" name="excludes"/>
3.258 + <attribute default="${javac.debug}" name="debug"/>
3.259 + <attribute default="${empty.dir}" name="sourcepath"/>
3.260 + <attribute default="${empty.dir}" name="gensrcdir"/>
3.261 + <element name="customize" optional="true"/>
3.262 + <sequential>
3.263 + <property location="${build.dir}/empty" name="empty.dir"/>
3.264 + <mkdir dir="${empty.dir}"/>
3.265 + <mkdir dir="@{apgeneratedsrcdir}"/>
3.266 + <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}">
3.267 + <src>
3.268 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
3.269 + <include name="*"/>
3.270 + </dirset>
3.271 + </src>
3.272 + <classpath>
3.273 + <path path="@{classpath}"/>
3.274 + </classpath>
3.275 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
3.276 + <compilerarg line="${javac.profile.cmd.line.arg}"/>
3.277 + <compilerarg line="${javac.compilerargs}"/>
3.278 + <compilerarg value="-processorpath"/>
3.279 + <compilerarg path="@{processorpath}:${empty.dir}"/>
3.280 + <compilerarg line="${ap.processors.internal}"/>
3.281 + <compilerarg line="${annotation.processing.processor.options}"/>
3.282 + <compilerarg value="-s"/>
3.283 + <compilerarg path="@{apgeneratedsrcdir}"/>
3.284 + <compilerarg line="${ap.proc.none.internal}"/>
3.285 + <customize/>
3.286 + </javac>
3.287 + </sequential>
3.288 + </macrodef>
3.289 + </target>
3.290 + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
3.291 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
3.292 + <attribute default="${src.dir}" name="srcdir"/>
3.293 + <attribute default="${build.classes.dir}" name="destdir"/>
3.294 + <attribute default="${javac.classpath}" name="classpath"/>
3.295 + <attribute default="${javac.processorpath}" name="processorpath"/>
3.296 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
3.297 + <attribute default="${includes}" name="includes"/>
3.298 + <attribute default="${excludes}" name="excludes"/>
3.299 + <attribute default="${javac.debug}" name="debug"/>
3.300 + <attribute default="${empty.dir}" name="sourcepath"/>
3.301 + <attribute default="${empty.dir}" name="gensrcdir"/>
3.302 + <element name="customize" optional="true"/>
3.303 + <sequential>
3.304 + <property location="${build.dir}/empty" name="empty.dir"/>
3.305 + <mkdir dir="${empty.dir}"/>
3.306 + <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}">
3.307 + <src>
3.308 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
3.309 + <include name="*"/>
3.310 + </dirset>
3.311 + </src>
3.312 + <classpath>
3.313 + <path path="@{classpath}"/>
3.314 + </classpath>
3.315 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
3.316 + <compilerarg line="${javac.profile.cmd.line.arg}"/>
3.317 + <compilerarg line="${javac.compilerargs}"/>
3.318 + <customize/>
3.319 + </javac>
3.320 + </sequential>
3.321 + </macrodef>
3.322 + </target>
3.323 + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
3.324 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
3.325 + <attribute default="${src.dir}" name="srcdir"/>
3.326 + <attribute default="${build.classes.dir}" name="destdir"/>
3.327 + <attribute default="${javac.classpath}" name="classpath"/>
3.328 + <sequential>
3.329 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
3.330 + <classpath>
3.331 + <path path="@{classpath}"/>
3.332 + </classpath>
3.333 + </depend>
3.334 + </sequential>
3.335 + </macrodef>
3.336 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
3.337 + <attribute default="${build.classes.dir}" name="destdir"/>
3.338 + <sequential>
3.339 + <fail unless="javac.includes">Must set javac.includes</fail>
3.340 + <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
3.341 + <path>
3.342 + <filelist dir="@{destdir}" files="${javac.includes}"/>
3.343 + </path>
3.344 + <globmapper from="*.java" to="*.class"/>
3.345 + </pathconvert>
3.346 + <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
3.347 + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
3.348 + <delete>
3.349 + <files includesfile="${javac.includesfile.binary}"/>
3.350 + </delete>
3.351 + <delete>
3.352 + <fileset file="${javac.includesfile.binary}"/>
3.353 + </delete>
3.354 + </sequential>
3.355 + </macrodef>
3.356 + </target>
3.357 + <target if="${junit.available}" name="-init-macrodef-junit-init">
3.358 + <condition else="false" property="nb.junit.batch" value="true">
3.359 + <and>
3.360 + <istrue value="${junit.available}"/>
3.361 + <not>
3.362 + <isset property="test.method"/>
3.363 + </not>
3.364 + </and>
3.365 + </condition>
3.366 + <condition else="false" property="nb.junit.single" value="true">
3.367 + <and>
3.368 + <istrue value="${junit.available}"/>
3.369 + <isset property="test.method"/>
3.370 + </and>
3.371 + </condition>
3.372 + </target>
3.373 + <target name="-init-test-properties">
3.374 + <property name="test.binaryincludes" value="<nothing>"/>
3.375 + <property name="test.binarytestincludes" value=""/>
3.376 + <property name="test.binaryexcludes" value=""/>
3.377 + </target>
3.378 + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
3.379 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
3.380 + <attribute default="${includes}" name="includes"/>
3.381 + <attribute default="${excludes}" name="excludes"/>
3.382 + <attribute default="**" name="testincludes"/>
3.383 + <attribute default="" name="testmethods"/>
3.384 + <element name="customize" optional="true"/>
3.385 + <sequential>
3.386 + <property name="junit.forkmode" value="perTest"/>
3.387 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
3.388 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
3.389 + <syspropertyset>
3.390 + <propertyref prefix="test-sys-prop."/>
3.391 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3.392 + </syspropertyset>
3.393 + <formatter type="brief" usefile="false"/>
3.394 + <formatter type="xml"/>
3.395 + <jvmarg value="-ea"/>
3.396 + <customize/>
3.397 + </junit>
3.398 + </sequential>
3.399 + </macrodef>
3.400 + </target>
3.401 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
3.402 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
3.403 + <attribute default="${includes}" name="includes"/>
3.404 + <attribute default="${excludes}" name="excludes"/>
3.405 + <attribute default="**" name="testincludes"/>
3.406 + <attribute default="" name="testmethods"/>
3.407 + <element name="customize" optional="true"/>
3.408 + <sequential>
3.409 + <property name="junit.forkmode" value="perTest"/>
3.410 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
3.411 + <batchtest todir="${build.test.results.dir}">
3.412 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
3.413 + <filename name="@{testincludes}"/>
3.414 + </fileset>
3.415 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
3.416 + <filename name="${test.binarytestincludes}"/>
3.417 + </fileset>
3.418 + </batchtest>
3.419 + <syspropertyset>
3.420 + <propertyref prefix="test-sys-prop."/>
3.421 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3.422 + </syspropertyset>
3.423 + <formatter type="brief" usefile="false"/>
3.424 + <formatter type="xml"/>
3.425 + <jvmarg value="-ea"/>
3.426 + <customize/>
3.427 + </junit>
3.428 + </sequential>
3.429 + </macrodef>
3.430 + </target>
3.431 + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
3.432 + <target if="${testng.available}" name="-init-macrodef-testng">
3.433 + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
3.434 + <attribute default="${includes}" name="includes"/>
3.435 + <attribute default="${excludes}" name="excludes"/>
3.436 + <attribute default="**" name="testincludes"/>
3.437 + <attribute default="" name="testmethods"/>
3.438 + <element name="customize" optional="true"/>
3.439 + <sequential>
3.440 + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
3.441 + <isset property="test.method"/>
3.442 + </condition>
3.443 + <union id="test.set">
3.444 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
3.445 + <filename name="@{testincludes}"/>
3.446 + </fileset>
3.447 + </union>
3.448 + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
3.449 + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="RAII" testname="TestNG tests" workingDir="${work.dir}">
3.450 + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
3.451 + <propertyset>
3.452 + <propertyref prefix="test-sys-prop."/>
3.453 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3.454 + </propertyset>
3.455 + <customize/>
3.456 + </testng>
3.457 + </sequential>
3.458 + </macrodef>
3.459 + </target>
3.460 + <target name="-init-macrodef-test-impl">
3.461 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
3.462 + <attribute default="${includes}" name="includes"/>
3.463 + <attribute default="${excludes}" name="excludes"/>
3.464 + <attribute default="**" name="testincludes"/>
3.465 + <attribute default="" name="testmethods"/>
3.466 + <element implicit="true" name="customize" optional="true"/>
3.467 + <sequential>
3.468 + <echo>No tests executed.</echo>
3.469 + </sequential>
3.470 + </macrodef>
3.471 + </target>
3.472 + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
3.473 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
3.474 + <attribute default="${includes}" name="includes"/>
3.475 + <attribute default="${excludes}" name="excludes"/>
3.476 + <attribute default="**" name="testincludes"/>
3.477 + <attribute default="" name="testmethods"/>
3.478 + <element implicit="true" name="customize" optional="true"/>
3.479 + <sequential>
3.480 + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
3.481 + <customize/>
3.482 + </j2seproject3:junit>
3.483 + </sequential>
3.484 + </macrodef>
3.485 + </target>
3.486 + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
3.487 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
3.488 + <attribute default="${includes}" name="includes"/>
3.489 + <attribute default="${excludes}" name="excludes"/>
3.490 + <attribute default="**" name="testincludes"/>
3.491 + <attribute default="" name="testmethods"/>
3.492 + <element implicit="true" name="customize" optional="true"/>
3.493 + <sequential>
3.494 + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
3.495 + <customize/>
3.496 + </j2seproject3:testng>
3.497 + </sequential>
3.498 + </macrodef>
3.499 + </target>
3.500 + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
3.501 + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
3.502 + <attribute default="${includes}" name="includes"/>
3.503 + <attribute default="${excludes}" name="excludes"/>
3.504 + <attribute default="**" name="testincludes"/>
3.505 + <attribute default="" name="testmethods"/>
3.506 + <sequential>
3.507 + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
3.508 + <customize>
3.509 + <classpath>
3.510 + <path path="${run.test.classpath}"/>
3.511 + </classpath>
3.512 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.513 + <jvmarg line="${run.jvmargs}"/>
3.514 + <jvmarg line="${run.jvmargs.ide}"/>
3.515 + </customize>
3.516 + </j2seproject3:test-impl>
3.517 + </sequential>
3.518 + </macrodef>
3.519 + </target>
3.520 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
3.521 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.522 + <attribute default="${includes}" name="includes"/>
3.523 + <attribute default="${excludes}" name="excludes"/>
3.524 + <attribute default="**" name="testincludes"/>
3.525 + <attribute default="" name="testmethods"/>
3.526 + <element name="customize" optional="true"/>
3.527 + <sequential>
3.528 + <property name="junit.forkmode" value="perTest"/>
3.529 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
3.530 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
3.531 + <syspropertyset>
3.532 + <propertyref prefix="test-sys-prop."/>
3.533 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3.534 + </syspropertyset>
3.535 + <formatter type="brief" usefile="false"/>
3.536 + <formatter type="xml"/>
3.537 + <jvmarg value="-ea"/>
3.538 + <jvmarg line="${debug-args-line}"/>
3.539 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
3.540 + <customize/>
3.541 + </junit>
3.542 + </sequential>
3.543 + </macrodef>
3.544 + </target>
3.545 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
3.546 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.547 + <attribute default="${includes}" name="includes"/>
3.548 + <attribute default="${excludes}" name="excludes"/>
3.549 + <attribute default="**" name="testincludes"/>
3.550 + <attribute default="" name="testmethods"/>
3.551 + <element name="customize" optional="true"/>
3.552 + <sequential>
3.553 + <property name="junit.forkmode" value="perTest"/>
3.554 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
3.555 + <batchtest todir="${build.test.results.dir}">
3.556 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
3.557 + <filename name="@{testincludes}"/>
3.558 + </fileset>
3.559 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
3.560 + <filename name="${test.binarytestincludes}"/>
3.561 + </fileset>
3.562 + </batchtest>
3.563 + <syspropertyset>
3.564 + <propertyref prefix="test-sys-prop."/>
3.565 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3.566 + </syspropertyset>
3.567 + <formatter type="brief" usefile="false"/>
3.568 + <formatter type="xml"/>
3.569 + <jvmarg value="-ea"/>
3.570 + <jvmarg line="${debug-args-line}"/>
3.571 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
3.572 + <customize/>
3.573 + </junit>
3.574 + </sequential>
3.575 + </macrodef>
3.576 + </target>
3.577 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
3.578 + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
3.579 + <attribute default="${includes}" name="includes"/>
3.580 + <attribute default="${excludes}" name="excludes"/>
3.581 + <attribute default="**" name="testincludes"/>
3.582 + <attribute default="" name="testmethods"/>
3.583 + <element implicit="true" name="customize" optional="true"/>
3.584 + <sequential>
3.585 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
3.586 + <customize/>
3.587 + </j2seproject3:junit-debug>
3.588 + </sequential>
3.589 + </macrodef>
3.590 + </target>
3.591 + <target if="${testng.available}" name="-init-macrodef-testng-debug">
3.592 + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.593 + <attribute default="${main.class}" name="testClass"/>
3.594 + <attribute default="" name="testMethod"/>
3.595 + <element name="customize2" optional="true"/>
3.596 + <sequential>
3.597 + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
3.598 + <isset property="test.method"/>
3.599 + </condition>
3.600 + <condition else="-suitename RAII -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
3.601 + <matches pattern=".*\.xml" string="@{testClass}"/>
3.602 + </condition>
3.603 + <delete dir="${build.test.results.dir}" quiet="true"/>
3.604 + <mkdir dir="${build.test.results.dir}"/>
3.605 + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
3.606 + <customize>
3.607 + <customize2/>
3.608 + <jvmarg value="-ea"/>
3.609 + <arg line="${testng.debug.mode}"/>
3.610 + <arg line="-d ${build.test.results.dir}"/>
3.611 + <arg line="-listener org.testng.reporters.VerboseReporter"/>
3.612 + <arg line="${testng.cmd.args}"/>
3.613 + </customize>
3.614 + </j2seproject3:debug>
3.615 + </sequential>
3.616 + </macrodef>
3.617 + </target>
3.618 + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
3.619 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
3.620 + <attribute default="${main.class}" name="testClass"/>
3.621 + <attribute default="" name="testMethod"/>
3.622 + <element implicit="true" name="customize2" optional="true"/>
3.623 + <sequential>
3.624 + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
3.625 + <customize2/>
3.626 + </j2seproject3:testng-debug>
3.627 + </sequential>
3.628 + </macrodef>
3.629 + </target>
3.630 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
3.631 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.632 + <attribute default="${includes}" name="includes"/>
3.633 + <attribute default="${excludes}" name="excludes"/>
3.634 + <attribute default="**" name="testincludes"/>
3.635 + <attribute default="" name="testmethods"/>
3.636 + <attribute default="${main.class}" name="testClass"/>
3.637 + <attribute default="" name="testMethod"/>
3.638 + <sequential>
3.639 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
3.640 + <customize>
3.641 + <classpath>
3.642 + <path path="${run.test.classpath}"/>
3.643 + </classpath>
3.644 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.645 + <jvmarg line="${run.jvmargs}"/>
3.646 + <jvmarg line="${run.jvmargs.ide}"/>
3.647 + </customize>
3.648 + </j2seproject3:test-debug-impl>
3.649 + </sequential>
3.650 + </macrodef>
3.651 + </target>
3.652 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
3.653 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.654 + <attribute default="${includes}" name="includes"/>
3.655 + <attribute default="${excludes}" name="excludes"/>
3.656 + <attribute default="**" name="testincludes"/>
3.657 + <attribute default="" name="testmethods"/>
3.658 + <attribute default="${main.class}" name="testClass"/>
3.659 + <attribute default="" name="testMethod"/>
3.660 + <sequential>
3.661 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
3.662 + <customize2>
3.663 + <syspropertyset>
3.664 + <propertyref prefix="test-sys-prop."/>
3.665 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3.666 + </syspropertyset>
3.667 + </customize2>
3.668 + </j2seproject3:testng-debug-impl>
3.669 + </sequential>
3.670 + </macrodef>
3.671 + </target>
3.672 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
3.673 + <!--
3.674 + pre NB7.2 profiling section; consider it deprecated
3.675 + -->
3.676 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
3.677 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
3.678 + <!-- Empty placeholder for easier customization. -->
3.679 + <!-- You can override this target in the ../build.xml file. -->
3.680 + </target>
3.681 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
3.682 + <!-- Empty placeholder for easier customization. -->
3.683 + <!-- You can override this target in the ../build.xml file. -->
3.684 + </target>
3.685 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
3.686 + <macrodef name="resolve">
3.687 + <attribute name="name"/>
3.688 + <attribute name="value"/>
3.689 + <sequential>
3.690 + <property name="@{name}" value="${env.@{value}}"/>
3.691 + </sequential>
3.692 + </macrodef>
3.693 + <macrodef name="profile">
3.694 + <attribute default="${main.class}" name="classname"/>
3.695 + <element name="customize" optional="true"/>
3.696 + <sequential>
3.697 + <property environment="env"/>
3.698 + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
3.699 + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
3.700 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.701 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
3.702 + <jvmarg line="${profiler.info.jvmargs}"/>
3.703 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
3.704 + <arg line="${application.args}"/>
3.705 + <classpath>
3.706 + <path path="${run.classpath}"/>
3.707 + </classpath>
3.708 + <syspropertyset>
3.709 + <propertyref prefix="run-sys-prop."/>
3.710 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
3.711 + </syspropertyset>
3.712 + <customize/>
3.713 + </java>
3.714 + </sequential>
3.715 + </macrodef>
3.716 + </target>
3.717 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
3.718 + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
3.719 + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
3.720 + </target>
3.721 + <!--
3.722 + end of pre NB7.2 profiling section
3.723 + -->
3.724 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
3.725 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
3.726 + <attribute default="${main.class}" name="name"/>
3.727 + <attribute default="${debug.classpath}" name="classpath"/>
3.728 + <attribute default="" name="stopclassname"/>
3.729 + <sequential>
3.730 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
3.731 + <classpath>
3.732 + <path path="@{classpath}"/>
3.733 + </classpath>
3.734 + </nbjpdastart>
3.735 + </sequential>
3.736 + </macrodef>
3.737 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
3.738 + <attribute default="${build.classes.dir}" name="dir"/>
3.739 + <sequential>
3.740 + <nbjpdareload>
3.741 + <fileset dir="@{dir}" includes="${fix.classes}">
3.742 + <include name="${fix.includes}*.class"/>
3.743 + </fileset>
3.744 + </nbjpdareload>
3.745 + </sequential>
3.746 + </macrodef>
3.747 + </target>
3.748 + <target name="-init-debug-args">
3.749 + <property name="version-output" value="java version "${ant.java.version}"/>
3.750 + <condition property="have-jdk-older-than-1.4">
3.751 + <or>
3.752 + <contains string="${version-output}" substring="java version "1.0"/>
3.753 + <contains string="${version-output}" substring="java version "1.1"/>
3.754 + <contains string="${version-output}" substring="java version "1.2"/>
3.755 + <contains string="${version-output}" substring="java version "1.3"/>
3.756 + </or>
3.757 + </condition>
3.758 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
3.759 + <istrue value="${have-jdk-older-than-1.4}"/>
3.760 + </condition>
3.761 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
3.762 + <os family="windows"/>
3.763 + </condition>
3.764 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
3.765 + <isset property="debug.transport"/>
3.766 + </condition>
3.767 + </target>
3.768 + <target depends="-init-debug-args" name="-init-macrodef-debug">
3.769 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.770 + <attribute default="${main.class}" name="classname"/>
3.771 + <attribute default="${debug.classpath}" name="classpath"/>
3.772 + <element name="customize" optional="true"/>
3.773 + <sequential>
3.774 + <java classname="@{classname}" dir="${work.dir}" fork="true">
3.775 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.776 + <jvmarg line="${debug-args-line}"/>
3.777 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
3.778 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
3.779 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
3.780 + <jvmarg line="${run.jvmargs}"/>
3.781 + <jvmarg line="${run.jvmargs.ide}"/>
3.782 + <classpath>
3.783 + <path path="@{classpath}"/>
3.784 + </classpath>
3.785 + <syspropertyset>
3.786 + <propertyref prefix="run-sys-prop."/>
3.787 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
3.788 + </syspropertyset>
3.789 + <customize/>
3.790 + </java>
3.791 + </sequential>
3.792 + </macrodef>
3.793 + </target>
3.794 + <target name="-init-macrodef-java">
3.795 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
3.796 + <attribute default="${main.class}" name="classname"/>
3.797 + <attribute default="${run.classpath}" name="classpath"/>
3.798 + <attribute default="jvm" name="jvm"/>
3.799 + <element name="customize" optional="true"/>
3.800 + <sequential>
3.801 + <java classname="@{classname}" dir="${work.dir}" fork="true">
3.802 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.803 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
3.804 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
3.805 + <jvmarg line="${run.jvmargs}"/>
3.806 + <jvmarg line="${run.jvmargs.ide}"/>
3.807 + <classpath>
3.808 + <path path="@{classpath}"/>
3.809 + </classpath>
3.810 + <syspropertyset>
3.811 + <propertyref prefix="run-sys-prop."/>
3.812 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
3.813 + </syspropertyset>
3.814 + <customize/>
3.815 + </java>
3.816 + </sequential>
3.817 + </macrodef>
3.818 + </target>
3.819 + <target name="-init-macrodef-copylibs">
3.820 + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
3.821 + <attribute default="${manifest.file}" name="manifest"/>
3.822 + <element name="customize" optional="true"/>
3.823 + <sequential>
3.824 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
3.825 + <pathconvert property="run.classpath.without.build.classes.dir">
3.826 + <path path="${run.classpath}"/>
3.827 + <map from="${build.classes.dir.resolved}" to=""/>
3.828 + </pathconvert>
3.829 + <pathconvert pathsep=" " property="jar.classpath">
3.830 + <path path="${run.classpath.without.build.classes.dir}"/>
3.831 + <chainedmapper>
3.832 + <flattenmapper/>
3.833 + <filtermapper>
3.834 + <replacestring from=" " to="%20"/>
3.835 + </filtermapper>
3.836 + <globmapper from="*" to="lib/*"/>
3.837 + </chainedmapper>
3.838 + </pathconvert>
3.839 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
3.840 + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
3.841 + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
3.842 + <manifest>
3.843 + <attribute name="Class-Path" value="${jar.classpath}"/>
3.844 + <customize/>
3.845 + </manifest>
3.846 + </copylibs>
3.847 + </sequential>
3.848 + </macrodef>
3.849 + </target>
3.850 + <target name="-init-presetdef-jar">
3.851 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
3.852 + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
3.853 + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
3.854 + </jar>
3.855 + </presetdef>
3.856 + </target>
3.857 + <target name="-init-ap-cmdline-properties">
3.858 + <property name="annotation.processing.enabled" value="true"/>
3.859 + <property name="annotation.processing.processors.list" value=""/>
3.860 + <property name="annotation.processing.processor.options" value=""/>
3.861 + <property name="annotation.processing.run.all.processors" value="true"/>
3.862 + <property name="javac.processorpath" value="${javac.classpath}"/>
3.863 + <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
3.864 + <condition property="ap.supported.internal" value="true">
3.865 + <not>
3.866 + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
3.867 + </not>
3.868 + </condition>
3.869 + </target>
3.870 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
3.871 + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
3.872 + <isfalse value="${annotation.processing.run.all.processors}"/>
3.873 + </condition>
3.874 + <condition else="" property="ap.proc.none.internal" value="-proc:none">
3.875 + <isfalse value="${annotation.processing.enabled}"/>
3.876 + </condition>
3.877 + </target>
3.878 + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
3.879 + <property name="ap.cmd.line.internal" value=""/>
3.880 + </target>
3.881 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
3.882 + <!--
3.883 + ===================
3.884 + COMPILATION SECTION
3.885 + ===================
3.886 + -->
3.887 + <target name="-deps-jar-init" unless="built-jar.properties">
3.888 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
3.889 + <delete file="${built-jar.properties}" quiet="true"/>
3.890 + </target>
3.891 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
3.892 + <echo level="warn" message="Cycle detected: RAII was already built"/>
3.893 + </target>
3.894 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
3.895 + <mkdir dir="${build.dir}"/>
3.896 + <touch file="${built-jar.properties}" verbose="false"/>
3.897 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
3.898 + <antcall target="-warn-already-built-jar"/>
3.899 + <propertyfile file="${built-jar.properties}">
3.900 + <entry key="${basedir}" value=""/>
3.901 + </propertyfile>
3.902 + </target>
3.903 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
3.904 + <target depends="init" name="-check-automatic-build">
3.905 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
3.906 + </target>
3.907 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
3.908 + <antcall target="clean"/>
3.909 + </target>
3.910 + <target depends="init,deps-jar" name="-pre-pre-compile">
3.911 + <mkdir dir="${build.classes.dir}"/>
3.912 + </target>
3.913 + <target name="-pre-compile">
3.914 + <!-- Empty placeholder for easier customization. -->
3.915 + <!-- You can override this target in the ../build.xml file. -->
3.916 + </target>
3.917 + <target if="do.depend.true" name="-compile-depend">
3.918 + <pathconvert property="build.generated.subdirs">
3.919 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3.920 + <include name="*"/>
3.921 + </dirset>
3.922 + </pathconvert>
3.923 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
3.924 + </target>
3.925 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
3.926 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
3.927 + <copy todir="${build.classes.dir}">
3.928 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
3.929 + </copy>
3.930 + </target>
3.931 + <target if="has.persistence.xml" name="-copy-persistence-xml">
3.932 + <mkdir dir="${build.classes.dir}/META-INF"/>
3.933 + <copy todir="${build.classes.dir}/META-INF">
3.934 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
3.935 + </copy>
3.936 + </target>
3.937 + <target name="-post-compile">
3.938 + <!-- Empty placeholder for easier customization. -->
3.939 + <!-- You can override this target in the ../build.xml file. -->
3.940 + </target>
3.941 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
3.942 + <target name="-pre-compile-single">
3.943 + <!-- Empty placeholder for easier customization. -->
3.944 + <!-- You can override this target in the ../build.xml file. -->
3.945 + </target>
3.946 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
3.947 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
3.948 + <j2seproject3:force-recompile/>
3.949 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
3.950 + </target>
3.951 + <target name="-post-compile-single">
3.952 + <!-- Empty placeholder for easier customization. -->
3.953 + <!-- You can override this target in the ../build.xml file. -->
3.954 + </target>
3.955 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
3.956 + <!--
3.957 + ====================
3.958 + JAR BUILDING SECTION
3.959 + ====================
3.960 + -->
3.961 + <target depends="init" name="-pre-pre-jar">
3.962 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
3.963 + <mkdir dir="${dist.jar.dir}"/>
3.964 + </target>
3.965 + <target name="-pre-jar">
3.966 + <!-- Empty placeholder for easier customization. -->
3.967 + <!-- You can override this target in the ../build.xml file. -->
3.968 + </target>
3.969 + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available">
3.970 + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
3.971 + <touch file="${tmp.manifest.file}" verbose="false"/>
3.972 + </target>
3.973 + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest">
3.974 + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
3.975 + <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
3.976 + </target>
3.977 + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
3.978 + <manifest file="${tmp.manifest.file}" mode="update">
3.979 + <attribute name="Main-Class" value="${main.class}"/>
3.980 + </manifest>
3.981 + </target>
3.982 + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile">
3.983 + <manifest file="${tmp.manifest.file}" mode="update">
3.984 + <attribute name="Profile" value="${javac.profile}"/>
3.985 + </manifest>
3.986 + </target>
3.987 + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen">
3.988 + <basename file="${application.splash}" property="splashscreen.basename"/>
3.989 + <mkdir dir="${build.classes.dir}/META-INF"/>
3.990 + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
3.991 + <manifest file="${tmp.manifest.file}" mode="update">
3.992 + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
3.993 + </manifest>
3.994 + </target>
3.995 + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs">
3.996 + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
3.997 + <echo level="info">To run this application from the command line without Ant, try:</echo>
3.998 + <property location="${dist.jar}" name="dist.jar.resolved"/>
3.999 + <echo level="info">java -jar "${dist.jar.resolved}"</echo>
3.1000 + </target>
3.1001 + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
3.1002 + <j2seproject1:jar manifest="${tmp.manifest.file}"/>
3.1003 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
3.1004 + <property location="${dist.jar}" name="dist.jar.resolved"/>
3.1005 + <pathconvert property="run.classpath.with.dist.jar">
3.1006 + <path path="${run.classpath}"/>
3.1007 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
3.1008 + </pathconvert>
3.1009 + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}">
3.1010 + <isset property="main.class.available"/>
3.1011 + </condition>
3.1012 + <condition else="debug" property="jar.usage.level" value="info">
3.1013 + <isset property="main.class.available"/>
3.1014 + </condition>
3.1015 + <echo level="${jar.usage.level}" message="${jar.usage.message}"/>
3.1016 + </target>
3.1017 + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest">
3.1018 + <delete>
3.1019 + <fileset file="${tmp.manifest.file}"/>
3.1020 + </delete>
3.1021 + </target>
3.1022 + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/>
3.1023 + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/>
3.1024 + <target name="-post-jar">
3.1025 + <!-- Empty placeholder for easier customization. -->
3.1026 + <!-- You can override this target in the ../build.xml file. -->
3.1027 + </target>
3.1028 + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
3.1029 + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/>
3.1030 + <!--
3.1031 + =================
3.1032 + EXECUTION SECTION
3.1033 + =================
3.1034 + -->
3.1035 + <target depends="init,compile" description="Run a main class." name="run">
3.1036 + <j2seproject1:java>
3.1037 + <customize>
3.1038 + <arg line="${application.args}"/>
3.1039 + </customize>
3.1040 + </j2seproject1:java>
3.1041 + </target>
3.1042 + <target name="-do-not-recompile">
3.1043 + <property name="javac.includes.binary" value=""/>
3.1044 + </target>
3.1045 + <target depends="init,compile-single" name="run-single">
3.1046 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3.1047 + <j2seproject1:java classname="${run.class}"/>
3.1048 + </target>
3.1049 + <target depends="init,compile-test-single" name="run-test-with-main">
3.1050 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3.1051 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
3.1052 + </target>
3.1053 + <!--
3.1054 + =================
3.1055 + DEBUGGING SECTION
3.1056 + =================
3.1057 + -->
3.1058 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
3.1059 + <j2seproject1:nbjpdastart name="${debug.class}"/>
3.1060 + </target>
3.1061 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
3.1062 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
3.1063 + </target>
3.1064 + <target depends="init,compile" name="-debug-start-debuggee">
3.1065 + <j2seproject3:debug>
3.1066 + <customize>
3.1067 + <arg line="${application.args}"/>
3.1068 + </customize>
3.1069 + </j2seproject3:debug>
3.1070 + </target>
3.1071 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
3.1072 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
3.1073 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
3.1074 + </target>
3.1075 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
3.1076 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
3.1077 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
3.1078 + <j2seproject3:debug classname="${debug.class}"/>
3.1079 + </target>
3.1080 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
3.1081 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
3.1082 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
3.1083 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
3.1084 + </target>
3.1085 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
3.1086 + <target depends="init" name="-pre-debug-fix">
3.1087 + <fail unless="fix.includes">Must set fix.includes</fail>
3.1088 + <property name="javac.includes" value="${fix.includes}.java"/>
3.1089 + </target>
3.1090 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
3.1091 + <j2seproject1:nbjpdareload/>
3.1092 + </target>
3.1093 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
3.1094 + <!--
3.1095 + =================
3.1096 + PROFILING SECTION
3.1097 + =================
3.1098 + -->
3.1099 + <!--
3.1100 + pre NB7.2 profiler integration
3.1101 + -->
3.1102 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
3.1103 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
3.1104 + <nbprofiledirect>
3.1105 + <classpath>
3.1106 + <path path="${run.classpath}"/>
3.1107 + </classpath>
3.1108 + </nbprofiledirect>
3.1109 + <profile/>
3.1110 + </target>
3.1111 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
3.1112 + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
3.1113 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
3.1114 + <nbprofiledirect>
3.1115 + <classpath>
3.1116 + <path path="${run.classpath}"/>
3.1117 + </classpath>
3.1118 + </nbprofiledirect>
3.1119 + <profile classname="${profile.class}"/>
3.1120 + </target>
3.1121 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
3.1122 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
3.1123 + <nbprofiledirect>
3.1124 + <classpath>
3.1125 + <path path="${run.classpath}"/>
3.1126 + </classpath>
3.1127 + </nbprofiledirect>
3.1128 + <profile classname="sun.applet.AppletViewer">
3.1129 + <customize>
3.1130 + <arg value="${applet.url}"/>
3.1131 + </customize>
3.1132 + </profile>
3.1133 + </target>
3.1134 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
3.1135 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
3.1136 + <nbprofiledirect>
3.1137 + <classpath>
3.1138 + <path path="${run.test.classpath}"/>
3.1139 + </classpath>
3.1140 + </nbprofiledirect>
3.1141 + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
3.1142 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
3.1143 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
3.1144 + <jvmarg line="${profiler.info.jvmargs}"/>
3.1145 + <test name="${profile.class}"/>
3.1146 + <classpath>
3.1147 + <path path="${run.test.classpath}"/>
3.1148 + </classpath>
3.1149 + <syspropertyset>
3.1150 + <propertyref prefix="test-sys-prop."/>
3.1151 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
3.1152 + </syspropertyset>
3.1153 + <formatter type="brief" usefile="false"/>
3.1154 + <formatter type="xml"/>
3.1155 + </junit>
3.1156 + </target>
3.1157 + <!--
3.1158 + end of pre NB72 profiling section
3.1159 + -->
3.1160 + <target if="netbeans.home" name="-profile-check">
3.1161 + <condition property="profiler.configured">
3.1162 + <or>
3.1163 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
3.1164 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
3.1165 + </or>
3.1166 + </condition>
3.1167 + </target>
3.1168 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
3.1169 + <startprofiler/>
3.1170 + <antcall target="run"/>
3.1171 + </target>
3.1172 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
3.1173 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3.1174 + <startprofiler/>
3.1175 + <antcall target="run-single"/>
3.1176 + </target>
3.1177 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
3.1178 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
3.1179 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
3.1180 + <startprofiler/>
3.1181 + <antcall target="test-single"/>
3.1182 + </target>
3.1183 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
3.1184 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3.1185 + <startprofiler/>
3.1186 + <antcal target="run-test-with-main"/>
3.1187 + </target>
3.1188 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
3.1189 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
3.1190 + <startprofiler/>
3.1191 + <antcall target="run-applet"/>
3.1192 + </target>
3.1193 + <!--
3.1194 + ===============
3.1195 + JAVADOC SECTION
3.1196 + ===============
3.1197 + -->
3.1198 + <target depends="init" if="have.sources" name="-javadoc-build">
3.1199 + <mkdir dir="${dist.javadoc.dir}"/>
3.1200 + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
3.1201 + <and>
3.1202 + <isset property="endorsed.classpath.cmd.line.arg"/>
3.1203 + <not>
3.1204 + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
3.1205 + </not>
3.1206 + </and>
3.1207 + </condition>
3.1208 + <condition else="" property="bug5101868workaround" value="*.java">
3.1209 + <matches pattern="1\.[56](\..*)?" string="${java.version}"/>
3.1210 + </condition>
3.1211 + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${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}">
3.1212 + <classpath>
3.1213 + <path path="${javac.classpath}"/>
3.1214 + </classpath>
3.1215 + <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
3.1216 + <filename name="**/*.java"/>
3.1217 + </fileset>
3.1218 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3.1219 + <include name="**/*.java"/>
3.1220 + <exclude name="*.java"/>
3.1221 + </fileset>
3.1222 + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
3.1223 + </javadoc>
3.1224 + <copy todir="${dist.javadoc.dir}">
3.1225 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
3.1226 + <filename name="**/doc-files/**"/>
3.1227 + </fileset>
3.1228 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3.1229 + <include name="**/doc-files/**"/>
3.1230 + </fileset>
3.1231 + </copy>
3.1232 + </target>
3.1233 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
3.1234 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
3.1235 + </target>
3.1236 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
3.1237 + <!--
3.1238 + =========================
3.1239 + TEST COMPILATION SECTION
3.1240 + =========================
3.1241 + -->
3.1242 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
3.1243 + <mkdir dir="${build.test.classes.dir}"/>
3.1244 + </target>
3.1245 + <target name="-pre-compile-test">
3.1246 + <!-- Empty placeholder for easier customization. -->
3.1247 + <!-- You can override this target in the ../build.xml file. -->
3.1248 + </target>
3.1249 + <target if="do.depend.true" name="-compile-test-depend">
3.1250 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
3.1251 + </target>
3.1252 + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
3.1253 + <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}"/>
3.1254 + <copy todir="${build.test.classes.dir}">
3.1255 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
3.1256 + </copy>
3.1257 + </target>
3.1258 + <target name="-post-compile-test">
3.1259 + <!-- Empty placeholder for easier customization. -->
3.1260 + <!-- You can override this target in the ../build.xml file. -->
3.1261 + </target>
3.1262 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
3.1263 + <target name="-pre-compile-test-single">
3.1264 + <!-- Empty placeholder for easier customization. -->
3.1265 + <!-- You can override this target in the ../build.xml file. -->
3.1266 + </target>
3.1267 + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
3.1268 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
3.1269 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
3.1270 + <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}"/>
3.1271 + <copy todir="${build.test.classes.dir}">
3.1272 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
3.1273 + </copy>
3.1274 + </target>
3.1275 + <target name="-post-compile-test-single">
3.1276 + <!-- Empty placeholder for easier customization. -->
3.1277 + <!-- You can override this target in the ../build.xml file. -->
3.1278 + </target>
3.1279 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
3.1280 + <!--
3.1281 + =======================
3.1282 + TEST EXECUTION SECTION
3.1283 + =======================
3.1284 + -->
3.1285 + <target depends="init" if="have.tests" name="-pre-test-run">
3.1286 + <mkdir dir="${build.test.results.dir}"/>
3.1287 + </target>
3.1288 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
3.1289 + <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/>
3.1290 + </target>
3.1291 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
3.1292 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
3.1293 + </target>
3.1294 + <target depends="init" if="have.tests" name="test-report"/>
3.1295 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
3.1296 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
3.1297 + <target depends="init" if="have.tests" name="-pre-test-run-single">
3.1298 + <mkdir dir="${build.test.results.dir}"/>
3.1299 + </target>
3.1300 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
3.1301 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
3.1302 + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
3.1303 + </target>
3.1304 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
3.1305 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
3.1306 + </target>
3.1307 + <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"/>
3.1308 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
3.1309 + <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
3.1310 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
3.1311 + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
3.1312 + </target>
3.1313 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
3.1314 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
3.1315 + </target>
3.1316 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
3.1317 + <!--
3.1318 + =======================
3.1319 + TEST DEBUGGING SECTION
3.1320 + =======================
3.1321 + -->
3.1322 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
3.1323 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
3.1324 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
3.1325 + </target>
3.1326 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
3.1327 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
3.1328 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
3.1329 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
3.1330 + </target>
3.1331 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
3.1332 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
3.1333 + </target>
3.1334 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
3.1335 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
3.1336 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
3.1337 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
3.1338 + </target>
3.1339 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
3.1340 + <!--
3.1341 + =========================
3.1342 + APPLET EXECUTION SECTION
3.1343 + =========================
3.1344 + -->
3.1345 + <target depends="init,compile-single" name="run-applet">
3.1346 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
3.1347 + <j2seproject1:java classname="sun.applet.AppletViewer">
3.1348 + <customize>
3.1349 + <arg value="${applet.url}"/>
3.1350 + </customize>
3.1351 + </j2seproject1:java>
3.1352 + </target>
3.1353 + <!--
3.1354 + =========================
3.1355 + APPLET DEBUGGING SECTION
3.1356 + =========================
3.1357 + -->
3.1358 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
3.1359 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
3.1360 + <j2seproject3:debug classname="sun.applet.AppletViewer">
3.1361 + <customize>
3.1362 + <arg value="${applet.url}"/>
3.1363 + </customize>
3.1364 + </j2seproject3:debug>
3.1365 + </target>
3.1366 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
3.1367 + <!--
3.1368 + ===============
3.1369 + CLEANUP SECTION
3.1370 + ===============
3.1371 + -->
3.1372 + <target name="-deps-clean-init" unless="built-clean.properties">
3.1373 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
3.1374 + <delete file="${built-clean.properties}" quiet="true"/>
3.1375 + </target>
3.1376 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
3.1377 + <echo level="warn" message="Cycle detected: RAII was already built"/>
3.1378 + </target>
3.1379 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
3.1380 + <mkdir dir="${build.dir}"/>
3.1381 + <touch file="${built-clean.properties}" verbose="false"/>
3.1382 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
3.1383 + <antcall target="-warn-already-built-clean"/>
3.1384 + <propertyfile file="${built-clean.properties}">
3.1385 + <entry key="${basedir}" value=""/>
3.1386 + </propertyfile>
3.1387 + </target>
3.1388 + <target depends="init" name="-do-clean">
3.1389 + <delete dir="${build.dir}"/>
3.1390 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
3.1391 + </target>
3.1392 + <target name="-post-clean">
3.1393 + <!-- Empty placeholder for easier customization. -->
3.1394 + <!-- You can override this target in the ../build.xml file. -->
3.1395 + </target>
3.1396 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
3.1397 + <target name="-check-call-dep">
3.1398 + <property file="${call.built.properties}" prefix="already.built."/>
3.1399 + <condition property="should.call.dep">
3.1400 + <and>
3.1401 + <not>
3.1402 + <isset property="already.built.${call.subproject}"/>
3.1403 + </not>
3.1404 + <available file="${call.script}"/>
3.1405 + </and>
3.1406 + </condition>
3.1407 + </target>
3.1408 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
3.1409 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
3.1410 + <propertyset>
3.1411 + <propertyref prefix="transfer."/>
3.1412 + <mapper from="transfer.*" to="*" type="glob"/>
3.1413 + </propertyset>
3.1414 + </ant>
3.1415 + </target>
3.1416 +</project>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/java/RAII/nbproject/genfiles.properties Tue Sep 09 14:51:08 2014 +0200
4.3 @@ -0,0 +1,8 @@
4.4 +build.xml.data.CRC32=376d6354
4.5 +build.xml.script.CRC32=9900a8e8
4.6 +build.xml.stylesheet.CRC32=8064a381@1.74.2.48
4.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
4.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
4.9 +nbproject/build-impl.xml.data.CRC32=376d6354
4.10 +nbproject/build-impl.xml.script.CRC32=5fb085fb
4.11 +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.74.2.48
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/java/RAII/nbproject/project.properties Tue Sep 09 14:51:08 2014 +0200
5.3 @@ -0,0 +1,73 @@
5.4 +annotation.processing.enabled=true
5.5 +annotation.processing.enabled.in.editor=false
5.6 +annotation.processing.processor.options=
5.7 +annotation.processing.processors.list=
5.8 +annotation.processing.run.all.processors=true
5.9 +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
5.10 +build.classes.dir=${build.dir}/classes
5.11 +build.classes.excludes=**/*.java,**/*.form
5.12 +# This directory is removed when the project is cleaned:
5.13 +build.dir=build
5.14 +build.generated.dir=${build.dir}/generated
5.15 +build.generated.sources.dir=${build.dir}/generated-sources
5.16 +# Only compile against the classpath explicitly listed here:
5.17 +build.sysclasspath=ignore
5.18 +build.test.classes.dir=${build.dir}/test/classes
5.19 +build.test.results.dir=${build.dir}/test/results
5.20 +# Uncomment to specify the preferred debugger connection transport:
5.21 +#debug.transport=dt_socket
5.22 +debug.classpath=\
5.23 + ${run.classpath}
5.24 +debug.test.classpath=\
5.25 + ${run.test.classpath}
5.26 +# Files in build.classes.dir which should be excluded from distribution jar
5.27 +dist.archive.excludes=
5.28 +# This directory is removed when the project is cleaned:
5.29 +dist.dir=dist
5.30 +dist.jar=${dist.dir}/RAII.jar
5.31 +dist.javadoc.dir=${dist.dir}/javadoc
5.32 +excludes=
5.33 +includes=**
5.34 +jar.compress=false
5.35 +javac.classpath=
5.36 +# Space-separated list of extra javac options
5.37 +javac.compilerargs=
5.38 +javac.deprecation=false
5.39 +javac.processorpath=\
5.40 + ${javac.classpath}
5.41 +javac.source=1.7
5.42 +javac.target=1.7
5.43 +javac.test.classpath=\
5.44 + ${javac.classpath}:\
5.45 + ${build.classes.dir}
5.46 +javac.test.processorpath=\
5.47 + ${javac.test.classpath}
5.48 +javadoc.additionalparam=
5.49 +javadoc.author=false
5.50 +javadoc.encoding=${source.encoding}
5.51 +javadoc.noindex=false
5.52 +javadoc.nonavbar=false
5.53 +javadoc.notree=false
5.54 +javadoc.private=false
5.55 +javadoc.splitindex=true
5.56 +javadoc.use=true
5.57 +javadoc.version=false
5.58 +javadoc.windowtitle=
5.59 +main.class=cz.frantovo.priklady.raii.RAIIDemo
5.60 +manifest.file=manifest.mf
5.61 +meta.inf.dir=${src.dir}/META-INF
5.62 +mkdist.disabled=false
5.63 +platform.active=default_platform
5.64 +run.classpath=\
5.65 + ${javac.classpath}:\
5.66 + ${build.classes.dir}
5.67 +# Space-separated list of JVM arguments used when running the project.
5.68 +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
5.69 +# To set system properties for unit tests define test-sys-prop.name=value:
5.70 +run.jvmargs=
5.71 +run.test.classpath=\
5.72 + ${javac.test.classpath}:\
5.73 + ${build.test.classes.dir}
5.74 +source.encoding=UTF-8
5.75 +src.dir=src
5.76 +test.src.dir=test
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/java/RAII/nbproject/project.xml Tue Sep 09 14:51:08 2014 +0200
6.3 @@ -0,0 +1,15 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
6.6 + <type>org.netbeans.modules.java.j2seproject</type>
6.7 + <configuration>
6.8 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
6.9 + <name>RAII</name>
6.10 + <source-roots>
6.11 + <root id="src.dir"/>
6.12 + </source-roots>
6.13 + <test-roots>
6.14 + <root id="test.src.dir"/>
6.15 + </test-roots>
6.16 + </data>
6.17 + </configuration>
6.18 +</project>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/java/RAII/src/cz/frantovo/priklady/raii/Chyba.java Tue Sep 09 14:51:08 2014 +0200
7.3 @@ -0,0 +1,37 @@
7.4 +/**
7.5 + * RAII v Javě
7.6 + * Copyright © 2014 František Kučera (frantovo.cz)
7.7 + *
7.8 + * This program is free software: you can redistribute it and/or modify
7.9 + * it under the terms of the GNU General Public License as published by
7.10 + * the Free Software Foundation, either version 3 of the License, or
7.11 + * (at your option) any later version.
7.12 + *
7.13 + * This program is distributed in the hope that it will be useful,
7.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.16 + * GNU General Public License for more details.
7.17 + *
7.18 + * You should have received a copy of the GNU General Public License
7.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
7.20 + */
7.21 +package cz.frantovo.priklady.raii;
7.22 +
7.23 +/**
7.24 + *
7.25 + * @author Ing. František Kučera (frantovo.cz)
7.26 + */
7.27 +public class Chyba extends Exception {
7.28 +
7.29 + private final Zdroj zdroj;
7.30 +
7.31 + public Chyba(Zdroj zdroj) {
7.32 + this.zdroj = zdroj;
7.33 + }
7.34 +
7.35 + @Override
7.36 + public String toString() {
7.37 + return getClass().getSimpleName() + ": " + zdroj;
7.38 + }
7.39 +
7.40 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/java/RAII/src/cz/frantovo/priklady/raii/ChybaDělání.java Tue Sep 09 14:51:08 2014 +0200
8.3 @@ -0,0 +1,30 @@
8.4 +/**
8.5 + * RAII v Javě
8.6 + * Copyright © 2014 František Kučera (frantovo.cz)
8.7 + *
8.8 + * This program is free software: you can redistribute it and/or modify
8.9 + * it under the terms of the GNU General Public License as published by
8.10 + * the Free Software Foundation, either version 3 of the License, or
8.11 + * (at your option) any later version.
8.12 + *
8.13 + * This program is distributed in the hope that it will be useful,
8.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.16 + * GNU General Public License for more details.
8.17 + *
8.18 + * You should have received a copy of the GNU General Public License
8.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
8.20 + */
8.21 +package cz.frantovo.priklady.raii;
8.22 +
8.23 +/**
8.24 + *
8.25 + * @author Ing. František Kučera (frantovo.cz)
8.26 + */
8.27 +public class ChybaDělání extends Chyba {
8.28 +
8.29 + public ChybaDělání(Zdroj zdroj) {
8.30 + super(zdroj);
8.31 + }
8.32 +
8.33 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/java/RAII/src/cz/frantovo/priklady/raii/ChybaVytváření.java Tue Sep 09 14:51:08 2014 +0200
9.3 @@ -0,0 +1,29 @@
9.4 +/**
9.5 + * RAII v Javě
9.6 + * Copyright © 2014 František Kučera (frantovo.cz)
9.7 + *
9.8 + * This program is free software: you can redistribute it and/or modify
9.9 + * it under the terms of the GNU General Public License as published by
9.10 + * the Free Software Foundation, either version 3 of the License, or
9.11 + * (at your option) any later version.
9.12 + *
9.13 + * This program is distributed in the hope that it will be useful,
9.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.16 + * GNU General Public License for more details.
9.17 + *
9.18 + * You should have received a copy of the GNU General Public License
9.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
9.20 + */
9.21 +package cz.frantovo.priklady.raii;
9.22 +
9.23 +/**
9.24 + *
9.25 + * @author Ing. František Kučera (frantovo.cz)
9.26 + */
9.27 +public class ChybaVytváření extends Chyba {
9.28 +
9.29 + public ChybaVytváření(Zdroj zdroj) {
9.30 + super(zdroj);
9.31 + }
9.32 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/java/RAII/src/cz/frantovo/priklady/raii/ChybaZavírání.java Tue Sep 09 14:51:08 2014 +0200
10.3 @@ -0,0 +1,30 @@
10.4 +/**
10.5 + * RAII v Javě
10.6 + * Copyright © 2014 František Kučera (frantovo.cz)
10.7 + *
10.8 + * This program is free software: you can redistribute it and/or modify
10.9 + * it under the terms of the GNU General Public License as published by
10.10 + * the Free Software Foundation, either version 3 of the License, or
10.11 + * (at your option) any later version.
10.12 + *
10.13 + * This program is distributed in the hope that it will be useful,
10.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10.16 + * GNU General Public License for more details.
10.17 + *
10.18 + * You should have received a copy of the GNU General Public License
10.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
10.20 + */
10.21 +package cz.frantovo.priklady.raii;
10.22 +
10.23 +/**
10.24 + *
10.25 + * @author Ing. František Kučera (frantovo.cz)
10.26 + */
10.27 +public class ChybaZavírání extends Chyba {
10.28 +
10.29 + public ChybaZavírání(Zdroj zdroj) {
10.30 + super(zdroj);
10.31 + }
10.32 +
10.33 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/java/RAII/src/cz/frantovo/priklady/raii/RAIIDemo.java Tue Sep 09 14:51:08 2014 +0200
11.3 @@ -0,0 +1,77 @@
11.4 +/**
11.5 + * RAII v Javě
11.6 + * Copyright © 2014 František Kučera (frantovo.cz)
11.7 + *
11.8 + * This program is free software: you can redistribute it and/or modify
11.9 + * it under the terms of the GNU General Public License as published by
11.10 + * the Free Software Foundation, either version 3 of the License, or
11.11 + * (at your option) any later version.
11.12 + *
11.13 + * This program is distributed in the hope that it will be useful,
11.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11.16 + * GNU General Public License for more details.
11.17 + *
11.18 + * You should have received a copy of the GNU General Public License
11.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
11.20 + */
11.21 +package cz.frantovo.priklady.raii;
11.22 +
11.23 +/**
11.24 + *
11.25 + * @author Ing. František Kučera (frantovo.cz)
11.26 + */
11.27 +public class RAIIDemo {
11.28 +
11.29 + public static void main(String[] args) {
11.30 +
11.31 + /**
11.32 + * Bez výjimek:
11.33 + */
11.34 + try {
11.35 + try (Zdroj a = new Zdroj("a", false, false, false)) {
11.36 + try (Zdroj b = new Zdroj("b", false, false, false)) {
11.37 + try (Zdroj c = new Zdroj("c", false, false, false)) {
11.38 + a.něcoDělej();
11.39 + b.něcoDělej();
11.40 + c.něcoDělej();
11.41 + } // končí rozsah platnosti proměnné c → volá se c.close()
11.42 + } // b.close()
11.43 + } // a.close()
11.44 +
11.45 + } catch (ChybaVytváření | ChybaZavírání | ChybaDělání e) {
11.46 + System.err.println(e);
11.47 + }
11.48 +
11.49 + System.err.println("--------------------------------");
11.50 +
11.51 + /**
11.52 + * S výjimkami:
11.53 + */
11.54 + try {
11.55 + try (Zdroj a = new Zdroj("a", false, false, true)) {
11.56 + try (Zdroj b = new Zdroj("b", false, false, true)) {
11.57 + try (Zdroj c = new Zdroj("c", false, true, true)) {
11.58 + a.něcoDělej();
11.59 + b.něcoDělej();
11.60 + c.něcoDělej();
11.61 + }
11.62 + }
11.63 + }
11.64 + } catch (ChybaVytváření | ChybaZavírání | ChybaDělání e) {
11.65 + System.err.println(e);
11.66 + }
11.67 +
11.68 + System.gc(); // aby se GC vůbec stihl spustit
11.69 +
11.70 + čekej(); // aby GC stihl zavolat finalize()
11.71 +
11.72 + }
11.73 +
11.74 + private static void čekej() {
11.75 + try {
11.76 + Thread.sleep(100);
11.77 + } catch (InterruptedException ex) {
11.78 + }
11.79 + }
11.80 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/java/RAII/src/cz/frantovo/priklady/raii/Zdroj.java Tue Sep 09 14:51:08 2014 +0200
12.3 @@ -0,0 +1,70 @@
12.4 +/**
12.5 + * RAII v Javě
12.6 + * Copyright © 2014 František Kučera (frantovo.cz)
12.7 + *
12.8 + * This program is free software: you can redistribute it and/or modify
12.9 + * it under the terms of the GNU General Public License as published by
12.10 + * the Free Software Foundation, either version 3 of the License, or
12.11 + * (at your option) any later version.
12.12 + *
12.13 + * This program is distributed in the hope that it will be useful,
12.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.16 + * GNU General Public License for more details.
12.17 + *
12.18 + * You should have received a copy of the GNU General Public License
12.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
12.20 + */
12.21 +package cz.frantovo.priklady.raii;
12.22 +
12.23 +/**
12.24 + *
12.25 + * @author Ing. František Kučera (frantovo.cz)
12.26 + */
12.27 +public class Zdroj implements AutoCloseable {
12.28 +
12.29 + private final String název;
12.30 + private final boolean chybaVytváření;
12.31 + private final boolean chybaDělání;
12.32 + private final boolean chybaZavírání;
12.33 +
12.34 + public Zdroj(String název, boolean chybaVytváření, boolean chybaDělání, boolean chybaZavírání) throws ChybaVytváření {
12.35 + this.název = název;
12.36 + System.err.println("Vytváříme: " + this + " chyba=" + chybaVytváření);
12.37 + this.chybaVytváření = chybaVytváření;
12.38 + this.chybaDělání = chybaDělání;
12.39 + this.chybaZavírání = chybaZavírání;
12.40 +
12.41 + if (this.chybaVytváření) {
12.42 + throw new ChybaVytváření(this);
12.43 + }
12.44 + }
12.45 +
12.46 + public void něcoDělej() throws ChybaDělání {
12.47 + System.err.println("Něco děláme: " + this + " chyba=" + chybaDělání);
12.48 +
12.49 + if (chybaDělání) {
12.50 + throw new ChybaDělání(this);
12.51 + }
12.52 + }
12.53 +
12.54 + @Override
12.55 + public void close() throws ChybaZavírání {
12.56 + System.err.println("Zavíráme: " + this + " chyba=" + chybaZavírání);
12.57 +
12.58 + if (chybaZavírání) {
12.59 + throw new ChybaZavírání(this);
12.60 + }
12.61 + }
12.62 +
12.63 + @Override
12.64 + protected void finalize() throws Throwable {
12.65 + System.err.println("Finalizujeme: " + this);
12.66 + }
12.67 +
12.68 + @Override
12.69 + public String toString() {
12.70 + return getClass().getSimpleName() + " [" + název + "]";
12.71 + }
12.72 +
12.73 +}