Automated merge with https://hg.netbeans.org/main/contrib/
authorJesse Glick <jglick@netbeans.org>
Thu, 21 Jul 2011 12:22:20 -0400
changeset 175331c1bd5058783
parent 17526 97bc04d587aa
parent 17532 671dcd11a690
child 17534 3b8c2f160cea
Automated merge with https://hg.netbeans.org/main/contrib/
other/signatures/build.xml
other/signatures/nbproject/build-impl.xml
other/signatures/nbproject/genfiles.properties
other/signatures/nbproject/project.properties
other/signatures/nbproject/project.xml
other/signatures/src/org/netbeans/signatures/ClassScanner.java
other/signatures/src/org/netbeans/signatures/Loader.java
other/signatures/src/org/netbeans/signatures/SignatureTask.java
other/signatures/src/org/netbeans/signatures/SignatureWriter.java
other/signatures/src/org/netbeans/signatures/antlib.xml
other/signatures/test/org/netbeans/signatures/ClassScannerTest.java
other/signatures/test/org/netbeans/signatures/LoaderTest.java
other/signatures/test/org/netbeans/signatures/SignatureTaskTest.java
other/signatures/test/org/netbeans/signatures/SignatureWriterTest.java
     1.1 --- a/other/signatures/build.xml	Tue Jul 19 08:01:26 2011 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,69 +0,0 @@
     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 -<project name="signatures" default="default" basedir=".">
     1.9 -    <description>Builds, tests, and runs the project signatures.</description>
    1.10 -    <import file="nbproject/build-impl.xml"/>
    1.11 -    <!--
    1.12 -
    1.13 -    There exist several targets which are by default empty and which can be 
    1.14 -    used for execution of your tasks. These targets are usually executed 
    1.15 -    before and after some main targets. They are: 
    1.16 -
    1.17 -      -pre-init:                 called before initialization of project properties
    1.18 -      -post-init:                called after initialization of project properties
    1.19 -      -pre-compile:              called before javac compilation
    1.20 -      -post-compile:             called after javac compilation
    1.21 -      -pre-compile-single:       called before javac compilation of single file
    1.22 -      -post-compile-single:      called after javac compilation of single file
    1.23 -      -pre-compile-test:         called before javac compilation of JUnit tests
    1.24 -      -post-compile-test:        called after javac compilation of JUnit tests
    1.25 -      -pre-compile-test-single:  called before javac compilation of single JUnit test
    1.26 -      -post-compile-test-single: called after javac compilation of single JUunit test
    1.27 -      -pre-jar:                  called before JAR building
    1.28 -      -post-jar:                 called after JAR building
    1.29 -      -post-clean:               called after cleaning build products
    1.30 -
    1.31 -    (Targets beginning with '-' are not intended to be called on their own.)
    1.32 -
    1.33 -    Example of inserting an obfuscator after compilation could look like this:
    1.34 -
    1.35 -        <target name="-post-compile">
    1.36 -            <obfuscate>
    1.37 -                <fileset dir="${build.classes.dir}"/>
    1.38 -            </obfuscate>
    1.39 -        </target>
    1.40 -
    1.41 -    For list of available properties check the imported 
    1.42 -    nbproject/build-impl.xml file. 
    1.43 -
    1.44 -
    1.45 -    Another way to customize the build is by overriding existing main targets.
    1.46 -    The targets of interest are: 
    1.47 -
    1.48 -      -init-macrodef-javac:     defines macro for javac compilation
    1.49 -      -init-macrodef-junit:     defines macro for junit execution
    1.50 -      -init-macrodef-debug:     defines macro for class debugging
    1.51 -      -init-macrodef-java:      defines macro for class execution
    1.52 -      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    1.53 -      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    1.54 -      run:                      execution of project 
    1.55 -      -javadoc-build:           Javadoc generation
    1.56 -      test-report:              JUnit report generation
    1.57 -
    1.58 -    An example of overriding the target for project execution could look like this:
    1.59 -
    1.60 -        <target name="run" depends="signatures-impl.jar">
    1.61 -            <exec dir="bin" executable="launcher.exe">
    1.62 -                <arg file="${dist.jar}"/>
    1.63 -            </exec>
    1.64 -        </target>
    1.65 -
    1.66 -    Notice that the overridden target depends on the jar target and not only on 
    1.67 -    the compile target as the regular run target does. Again, for a list of available 
    1.68 -    properties which you can use, check the target you are overriding in the
    1.69 -    nbproject/build-impl.xml file. 
    1.70 -
    1.71 -    -->
    1.72 -</project>
     2.1 --- a/other/signatures/nbproject/build-impl.xml	Tue Jul 19 08:01:26 2011 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,627 +0,0 @@
     2.4 -<?xml version="1.0" encoding="UTF-8"?>
     2.5 -<!--
     2.6 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
     2.7 -***         EDIT ../build.xml INSTEAD         ***
     2.8 -
     2.9 -For the purpose of easier reading the script
    2.10 -is divided into following sections:
    2.11 -
    2.12 -  - initialization
    2.13 -  - compilation
    2.14 -  - jar
    2.15 -  - execution
    2.16 -  - debugging
    2.17 -  - javadoc
    2.18 -  - junit compilation
    2.19 -  - junit execution
    2.20 -  - junit debugging
    2.21 -  - applet
    2.22 -  - cleanup
    2.23 -
    2.24 -        -->
    2.25 -<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="signatures-impl">
    2.26 -    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
    2.27 -    <!-- 
    2.28 -                ======================
    2.29 -                INITIALIZATION SECTION 
    2.30 -                ======================
    2.31 -            -->
    2.32 -    <target name="-pre-init">
    2.33 -        <!-- Empty placeholder for easier customization. -->
    2.34 -        <!-- You can override this target in the ../build.xml file. -->
    2.35 -    </target>
    2.36 -    <target depends="-pre-init" name="-init-private">
    2.37 -        <property file="nbproject/private/config.properties"/>
    2.38 -        <property file="nbproject/private/configs/${config}.properties"/>
    2.39 -        <property file="nbproject/private/private.properties"/>
    2.40 -    </target>
    2.41 -    <target depends="-pre-init,-init-private" name="-init-user">
    2.42 -        <property file="${user.properties.file}"/>
    2.43 -        <!-- The two properties below are usually overridden -->
    2.44 -        <!-- by the active platform. Just a fallback. -->
    2.45 -        <property name="default.javac.source" value="1.4"/>
    2.46 -        <property name="default.javac.target" value="1.4"/>
    2.47 -    </target>
    2.48 -    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
    2.49 -        <property file="nbproject/configs/${config}.properties"/>
    2.50 -        <property file="nbproject/project.properties"/>
    2.51 -    </target>
    2.52 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
    2.53 -        <available file="${manifest.file}" property="manifest.available"/>
    2.54 -        <condition property="manifest.available+main.class">
    2.55 -            <and>
    2.56 -                <isset property="manifest.available"/>
    2.57 -                <isset property="main.class"/>
    2.58 -                <not>
    2.59 -                    <equals arg1="${main.class}" arg2="" trim="true"/>
    2.60 -                </not>
    2.61 -            </and>
    2.62 -        </condition>
    2.63 -        <condition property="manifest.available+main.class+mkdist.available">
    2.64 -            <and>
    2.65 -                <istrue value="${manifest.available+main.class}"/>
    2.66 -                <isset property="libs.CopyLibs.classpath"/>
    2.67 -            </and>
    2.68 -        </condition>
    2.69 -        <condition property="have.tests">
    2.70 -            <or>
    2.71 -                <available file="${test.src.dir}"/>
    2.72 -            </or>
    2.73 -        </condition>
    2.74 -        <condition property="have.sources">
    2.75 -            <or>
    2.76 -                <available file="${src.dir}"/>
    2.77 -            </or>
    2.78 -        </condition>
    2.79 -        <condition property="netbeans.home+have.tests">
    2.80 -            <and>
    2.81 -                <isset property="netbeans.home"/>
    2.82 -                <isset property="have.tests"/>
    2.83 -            </and>
    2.84 -        </condition>
    2.85 -        <condition property="no.javadoc.preview">
    2.86 -            <and>
    2.87 -                <isset property="javadoc.preview"/>
    2.88 -                <isfalse value="${javadoc.preview}"/>
    2.89 -            </and>
    2.90 -        </condition>
    2.91 -        <property name="run.jvmargs" value=""/>
    2.92 -        <property name="javac.compilerargs" value=""/>
    2.93 -        <property name="work.dir" value="${basedir}"/>
    2.94 -        <condition property="no.deps">
    2.95 -            <and>
    2.96 -                <istrue value="${no.dependencies}"/>
    2.97 -            </and>
    2.98 -        </condition>
    2.99 -        <property name="javac.debug" value="true"/>
   2.100 -        <property name="javadoc.preview" value="true"/>
   2.101 -        <property name="application.args" value=""/>
   2.102 -        <property name="source.encoding" value="${file.encoding}"/>
   2.103 -        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
   2.104 -            <and>
   2.105 -                <isset property="javadoc.encoding"/>
   2.106 -                <not>
   2.107 -                    <equals arg1="${javadoc.encoding}" arg2=""/>
   2.108 -                </not>
   2.109 -            </and>
   2.110 -        </condition>
   2.111 -        <property name="javadoc.encoding.used" value="${source.encoding}"/>
   2.112 -        <property name="includes" value="**"/>
   2.113 -        <property name="excludes" value=""/>
   2.114 -        <property name="do.depend" value="false"/>
   2.115 -        <condition property="do.depend.true">
   2.116 -            <istrue value="${do.depend}"/>
   2.117 -        </condition>
   2.118 -        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
   2.119 -            <and>
   2.120 -                <isset property="jaxws.endorsed.dir"/>
   2.121 -                <available file="nbproject/jaxws-build.xml"/>
   2.122 -            </and>
   2.123 -        </condition>
   2.124 -    </target>
   2.125 -    <target name="-post-init">
   2.126 -        <!-- Empty placeholder for easier customization. -->
   2.127 -        <!-- You can override this target in the ../build.xml file. -->
   2.128 -    </target>
   2.129 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
   2.130 -        <fail unless="src.dir">Must set src.dir</fail>
   2.131 -        <fail unless="test.src.dir">Must set test.src.dir</fail>
   2.132 -        <fail unless="build.dir">Must set build.dir</fail>
   2.133 -        <fail unless="dist.dir">Must set dist.dir</fail>
   2.134 -        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
   2.135 -        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
   2.136 -        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
   2.137 -        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
   2.138 -        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
   2.139 -        <fail unless="dist.jar">Must set dist.jar</fail>
   2.140 -    </target>
   2.141 -    <target name="-init-macrodef-property">
   2.142 -        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.143 -            <attribute name="name"/>
   2.144 -            <attribute name="value"/>
   2.145 -            <sequential>
   2.146 -                <property name="@{name}" value="${@{value}}"/>
   2.147 -            </sequential>
   2.148 -        </macrodef>
   2.149 -    </target>
   2.150 -    <target name="-init-macrodef-javac">
   2.151 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.152 -            <attribute default="${src.dir}" name="srcdir"/>
   2.153 -            <attribute default="${build.classes.dir}" name="destdir"/>
   2.154 -            <attribute default="${javac.classpath}" name="classpath"/>
   2.155 -            <attribute default="${includes}" name="includes"/>
   2.156 -            <attribute default="${excludes}" name="excludes"/>
   2.157 -            <attribute default="${javac.debug}" name="debug"/>
   2.158 -            <attribute default="" name="sourcepath"/>
   2.159 -            <element name="customize" optional="true"/>
   2.160 -            <sequential>
   2.161 -                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
   2.162 -                    <classpath>
   2.163 -                        <path path="@{classpath}"/>
   2.164 -                    </classpath>
   2.165 -                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
   2.166 -                    <customize/>
   2.167 -                </javac>
   2.168 -            </sequential>
   2.169 -        </macrodef>
   2.170 -        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.171 -            <attribute default="${src.dir}" name="srcdir"/>
   2.172 -            <attribute default="${build.classes.dir}" name="destdir"/>
   2.173 -            <attribute default="${javac.classpath}" name="classpath"/>
   2.174 -            <sequential>
   2.175 -                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
   2.176 -                    <classpath>
   2.177 -                        <path path="@{classpath}"/>
   2.178 -                    </classpath>
   2.179 -                </depend>
   2.180 -            </sequential>
   2.181 -        </macrodef>
   2.182 -        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.183 -            <attribute default="${build.classes.dir}" name="destdir"/>
   2.184 -            <sequential>
   2.185 -                <fail unless="javac.includes">Must set javac.includes</fail>
   2.186 -                <pathconvert pathsep="," property="javac.includes.binary">
   2.187 -                    <path>
   2.188 -                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   2.189 -                    </path>
   2.190 -                    <globmapper from="*.java" to="*.class"/>
   2.191 -                </pathconvert>
   2.192 -                <delete>
   2.193 -                    <files includes="${javac.includes.binary}"/>
   2.194 -                </delete>
   2.195 -            </sequential>
   2.196 -        </macrodef>
   2.197 -    </target>
   2.198 -    <target name="-init-macrodef-junit">
   2.199 -        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.200 -            <attribute default="${includes}" name="includes"/>
   2.201 -            <attribute default="${excludes}" name="excludes"/>
   2.202 -            <attribute default="**" name="testincludes"/>
   2.203 -            <sequential>
   2.204 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
   2.205 -                    <batchtest todir="${build.test.results.dir}">
   2.206 -                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
   2.207 -                            <filename name="@{testincludes}"/>
   2.208 -                        </fileset>
   2.209 -                    </batchtest>
   2.210 -                    <classpath>
   2.211 -                        <path path="${run.test.classpath}"/>
   2.212 -                    </classpath>
   2.213 -                    <syspropertyset>
   2.214 -                        <propertyref prefix="test-sys-prop."/>
   2.215 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.216 -                    </syspropertyset>
   2.217 -                    <formatter type="brief" usefile="false"/>
   2.218 -                    <formatter type="xml"/>
   2.219 -                    <jvmarg line="${run.jvmargs}"/>
   2.220 -                </junit>
   2.221 -            </sequential>
   2.222 -        </macrodef>
   2.223 -    </target>
   2.224 -    <target name="-init-macrodef-nbjpda">
   2.225 -        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.226 -            <attribute default="${main.class}" name="name"/>
   2.227 -            <attribute default="${debug.classpath}" name="classpath"/>
   2.228 -            <attribute default="" name="stopclassname"/>
   2.229 -            <sequential>
   2.230 -                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
   2.231 -                    <classpath>
   2.232 -                        <path path="@{classpath}"/>
   2.233 -                    </classpath>
   2.234 -                </nbjpdastart>
   2.235 -            </sequential>
   2.236 -        </macrodef>
   2.237 -        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.238 -            <attribute default="${build.classes.dir}" name="dir"/>
   2.239 -            <sequential>
   2.240 -                <nbjpdareload>
   2.241 -                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
   2.242 -                </nbjpdareload>
   2.243 -            </sequential>
   2.244 -        </macrodef>
   2.245 -    </target>
   2.246 -    <target name="-init-debug-args">
   2.247 -        <property name="version-output" value="java version &quot;${ant.java.version}"/>
   2.248 -        <condition property="have-jdk-older-than-1.4">
   2.249 -            <or>
   2.250 -                <contains string="${version-output}" substring="java version &quot;1.0"/>
   2.251 -                <contains string="${version-output}" substring="java version &quot;1.1"/>
   2.252 -                <contains string="${version-output}" substring="java version &quot;1.2"/>
   2.253 -                <contains string="${version-output}" substring="java version &quot;1.3"/>
   2.254 -            </or>
   2.255 -        </condition>
   2.256 -        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
   2.257 -            <istrue value="${have-jdk-older-than-1.4}"/>
   2.258 -        </condition>
   2.259 -    </target>
   2.260 -    <target depends="-init-debug-args" name="-init-macrodef-debug">
   2.261 -        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.262 -            <attribute default="${main.class}" name="classname"/>
   2.263 -            <attribute default="${debug.classpath}" name="classpath"/>
   2.264 -            <element name="customize" optional="true"/>
   2.265 -            <sequential>
   2.266 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.267 -                    <jvmarg line="${debug-args-line}"/>
   2.268 -                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
   2.269 -                    <jvmarg line="${run.jvmargs}"/>
   2.270 -                    <classpath>
   2.271 -                        <path path="@{classpath}"/>
   2.272 -                    </classpath>
   2.273 -                    <syspropertyset>
   2.274 -                        <propertyref prefix="run-sys-prop."/>
   2.275 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.276 -                    </syspropertyset>
   2.277 -                    <customize/>
   2.278 -                </java>
   2.279 -            </sequential>
   2.280 -        </macrodef>
   2.281 -    </target>
   2.282 -    <target name="-init-macrodef-java">
   2.283 -        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.284 -            <attribute default="${main.class}" name="classname"/>
   2.285 -            <element name="customize" optional="true"/>
   2.286 -            <sequential>
   2.287 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.288 -                    <jvmarg line="${run.jvmargs}"/>
   2.289 -                    <classpath>
   2.290 -                        <path path="${run.classpath}"/>
   2.291 -                    </classpath>
   2.292 -                    <syspropertyset>
   2.293 -                        <propertyref prefix="run-sys-prop."/>
   2.294 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.295 -                    </syspropertyset>
   2.296 -                    <customize/>
   2.297 -                </java>
   2.298 -            </sequential>
   2.299 -        </macrodef>
   2.300 -    </target>
   2.301 -    <target name="-init-presetdef-jar">
   2.302 -        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.303 -            <jar compress="${jar.compress}" jarfile="${dist.jar}">
   2.304 -                <j2seproject1:fileset dir="${build.classes.dir}"/>
   2.305 -            </jar>
   2.306 -        </presetdef>
   2.307 -    </target>
   2.308 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
   2.309 -    <!--
   2.310 -                ===================
   2.311 -                COMPILATION SECTION
   2.312 -                ===================
   2.313 -            -->
   2.314 -    <target depends="init" name="deps-jar" unless="no.deps"/>
   2.315 -    <target depends="init,deps-jar" name="-pre-pre-compile">
   2.316 -        <mkdir dir="${build.classes.dir}"/>
   2.317 -    </target>
   2.318 -    <target name="-pre-compile">
   2.319 -        <!-- Empty placeholder for easier customization. -->
   2.320 -        <!-- You can override this target in the ../build.xml file. -->
   2.321 -    </target>
   2.322 -    <target if="do.depend.true" name="-compile-depend">
   2.323 -        <j2seproject3:depend/>
   2.324 -    </target>
   2.325 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
   2.326 -        <j2seproject3:javac/>
   2.327 -        <copy todir="${build.classes.dir}">
   2.328 -            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.329 -        </copy>
   2.330 -    </target>
   2.331 -    <target name="-post-compile">
   2.332 -        <!-- Empty placeholder for easier customization. -->
   2.333 -        <!-- You can override this target in the ../build.xml file. -->
   2.334 -    </target>
   2.335 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
   2.336 -    <target name="-pre-compile-single">
   2.337 -        <!-- Empty placeholder for easier customization. -->
   2.338 -        <!-- You can override this target in the ../build.xml file. -->
   2.339 -    </target>
   2.340 -    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
   2.341 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.342 -        <j2seproject3:force-recompile/>
   2.343 -        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
   2.344 -    </target>
   2.345 -    <target name="-post-compile-single">
   2.346 -        <!-- Empty placeholder for easier customization. -->
   2.347 -        <!-- You can override this target in the ../build.xml file. -->
   2.348 -    </target>
   2.349 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
   2.350 -    <!--
   2.351 -                ====================
   2.352 -                JAR BUILDING SECTION
   2.353 -                ====================
   2.354 -            -->
   2.355 -    <target depends="init" name="-pre-pre-jar">
   2.356 -        <dirname file="${dist.jar}" property="dist.jar.dir"/>
   2.357 -        <mkdir dir="${dist.jar.dir}"/>
   2.358 -    </target>
   2.359 -    <target name="-pre-jar">
   2.360 -        <!-- Empty placeholder for easier customization. -->
   2.361 -        <!-- You can override this target in the ../build.xml file. -->
   2.362 -    </target>
   2.363 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
   2.364 -        <j2seproject1:jar/>
   2.365 -    </target>
   2.366 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
   2.367 -        <j2seproject1:jar manifest="${manifest.file}"/>
   2.368 -    </target>
   2.369 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
   2.370 -        <j2seproject1:jar manifest="${manifest.file}">
   2.371 -            <j2seproject1:manifest>
   2.372 -                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
   2.373 -            </j2seproject1:manifest>
   2.374 -        </j2seproject1:jar>
   2.375 -        <echo>To run this application from the command line without Ant, try:</echo>
   2.376 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.377 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.378 -        <pathconvert property="run.classpath.with.dist.jar">
   2.379 -            <path path="${run.classpath}"/>
   2.380 -            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
   2.381 -        </pathconvert>
   2.382 -        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
   2.383 -    </target>
   2.384 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
   2.385 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.386 -        <pathconvert property="run.classpath.without.build.classes.dir">
   2.387 -            <path path="${run.classpath}"/>
   2.388 -            <map from="${build.classes.dir.resolved}" to=""/>
   2.389 -        </pathconvert>
   2.390 -        <pathconvert pathsep=" " property="jar.classpath">
   2.391 -            <path path="${run.classpath.without.build.classes.dir}"/>
   2.392 -            <chainedmapper>
   2.393 -                <flattenmapper/>
   2.394 -                <globmapper from="*" to="lib/*"/>
   2.395 -            </chainedmapper>
   2.396 -        </pathconvert>
   2.397 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
   2.398 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
   2.399 -            <fileset dir="${build.classes.dir}"/>
   2.400 -            <manifest>
   2.401 -                <attribute name="Main-Class" value="${main.class}"/>
   2.402 -                <attribute name="Class-Path" value="${jar.classpath}"/>
   2.403 -            </manifest>
   2.404 -        </copylibs>
   2.405 -        <echo>To run this application from the command line without Ant, try:</echo>
   2.406 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.407 -        <echo>java -jar "${dist.jar.resolved}"</echo>
   2.408 -    </target>
   2.409 -    <target name="-post-jar">
   2.410 -        <!-- Empty placeholder for easier customization. -->
   2.411 -        <!-- You can override this target in the ../build.xml file. -->
   2.412 -    </target>
   2.413 -    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
   2.414 -    <!--
   2.415 -                =================
   2.416 -                EXECUTION SECTION
   2.417 -                =================
   2.418 -            -->
   2.419 -    <target depends="init,compile" description="Run a main class." name="run">
   2.420 -        <j2seproject1:java>
   2.421 -            <customize>
   2.422 -                <arg line="${application.args}"/>
   2.423 -            </customize>
   2.424 -        </j2seproject1:java>
   2.425 -    </target>
   2.426 -    <target name="-do-not-recompile">
   2.427 -        <property name="javac.includes.binary" value=""/>
   2.428 -    </target>
   2.429 -    <target depends="init,-do-not-recompile,compile-single" name="run-single">
   2.430 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   2.431 -        <j2seproject1:java classname="${run.class}"/>
   2.432 -    </target>
   2.433 -    <!--
   2.434 -                =================
   2.435 -                DEBUGGING SECTION
   2.436 -                =================
   2.437 -            -->
   2.438 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
   2.439 -        <j2seproject1:nbjpdastart name="${debug.class}"/>
   2.440 -    </target>
   2.441 -    <target depends="init,compile" name="-debug-start-debuggee">
   2.442 -        <j2seproject3:debug>
   2.443 -            <customize>
   2.444 -                <arg line="${application.args}"/>
   2.445 -            </customize>
   2.446 -        </j2seproject3:debug>
   2.447 -    </target>
   2.448 -    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
   2.449 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
   2.450 -        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
   2.451 -    </target>
   2.452 -    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
   2.453 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
   2.454 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   2.455 -        <j2seproject3:debug classname="${debug.class}"/>
   2.456 -    </target>
   2.457 -    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
   2.458 -    <target depends="init" name="-pre-debug-fix">
   2.459 -        <fail unless="fix.includes">Must set fix.includes</fail>
   2.460 -        <property name="javac.includes" value="${fix.includes}.java"/>
   2.461 -    </target>
   2.462 -    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
   2.463 -        <j2seproject1:nbjpdareload/>
   2.464 -    </target>
   2.465 -    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
   2.466 -    <!--
   2.467 -                ===============
   2.468 -                JAVADOC SECTION
   2.469 -                ===============
   2.470 -            -->
   2.471 -    <target depends="init" name="-javadoc-build">
   2.472 -        <mkdir dir="${dist.javadoc.dir}"/>
   2.473 -        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
   2.474 -            <classpath>
   2.475 -                <path path="${javac.classpath}"/>
   2.476 -            </classpath>
   2.477 -            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
   2.478 -                <filename name="**/*.java"/>
   2.479 -            </fileset>
   2.480 -        </javadoc>
   2.481 -    </target>
   2.482 -    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
   2.483 -        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
   2.484 -    </target>
   2.485 -    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
   2.486 -    <!--
   2.487 -                =========================
   2.488 -                JUNIT COMPILATION SECTION
   2.489 -                =========================
   2.490 -            -->
   2.491 -    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
   2.492 -        <mkdir dir="${build.test.classes.dir}"/>
   2.493 -    </target>
   2.494 -    <target name="-pre-compile-test">
   2.495 -        <!-- Empty placeholder for easier customization. -->
   2.496 -        <!-- You can override this target in the ../build.xml file. -->
   2.497 -    </target>
   2.498 -    <target if="do.depend.true" name="-compile-test-depend">
   2.499 -        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   2.500 -    </target>
   2.501 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
   2.502 -        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   2.503 -        <copy todir="${build.test.classes.dir}">
   2.504 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.505 -        </copy>
   2.506 -    </target>
   2.507 -    <target name="-post-compile-test">
   2.508 -        <!-- Empty placeholder for easier customization. -->
   2.509 -        <!-- You can override this target in the ../build.xml file. -->
   2.510 -    </target>
   2.511 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
   2.512 -    <target name="-pre-compile-test-single">
   2.513 -        <!-- Empty placeholder for easier customization. -->
   2.514 -        <!-- You can override this target in the ../build.xml file. -->
   2.515 -    </target>
   2.516 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
   2.517 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.518 -        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
   2.519 -        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
   2.520 -        <copy todir="${build.test.classes.dir}">
   2.521 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.522 -        </copy>
   2.523 -    </target>
   2.524 -    <target name="-post-compile-test-single">
   2.525 -        <!-- Empty placeholder for easier customization. -->
   2.526 -        <!-- You can override this target in the ../build.xml file. -->
   2.527 -    </target>
   2.528 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
   2.529 -    <!--
   2.530 -                =======================
   2.531 -                JUNIT EXECUTION SECTION
   2.532 -                =======================
   2.533 -            -->
   2.534 -    <target depends="init" if="have.tests" name="-pre-test-run">
   2.535 -        <mkdir dir="${build.test.results.dir}"/>
   2.536 -    </target>
   2.537 -    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
   2.538 -        <j2seproject3:junit testincludes="**/*Test.java"/>
   2.539 -    </target>
   2.540 -    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
   2.541 -        <fail if="tests.failed">Some tests failed; see details above.</fail>
   2.542 -    </target>
   2.543 -    <target depends="init" if="have.tests" name="test-report"/>
   2.544 -    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
   2.545 -    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
   2.546 -    <target depends="init" if="have.tests" name="-pre-test-run-single">
   2.547 -        <mkdir dir="${build.test.results.dir}"/>
   2.548 -    </target>
   2.549 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
   2.550 -        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
   2.551 -        <j2seproject3:junit excludes="" includes="${test.includes}"/>
   2.552 -    </target>
   2.553 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
   2.554 -        <fail if="tests.failed">Some tests failed; see details above.</fail>
   2.555 -    </target>
   2.556 -    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
   2.557 -    <!--
   2.558 -                =======================
   2.559 -                JUNIT DEBUGGING SECTION
   2.560 -                =======================
   2.561 -            -->
   2.562 -    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
   2.563 -        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
   2.564 -        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
   2.565 -        <delete file="${test.report.file}"/>
   2.566 -        <mkdir dir="${build.test.results.dir}"/>
   2.567 -        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
   2.568 -            <customize>
   2.569 -                <syspropertyset>
   2.570 -                    <propertyref prefix="test-sys-prop."/>
   2.571 -                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.572 -                </syspropertyset>
   2.573 -                <arg value="${test.class}"/>
   2.574 -                <arg value="showoutput=true"/>
   2.575 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
   2.576 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
   2.577 -            </customize>
   2.578 -        </j2seproject3:debug>
   2.579 -    </target>
   2.580 -    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
   2.581 -        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
   2.582 -    </target>
   2.583 -    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
   2.584 -    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
   2.585 -        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
   2.586 -    </target>
   2.587 -    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
   2.588 -    <!--
   2.589 -                =========================
   2.590 -                APPLET EXECUTION SECTION
   2.591 -                =========================
   2.592 -            -->
   2.593 -    <target depends="init,compile-single" name="run-applet">
   2.594 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.595 -        <j2seproject1:java classname="sun.applet.AppletViewer">
   2.596 -            <customize>
   2.597 -                <arg value="${applet.url}"/>
   2.598 -            </customize>
   2.599 -        </j2seproject1:java>
   2.600 -    </target>
   2.601 -    <!--
   2.602 -                =========================
   2.603 -                APPLET DEBUGGING  SECTION
   2.604 -                =========================
   2.605 -            -->
   2.606 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
   2.607 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.608 -        <j2seproject3:debug classname="sun.applet.AppletViewer">
   2.609 -            <customize>
   2.610 -                <arg value="${applet.url}"/>
   2.611 -            </customize>
   2.612 -        </j2seproject3:debug>
   2.613 -    </target>
   2.614 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
   2.615 -    <!--
   2.616 -                ===============
   2.617 -                CLEANUP SECTION
   2.618 -                ===============
   2.619 -            -->
   2.620 -    <target depends="init" name="deps-clean" unless="no.deps"/>
   2.621 -    <target depends="init" name="-do-clean">
   2.622 -        <delete dir="${build.dir}"/>
   2.623 -        <delete dir="${dist.dir}"/>
   2.624 -    </target>
   2.625 -    <target name="-post-clean">
   2.626 -        <!-- Empty placeholder for easier customization. -->
   2.627 -        <!-- You can override this target in the ../build.xml file. -->
   2.628 -    </target>
   2.629 -    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
   2.630 -</project>
     3.1 --- a/other/signatures/nbproject/genfiles.properties	Tue Jul 19 08:01:26 2011 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,8 +0,0 @@
     3.4 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     3.5 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     3.6 -build.xml.data.CRC32=ee7e9246
     3.7 -build.xml.script.CRC32=514579df
     3.8 -build.xml.stylesheet.CRC32=be360661
     3.9 -nbproject/build-impl.xml.data.CRC32=ee7e9246
    3.10 -nbproject/build-impl.xml.script.CRC32=a510d55b
    3.11 -nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
     4.1 --- a/other/signatures/nbproject/project.properties	Tue Jul 19 08:01:26 2011 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,57 +0,0 @@
     4.4 -build.classes.dir=${build.dir}/classes
     4.5 -build.classes.excludes=**/*.java,**/*.form
     4.6 -# This directory is removed when the project is cleaned:
     4.7 -build.dir=build
     4.8 -build.generated.dir=${build.dir}/generated
     4.9 -# Only compile against the classpath explicitly listed here:
    4.10 -build.sysclasspath=ignore
    4.11 -build.test.classes.dir=${build.dir}/test/classes
    4.12 -build.test.results.dir=${build.dir}/test/results
    4.13 -debug.classpath=\
    4.14 -    ${run.classpath}
    4.15 -debug.test.classpath=\
    4.16 -    ${run.test.classpath}
    4.17 -# This directory is removed when the project is cleaned:
    4.18 -dist.dir=dist
    4.19 -dist.jar=${dist.dir}/signatures.jar
    4.20 -dist.javadoc.dir=${dist.dir}/javadoc
    4.21 -excludes=
    4.22 -file.reference.ant.jar=${ant.home}/lib/ant.jar
    4.23 -includes=**
    4.24 -jar.compress=false
    4.25 -javac.classpath=\
    4.26 -    ${file.reference.ant.jar}
    4.27 -# Space-separated list of extra javac options
    4.28 -javac.compilerargs=-Xlint
    4.29 -javac.deprecation=false
    4.30 -javac.source=1.6
    4.31 -javac.target=1.6
    4.32 -javac.test.classpath=\
    4.33 -    ${javac.classpath}:\
    4.34 -    ${build.classes.dir}:\
    4.35 -    ${libs.junit.classpath}
    4.36 -javadoc.additionalparam=
    4.37 -javadoc.author=false
    4.38 -javadoc.encoding=
    4.39 -javadoc.noindex=false
    4.40 -javadoc.nonavbar=false
    4.41 -javadoc.notree=false
    4.42 -javadoc.private=false
    4.43 -javadoc.splitindex=true
    4.44 -javadoc.use=true
    4.45 -javadoc.version=false
    4.46 -javadoc.windowtitle=
    4.47 -meta.inf.dir=${src.dir}/META-INF
    4.48 -platform.active=default_platform
    4.49 -run.classpath=\
    4.50 -    ${javac.classpath}:\
    4.51 -    ${build.classes.dir}
    4.52 -# Space-separated list of JVM arguments used when running the project
    4.53 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
    4.54 -# or test-sys-prop.name=value to set system properties for unit tests):
    4.55 -run.jvmargs=-ea -Xmx128m
    4.56 -run.test.classpath=\
    4.57 -    ${javac.test.classpath}:\
    4.58 -    ${build.test.classes.dir}
    4.59 -src.dir=src
    4.60 -test.src.dir=test
     5.1 --- a/other/signatures/nbproject/project.xml	Tue Jul 19 08:01:26 2011 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,16 +0,0 @@
     5.4 -<?xml version="1.0" encoding="UTF-8"?>
     5.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
     5.6 -    <type>org.netbeans.modules.java.j2seproject</type>
     5.7 -    <configuration>
     5.8 -        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
     5.9 -            <name>signatures</name>
    5.10 -            <minimum-ant-version>1.6.5</minimum-ant-version>
    5.11 -            <source-roots>
    5.12 -                <root id="src.dir"/>
    5.13 -            </source-roots>
    5.14 -            <test-roots>
    5.15 -                <root id="test.src.dir"/>
    5.16 -            </test-roots>
    5.17 -        </data>
    5.18 -    </configuration>
    5.19 -</project>
     6.1 --- a/other/signatures/src/org/netbeans/signatures/ClassScanner.java	Tue Jul 19 08:01:26 2011 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,149 +0,0 @@
     6.4 -/*
     6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 - *
     6.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     6.8 - *
     6.9 - * The contents of this file are subject to the terms of either the GNU
    6.10 - * General Public License Version 2 only ("GPL") or the Common
    6.11 - * Development and Distribution License("CDDL") (collectively, the
    6.12 - * "License"). You may not use this file except in compliance with the
    6.13 - * License. You can obtain a copy of the License at
    6.14 - * http://www.netbeans.org/cddl-gplv2.html
    6.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    6.16 - * specific language governing permissions and limitations under the
    6.17 - * License.  When distributing the software, include this License Header
    6.18 - * Notice in each file and include the License file at
    6.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    6.20 - * particular file as subject to the "Classpath" exception as provided
    6.21 - * by Sun in the GPL Version 2 section of the License file that
    6.22 - * accompanied this code. If applicable, add the following below the
    6.23 - * License Header, with the fields enclosed by brackets [] replaced by
    6.24 - * your own identifying information:
    6.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    6.26 - *
    6.27 - * Contributor(s):
    6.28 - *
    6.29 - * The Original Software is NetBeans. The Initial Developer of the Original
    6.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    6.31 - * Microsystems, Inc. All Rights Reserved.
    6.32 - *
    6.33 - * If you wish your version of this file to be governed by only the CDDL
    6.34 - * or only the GPL Version 2, indicate your decision by adding
    6.35 - * "[Contributor] elects to include this software in this distribution
    6.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    6.37 - * single choice of license, a recipient has the option to distribute
    6.38 - * your version of this file under either the CDDL, the GPL Version 2 or
    6.39 - * to extend the choice of license to its licensees as provided above.
    6.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    6.41 - * Version 2 license, then the option applies only if the new code is
    6.42 - * made subject to such option by the copyright holder.
    6.43 - */
    6.44 -
    6.45 -package org.netbeans.signatures;
    6.46 -
    6.47 -import java.io.File;
    6.48 -import java.io.IOException;
    6.49 -import java.util.ArrayList;
    6.50 -import java.util.Collection;
    6.51 -import java.util.Enumeration;
    6.52 -import java.util.Set;
    6.53 -import java.util.SortedSet;
    6.54 -import java.util.TreeSet;
    6.55 -import java.util.jar.JarEntry;
    6.56 -import java.util.jar.JarFile;
    6.57 -import java.util.jar.Manifest;
    6.58 -import java.util.regex.Matcher;
    6.59 -import java.util.regex.Pattern;
    6.60 -
    6.61 -/**
    6.62 - * Finds all top-level classes detected in a classpath.
    6.63 - * @author Jesse Glick
    6.64 - */
    6.65 -public class ClassScanner {
    6.66 -    
    6.67 -    private ClassScanner() {}
    6.68 -    
    6.69 -    /**
    6.70 -     * Looks for all classes in a classpath.
    6.71 -     * @param cp a set of classpath entries (currently only JARs are supported); must be modifiable if <code>classPathExtensions</code> is set
    6.72 -     * @param publicPackagesOnly if true, check for <code>OpenIDE-Module-Public-Packages</code> and only include classes from matching packages
    6.73 -     * @param classPathExtensions if true, check for <code>Class-Path</code> and traverse extension JARs automatically (additions will be made to <code>cp</code>)
    6.74 -     */
    6.75 -    public static Collection<String> findTopLevelClasses(Set<File> cp, boolean publicPackagesOnly, boolean classPathExtensions) throws IOException {
    6.76 -        SortedSet<String> classes = new TreeSet<String>();
    6.77 -        for (File jar : new ArrayList<File>(cp)) {
    6.78 -            traverse(jar, classes, cp, publicPackagesOnly, classPathExtensions, null);
    6.79 -        }
    6.80 -        return classes;
    6.81 -    }
    6.82 -    
    6.83 -    private static void traverse(File jar, Set<String> classes, Set<File> knownJars, boolean publicPackagesOnly, boolean classPathExtensions, String[] pubpkgs) throws IOException {
    6.84 -        if (!jar.isFile()) {
    6.85 -            throw new IllegalArgumentException("XXX directory CP entries not yet supported: " + jar);
    6.86 -        }
    6.87 -        JarFile jf = new JarFile(jar);
    6.88 -        try {
    6.89 -            if (pubpkgs == null && publicPackagesOnly) {
    6.90 -                Manifest mf = jf.getManifest();
    6.91 -                if (mf != null) {
    6.92 -                    String pp = mf.getMainAttributes().getValue("OpenIDE-Module-Public-Packages");
    6.93 -                    if (pp != null) {
    6.94 -                        pp = pp.trim();
    6.95 -                        if (pp.equals("-")) {
    6.96 -                            return;
    6.97 -                        }
    6.98 -                        pubpkgs = pp.split(" *[, ] *");
    6.99 -                    }
   6.100 -                }
   6.101 -            }
   6.102 -            if (classPathExtensions) {
   6.103 -                Manifest mf = jf.getManifest();
   6.104 -                if (mf != null) {
   6.105 -                    String ext = mf.getMainAttributes().getValue("Class-Path");
   6.106 -                    if (ext != null) {
   6.107 -                        for (String reluri : ext.trim().split("[ ,]+")) {
   6.108 -                            File extjar = new File(jar.toURI().resolve(reluri));
   6.109 -                            if (extjar.exists() && knownJars.add(extjar)) {
   6.110 -                                traverse(extjar, classes, knownJars, publicPackagesOnly, classPathExtensions, pubpkgs);
   6.111 -                            }
   6.112 -                        }
   6.113 -                    }
   6.114 -                }
   6.115 -            }
   6.116 -            Enumeration<JarEntry> entries = jf.entries();
   6.117 -            while (entries.hasMoreElements()) {
   6.118 -                JarEntry entry = entries.nextElement();
   6.119 -                String path = entry.getName();
   6.120 -                if (!path.endsWith(".class")/* || path.contains("$")*/) {
   6.121 -                    continue;
   6.122 -                }
   6.123 -                String pkg = path.contains("/") ? path.replaceFirst("/[^/]+$", "").replace('/', '.') : "";
   6.124 -                if (pubpkgs != null) {
   6.125 -                    boolean included = false;
   6.126 -                    for (String pubpkg : pubpkgs) {
   6.127 -                        Matcher m = Pattern.compile("(.+)\\.(\\*\\*?)").matcher(pubpkg);
   6.128 -                        if (!m.matches()) {
   6.129 -                            throw new IOException("Bad OpenIDE-Module-Public-Packages entry '" + pubpkg + "' in " + jar);
   6.130 -                        }
   6.131 -                        String prefix = m.group(1);
   6.132 -                        if (m.group(2).length() == 1) {
   6.133 -                            included = prefix.equals(pkg);
   6.134 -                        } else {
   6.135 -                            included = prefix.equals(pkg) || pkg.startsWith(prefix + ".");
   6.136 -                        }
   6.137 -                        if (included) {
   6.138 -                            break;
   6.139 -                        }
   6.140 -                    }
   6.141 -                    if (!included) {
   6.142 -                        continue;
   6.143 -                    }
   6.144 -                }
   6.145 -                classes.add(path.replaceAll("\\.class$", "").replace('/', '.'));
   6.146 -            }
   6.147 -        } finally {
   6.148 -            jf.close();
   6.149 -        }
   6.150 -    }
   6.151 -    
   6.152 -}
     7.1 --- a/other/signatures/src/org/netbeans/signatures/Loader.java	Tue Jul 19 08:01:26 2011 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,186 +0,0 @@
     7.4 -/*
     7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     7.6 - *
     7.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     7.8 - *
     7.9 - * The contents of this file are subject to the terms of either the GNU
    7.10 - * General Public License Version 2 only ("GPL") or the Common
    7.11 - * Development and Distribution License("CDDL") (collectively, the
    7.12 - * "License"). You may not use this file except in compliance with the
    7.13 - * License. You can obtain a copy of the License at
    7.14 - * http://www.netbeans.org/cddl-gplv2.html
    7.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    7.16 - * specific language governing permissions and limitations under the
    7.17 - * License.  When distributing the software, include this License Header
    7.18 - * Notice in each file and include the License file at
    7.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    7.20 - * particular file as subject to the "Classpath" exception as provided
    7.21 - * by Sun in the GPL Version 2 section of the License file that
    7.22 - * accompanied this code. If applicable, add the following below the
    7.23 - * License Header, with the fields enclosed by brackets [] replaced by
    7.24 - * your own identifying information:
    7.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    7.26 - *
    7.27 - * Contributor(s):
    7.28 - *
    7.29 - * The Original Software is NetBeans. The Initial Developer of the Original
    7.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    7.31 - * Microsystems, Inc. All Rights Reserved.
    7.32 - *
    7.33 - * If you wish your version of this file to be governed by only the CDDL
    7.34 - * or only the GPL Version 2, indicate your decision by adding
    7.35 - * "[Contributor] elects to include this software in this distribution
    7.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    7.37 - * single choice of license, a recipient has the option to distribute
    7.38 - * your version of this file under either the CDDL, the GPL Version 2 or
    7.39 - * to extend the choice of license to its licensees as provided above.
    7.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    7.41 - * Version 2 license, then the option applies only if the new code is
    7.42 - * made subject to such option by the copyright holder.
    7.43 - */
    7.44 -
    7.45 -package org.netbeans.signatures;
    7.46 -
    7.47 -import java.io.ByteArrayOutputStream;
    7.48 -import java.io.File;
    7.49 -import java.io.IOException;
    7.50 -import java.io.OutputStream;
    7.51 -import java.io.StringWriter;
    7.52 -import java.io.Writer;
    7.53 -import java.net.URI;
    7.54 -import java.util.Arrays;
    7.55 -import java.util.Collection;
    7.56 -import java.util.Collections;
    7.57 -import java.util.Set;
    7.58 -import javax.annotation.processing.AbstractProcessor;
    7.59 -import javax.annotation.processing.RoundEnvironment;
    7.60 -import javax.annotation.processing.SupportedAnnotationTypes;
    7.61 -import javax.annotation.processing.SupportedSourceVersion;
    7.62 -import javax.lang.model.SourceVersion;
    7.63 -import javax.lang.model.element.TypeElement;
    7.64 -import javax.lang.model.util.Elements;
    7.65 -import javax.lang.model.util.Types;
    7.66 -import javax.tools.FileObject;
    7.67 -import javax.tools.ForwardingJavaFileManager;
    7.68 -import javax.tools.JavaCompiler;
    7.69 -import javax.tools.JavaFileManager;
    7.70 -import javax.tools.JavaFileManager.Location;
    7.71 -import javax.tools.JavaFileObject;
    7.72 -import javax.tools.JavaFileObject.Kind;
    7.73 -import javax.tools.SimpleJavaFileObject;
    7.74 -import javax.tools.ToolProvider;
    7.75 -
    7.76 -/**
    7.77 - * Loads structural information from bytecode.
    7.78 - * @author Jesse Glick
    7.79 - */
    7.80 -public abstract class Loader {
    7.81 -    
    7.82 -    private Elements elements;
    7.83 -    private Types types;
    7.84 -    private RuntimeException exception;
    7.85 -    private Error error;
    7.86 -    
    7.87 -    protected Loader(Collection<File> cp) {
    7.88 -        StringBuilder cps = new StringBuilder();
    7.89 -        for (File p : cp) {
    7.90 -            if (!p.exists()) {
    7.91 -                throw new IllegalArgumentException("No such classpath element " + p);
    7.92 -            }
    7.93 -            if (cps.length() > 0) {
    7.94 -                cps.append(File.pathSeparatorChar);
    7.95 -            }
    7.96 -            cps.append(p);
    7.97 -        }
    7.98 -        StringWriter err = new StringWriter();
    7.99 -        JavaCompiler.CompilationTask task = ToolProvider.getSystemJavaCompiler().getTask(
   7.100 -                err,
   7.101 -                nullOutputFileManager(),
   7.102 -                null,
   7.103 -                Arrays.asList("-source", "1.6", "-classpath", cps.toString()),
   7.104 -                null,
   7.105 -                Collections.singleton(dummyCompilationUnit()));
   7.106 -        task.setProcessors(Collections.singleton(new LoaderProcessor()));
   7.107 -        boolean ok = task.call();
   7.108 -        String errors = err.toString();
   7.109 -        assert ok : errors;
   7.110 -        assert errors.length() == 0 : errors;
   7.111 -        if (exception != null) {
   7.112 -            throw exception;
   7.113 -        } else if (error != null) {
   7.114 -            throw error;
   7.115 -        }
   7.116 -    }
   7.117 -    
   7.118 -    protected abstract void run();
   7.119 -    
   7.120 -    protected final Elements elements() {
   7.121 -        return elements;
   7.122 -    }
   7.123 -    
   7.124 -    protected final Types types() {
   7.125 -        return types;
   7.126 -    }
   7.127 -    
   7.128 -    @SupportedAnnotationTypes("*")
   7.129 -    @SupportedSourceVersion(SourceVersion.RELEASE_6)
   7.130 -    private final class LoaderProcessor extends AbstractProcessor {
   7.131 -        
   7.132 -        private boolean ran = false;
   7.133 -        
   7.134 -        LoaderProcessor() {}
   7.135 -        
   7.136 -        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   7.137 -            if (!ran) {
   7.138 -                ran = true;
   7.139 -            } else {
   7.140 -                return true;
   7.141 -            }
   7.142 -            elements = processingEnv.getElementUtils();
   7.143 -            assert elements != null;
   7.144 -            types = processingEnv.getTypeUtils();
   7.145 -            assert types != null;
   7.146 -            try {
   7.147 -                run();
   7.148 -            } catch (ThreadDeath t) {
   7.149 -                throw t;
   7.150 -            } catch (RuntimeException t) {
   7.151 -                exception = t;
   7.152 -            } catch (Error t) {
   7.153 -                error = t;
   7.154 -            }
   7.155 -            elements = null;
   7.156 -            types = null;
   7.157 -            return true;
   7.158 -        }
   7.159 -        
   7.160 -    }
   7.161 -    
   7.162 -    public static JavaFileObject dummyCompilationUnit() {
   7.163 -        return new SimpleJavaFileObject(URI.create("nowhere:/Dummy.java"), JavaFileObject.Kind.SOURCE) {
   7.164 -            public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
   7.165 -                return "public class Dummy {}";
   7.166 -            }
   7.167 -        };
   7.168 -    }
   7.169 -    
   7.170 -    public static JavaFileManager nullOutputFileManager() {
   7.171 -        return new ForwardingJavaFileManager<JavaFileManager>(ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
   7.172 -            JavaFileObject devNull = new SimpleJavaFileObject(URI.create("no:/where"), JavaFileObject.Kind.OTHER) {
   7.173 -                public OutputStream openOutputStream() throws IOException {
   7.174 -                    return new ByteArrayOutputStream();
   7.175 -                }
   7.176 -                public Writer openWriter() throws IOException {
   7.177 -                    return new StringWriter();
   7.178 -                }
   7.179 -            };
   7.180 -            public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
   7.181 -                return devNull;
   7.182 -            }
   7.183 -            public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
   7.184 -                return devNull;
   7.185 -            }
   7.186 -        };
   7.187 -    }
   7.188 -    
   7.189 -}
     8.1 --- a/other/signatures/src/org/netbeans/signatures/SignatureTask.java	Tue Jul 19 08:01:26 2011 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,189 +0,0 @@
     8.4 -/*
     8.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     8.6 - *
     8.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     8.8 - *
     8.9 - * The contents of this file are subject to the terms of either the GNU
    8.10 - * General Public License Version 2 only ("GPL") or the Common
    8.11 - * Development and Distribution License("CDDL") (collectively, the
    8.12 - * "License"). You may not use this file except in compliance with the
    8.13 - * License. You can obtain a copy of the License at
    8.14 - * http://www.netbeans.org/cddl-gplv2.html
    8.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    8.16 - * specific language governing permissions and limitations under the
    8.17 - * License.  When distributing the software, include this License Header
    8.18 - * Notice in each file and include the License file at
    8.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    8.20 - * particular file as subject to the "Classpath" exception as provided
    8.21 - * by Sun in the GPL Version 2 section of the License file that
    8.22 - * accompanied this code. If applicable, add the following below the
    8.23 - * License Header, with the fields enclosed by brackets [] replaced by
    8.24 - * your own identifying information:
    8.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    8.26 - *
    8.27 - * Contributor(s):
    8.28 - *
    8.29 - * The Original Software is NetBeans. The Initial Developer of the Original
    8.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    8.31 - * Microsystems, Inc. All Rights Reserved.
    8.32 - *
    8.33 - * If you wish your version of this file to be governed by only the CDDL
    8.34 - * or only the GPL Version 2, indicate your decision by adding
    8.35 - * "[Contributor] elects to include this software in this distribution
    8.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    8.37 - * single choice of license, a recipient has the option to distribute
    8.38 - * your version of this file under either the CDDL, the GPL Version 2 or
    8.39 - * to extend the choice of license to its licensees as provided above.
    8.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    8.41 - * Version 2 license, then the option applies only if the new code is
    8.42 - * made subject to such option by the copyright holder.
    8.43 - */
    8.44 -
    8.45 -package org.netbeans.signatures;
    8.46 -
    8.47 -import java.io.File;
    8.48 -import java.io.FileOutputStream;
    8.49 -import java.io.IOException;
    8.50 -import java.io.OutputStream;
    8.51 -import java.io.OutputStreamWriter;
    8.52 -import java.io.PrintWriter;
    8.53 -import java.util.Arrays;
    8.54 -import java.util.Collection;
    8.55 -import java.util.LinkedList;
    8.56 -import java.util.Set;
    8.57 -import java.util.TreeSet;
    8.58 -import java.util.regex.Matcher;
    8.59 -import java.util.regex.Pattern;
    8.60 -import javax.tools.JavaCompiler;
    8.61 -import javax.tools.ToolProvider;
    8.62 -import org.apache.tools.ant.BuildException;
    8.63 -import org.apache.tools.ant.DirectoryScanner;
    8.64 -import org.apache.tools.ant.Project;
    8.65 -import org.apache.tools.ant.Task;
    8.66 -import org.apache.tools.ant.types.FileSet;
    8.67 -
    8.68 -/**
    8.69 - * Ant task to write out all public Java signatures for some JARs.
    8.70 - * The output will be a Java source file which should be compilable
    8.71 - * when those JARs are in the classpath.
    8.72 - * It will attempt to exercise as much of the public API detected in those
    8.73 - * JARs as possible.
    8.74 - * Running the class (or classes) will not be possible; compilation is the test.
    8.75 - * Order should be stable, so you may meaningfully use a diff tool to check for
    8.76 - * syntactic API changes. Added lines are compatible; removed lines may be incompatible.
    8.77 - * @author Jesse Glick
    8.78 - */
    8.79 -public class SignatureTask extends Task {
    8.80 -    
    8.81 -    private Collection<FileSet> filesets = new LinkedList<FileSet>();
    8.82 -    private Pattern skipRegexp = Pattern.compile("^com\\.sun\\.");
    8.83 -    private File out;
    8.84 -    
    8.85 -    public SignatureTask() {}
    8.86 -    
    8.87 -    /**
    8.88 -     * Add a set of JAR files to be processed.
    8.89 -     */
    8.90 -    public void addFileSet(FileSet fs) {
    8.91 -        filesets.add(fs);
    8.92 -    }
    8.93 -    
    8.94 -    /**
    8.95 -     * Set the output file to generate signatures into.
    8.96 -     * Must be named <code><i>something</i>.java</code>.
    8.97 -     */
    8.98 -    public void setOut(File f) {
    8.99 -        out = f;
   8.100 -    }
   8.101 -    
   8.102 -    /**
   8.103 -     * Configure a regular expression of class names to skip for processing.
   8.104 -     * By default, it is: <pre>^com\.sun\.</pre>
   8.105 -     * This avoids warnings of the form
   8.106 -     * <pre>warning: com.sun.x.y.z is Sun proprietary API and may be removed in a future release</pre>
   8.107 -     * which may occur if you accidentally include some such classes among your JAR(s).
   8.108 -     */
   8.109 -    public void setSkipRegexp(String s) {
   8.110 -        skipRegexp = Pattern.compile(s);
   8.111 -    }
   8.112 -    
   8.113 -    @Override
   8.114 -    public void execute() throws BuildException {
   8.115 -        if (out == null) {
   8.116 -            throw new BuildException("Must specify out='...'", getLocation());
   8.117 -        }
   8.118 -        Matcher m = Pattern.compile("(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*)\\.java").matcher(out.getName());
   8.119 -        if (!m.matches()) {
   8.120 -            throw new BuildException("Illegal Java source file name " + out.getName(), getLocation());
   8.121 -        }
   8.122 -        final String sigclazz = m.group(1);
   8.123 -        if (filesets.isEmpty()) {
   8.124 -            throw new BuildException("Must specify <fileset>s", getLocation());
   8.125 -        }
   8.126 -        final Set<File> cp = new TreeSet<File>();
   8.127 -        for (FileSet fs : filesets) {
   8.128 -            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
   8.129 -            File basedir = ds.getBasedir();
   8.130 -            for (String file : ds.getIncludedFiles()) {
   8.131 -                cp.add(new File(basedir, file));
   8.132 -            }
   8.133 -        }
   8.134 -        try {
   8.135 -            final Collection<String> classes = ClassScanner.findTopLevelClasses(cp, true, true);
   8.136 -            OutputStream os = new FileOutputStream(out);
   8.137 -            try {
   8.138 -                final PrintWriter w = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
   8.139 -                w.printf("@SuppressWarnings(\"deprecation\")\nclass %s000 {\n\n", sigclazz);
   8.140 -                new Loader(cp) {
   8.141 -                    protected void run() {
   8.142 -                        SignatureWriter sigs = new SignatureWriter(w, elements(), types());
   8.143 -                        int cnt = 0;
   8.144 -                        int blocksize = 1000;
   8.145 -                        for (String clazz : classes) {
   8.146 -                            if (skipRegexp != null && skipRegexp.matcher(clazz).find()) {
   8.147 -                                continue;
   8.148 -                            }
   8.149 -                            try {
   8.150 -                                sigs.process(clazz);
   8.151 -                            } catch (RuntimeException e) {
   8.152 -                                log("Failed to create signature for " + clazz + " in " + cp + " due to " + e, Project.MSG_VERBOSE);
   8.153 -                            }
   8.154 -                            if (++cnt % blocksize == 0) {
   8.155 -                                log("Working on " + clazz, Project.MSG_INFO);
   8.156 -                                w.printf("}\n\n@SuppressWarnings(\"deprecation\")\nclass %s%03d {\n\n", sigclazz, cnt / blocksize);
   8.157 -                            }
   8.158 -                        }
   8.159 -                    }
   8.160 -                };
   8.161 -                w.println("}");
   8.162 -                w.flush();
   8.163 -            } finally {
   8.164 -                os.close();
   8.165 -            }
   8.166 -        } catch (IOException x) {
   8.167 -            throw new BuildException(x, getLocation());
   8.168 -        }
   8.169 -        StringBuilder cps = new StringBuilder();
   8.170 -        for (File p : cp) {
   8.171 -            if (cps.length() > 0) {
   8.172 -                cps.append(File.pathSeparatorChar);
   8.173 -            }
   8.174 -            cps.append(p);
   8.175 -        }
   8.176 -        log("Running a test compile of " + out, Project.MSG_INFO);
   8.177 -        JavaCompiler.CompilationTask task = ToolProvider.getSystemJavaCompiler().getTask(
   8.178 -                // XXX should redirect errors to Project.log, and should perhaps fail on any messages
   8.179 -                null,
   8.180 -                Loader.nullOutputFileManager(),
   8.181 -                null,
   8.182 -                Arrays.asList("-source", "1.6", "-encoding", "UTF-8", "-classpath", cps.toString(), "-Xlint:unchecked"),
   8.183 -                null,
   8.184 -                ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null).getJavaFileObjects(out));
   8.185 -        boolean ok = task.call();
   8.186 -        if (!ok) {
   8.187 -            throw new BuildException("Compilation of generated signature class failed", getLocation());
   8.188 -        }
   8.189 -        log("Test compile succeeded.", Project.MSG_INFO);
   8.190 -    }
   8.191 -    
   8.192 -}
     9.1 --- a/other/signatures/src/org/netbeans/signatures/SignatureWriter.java	Tue Jul 19 08:01:26 2011 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,311 +0,0 @@
     9.4 -/*
     9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 - *
     9.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     9.8 - *
     9.9 - * The contents of this file are subject to the terms of either the GNU
    9.10 - * General Public License Version 2 only ("GPL") or the Common
    9.11 - * Development and Distribution License("CDDL") (collectively, the
    9.12 - * "License"). You may not use this file except in compliance with the
    9.13 - * License. You can obtain a copy of the License at
    9.14 - * http://www.netbeans.org/cddl-gplv2.html
    9.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    9.16 - * specific language governing permissions and limitations under the
    9.17 - * License.  When distributing the software, include this License Header
    9.18 - * Notice in each file and include the License file at
    9.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    9.20 - * particular file as subject to the "Classpath" exception as provided
    9.21 - * by Sun in the GPL Version 2 section of the License file that
    9.22 - * accompanied this code. If applicable, add the following below the
    9.23 - * License Header, with the fields enclosed by brackets [] replaced by
    9.24 - * your own identifying information:
    9.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    9.26 - *
    9.27 - * Contributor(s):
    9.28 - *
    9.29 - * The Original Software is NetBeans. The Initial Developer of the Original
    9.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    9.31 - * Microsystems, Inc. All Rights Reserved.
    9.32 - *
    9.33 - * If you wish your version of this file to be governed by only the CDDL
    9.34 - * or only the GPL Version 2, indicate your decision by adding
    9.35 - * "[Contributor] elects to include this software in this distribution
    9.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    9.37 - * single choice of license, a recipient has the option to distribute
    9.38 - * your version of this file under either the CDDL, the GPL Version 2 or
    9.39 - * to extend the choice of license to its licensees as provided above.
    9.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    9.41 - * Version 2 license, then the option applies only if the new code is
    9.42 - * made subject to such option by the copyright holder.
    9.43 - */
    9.44 -
    9.45 -package org.netbeans.signatures;
    9.46 -
    9.47 -import java.io.PrintWriter;
    9.48 -import java.util.ArrayList;
    9.49 -import java.util.LinkedHashSet;
    9.50 -import java.util.List;
    9.51 -import java.util.Set;
    9.52 -import java.util.SortedSet;
    9.53 -import java.util.TreeSet;
    9.54 -import javax.lang.model.element.Element;
    9.55 -import javax.lang.model.element.ElementKind;
    9.56 -import javax.lang.model.element.ExecutableElement;
    9.57 -import javax.lang.model.element.Modifier;
    9.58 -import javax.lang.model.element.Name;
    9.59 -import javax.lang.model.element.TypeElement;
    9.60 -import javax.lang.model.element.TypeParameterElement;
    9.61 -import javax.lang.model.type.ArrayType;
    9.62 -import javax.lang.model.type.DeclaredType;
    9.63 -import javax.lang.model.type.ExecutableType;
    9.64 -import javax.lang.model.type.TypeMirror;
    9.65 -import javax.lang.model.type.TypeVariable;
    9.66 -import javax.lang.model.type.WildcardType;
    9.67 -import javax.lang.model.util.Elements;
    9.68 -import javax.lang.model.util.Types;
    9.69 -
    9.70 -/**
    9.71 - * Writes out usages of a type signature.
    9.72 - * @author Jesse Glick
    9.73 - */
    9.74 -public final class SignatureWriter {
    9.75 -    
    9.76 -    private final PrintWriter w;
    9.77 -    private final Elements elements;
    9.78 -    private final Types types;
    9.79 -    private final SortedSet<String> lines = new TreeSet<String>();
    9.80 -    
    9.81 -    public SignatureWriter(PrintWriter w, Elements elements, Types types) {
    9.82 -        this.w = w;
    9.83 -        this.elements = elements;
    9.84 -        this.types = types;
    9.85 -    }
    9.86 -    
    9.87 -    private void emit(String text) {
    9.88 -        lines.add(text);
    9.89 -    }
    9.90 -
    9.91 -    public void process(String clazz) {
    9.92 -        TypeElement type = elements.getTypeElement(clazz);
    9.93 -        if (type == null) {
    9.94 -            // Cannot find any such.
    9.95 -            return;
    9.96 -        }
    9.97 -        if (!type.getModifiers().contains(Modifier.PUBLIC)) {
    9.98 -            // Package-private class.
    9.99 -            return;
   9.100 -        }
   9.101 -        Name name = type.getQualifiedName();
   9.102 -        if (name.toString().length() == 0) {
   9.103 -            // Anonymous class.
   9.104 -            return;
   9.105 -        }
   9.106 -        emit("Class _ = " + name + ".class;");
   9.107 -        processSupertypes(type);
   9.108 -        switch (type.getKind()) {
   9.109 -            case CLASS:
   9.110 -                if (!type.getModifiers().contains(Modifier.ABSTRACT)) {
   9.111 -                    processPublicConstructors(type);
   9.112 -                }
   9.113 -                // XXX
   9.114 -                break;
   9.115 -            case INTERFACE:
   9.116 -                // XXX
   9.117 -                break;
   9.118 -            case ENUM:
   9.119 -                // XXX
   9.120 -                break;
   9.121 -            case ANNOTATION_TYPE:
   9.122 -                // XXX
   9.123 -                break;
   9.124 -            default:
   9.125 -                assert false : type.getKind();
   9.126 -        }
   9.127 -        for (String line : lines) {
   9.128 -            w.println("{" + line + "}");
   9.129 -        }
   9.130 -        lines.clear();
   9.131 -        w.println();
   9.132 -    }
   9.133 -    
   9.134 -    private String name(TypeMirror type) {
   9.135 -        return type.toString().replaceAll("\\bjava\\.lang\\.([A-Z])", "$1");
   9.136 -    }
   9.137 -    
   9.138 -    private TypeMirror instantiateTypeParametersWithUpperBound(TypeMirror type) {
   9.139 -        switch (type.getKind()) {
   9.140 -            case DECLARED:
   9.141 -                DeclaredType dtype = (DeclaredType) type;
   9.142 -                List<TypeMirror> params = new ArrayList<TypeMirror>();
   9.143 -                for (TypeMirror arg : dtype.getTypeArguments()) {
   9.144 -                    params.add(instantiateTypeParametersWithUpperBound(arg));
   9.145 -                }
   9.146 -                return types.getDeclaredType((TypeElement) types.asElement(dtype), params.toArray(new TypeMirror[params.size()]));
   9.147 -            case ARRAY:
   9.148 -                return types.getArrayType(instantiateTypeParametersWithUpperBound(((ArrayType) type).getComponentType()));
   9.149 -            case TYPEVAR:
   9.150 -                return ((TypeVariable) type).getUpperBound();
   9.151 -            case WILDCARD:
   9.152 -                TypeMirror bound = ((WildcardType) type).getExtendsBound();
   9.153 -                return bound != null ? instantiateTypeParametersWithUpperBound(bound) : objectType();
   9.154 -            default:
   9.155 -                return type;
   9.156 -        }
   9.157 -    }
   9.158 -    
   9.159 -    private TypeMirror objectType() {
   9.160 -        return elements.getTypeElement("java.lang.Object").asType();
   9.161 -    }
   9.162 -    
   9.163 -    private TypeMirror instantiateTypeParametersWithUpperBound(TypeElement type) {
   9.164 -        List<TypeMirror> params = new ArrayList<TypeMirror>();
   9.165 -        for (TypeParameterElement p : type.getTypeParameters()) {
   9.166 -            List<? extends TypeMirror> bounds = p.getBounds();
   9.167 -            if (bounds.isEmpty()) {
   9.168 -                params.add(objectType());
   9.169 -            } else {
   9.170 -                params.add(bounds.get(0)); // XXX OK?
   9.171 -            }
   9.172 -        }
   9.173 -        return types.getDeclaredType(type, params.toArray(new TypeMirror[params.size()]));
   9.174 -    }
   9.175 -    
   9.176 -    private Iterable<TypeMirror> supertypes(TypeElement type, boolean includeThis, boolean includeObject) {
   9.177 -        Set<TypeMirror> supertypes = new LinkedHashSet<TypeMirror>();
   9.178 -        TypeMirror instantiated = instantiateTypeParametersWithUpperBound(type);
   9.179 -        collectSupertypes(instantiated, supertypes, includeObject);
   9.180 -        if (!includeThis) {
   9.181 -            supertypes.remove(instantiated);
   9.182 -        }
   9.183 -        return supertypes;
   9.184 -    }
   9.185 -    private void collectSupertypes(TypeMirror type, Set<TypeMirror> supertypes, boolean includeObject) {
   9.186 -        for (TypeMirror t : types.directSupertypes(type)) {
   9.187 -            collectSupertypes(t, supertypes, includeObject);
   9.188 -        }
   9.189 -        if (includeObject || !types.isSameType(type, objectType())) {
   9.190 -            supertypes.add(type);
   9.191 -        }
   9.192 -    }
   9.193 -    
   9.194 -    private void processPublicConstructors(TypeElement type) {
   9.195 -        for (Element e : type.getEnclosedElements()) {
   9.196 -            if (e.getKind() != ElementKind.CONSTRUCTOR) {
   9.197 -                continue;
   9.198 -            }
   9.199 -            if (!e.getModifiers().contains(Modifier.PUBLIC)) {
   9.200 -                continue;
   9.201 -            }
   9.202 -            String params = parameters((ExecutableElement) e);
   9.203 -            if (params == null) {
   9.204 -                // Some parameter type is inaccessible, so we cannot call it.
   9.205 -                // XXX this might not be strictly true in case that parameter type has a public subtype
   9.206 -                continue;
   9.207 -            }
   9.208 -            String fqn = name(instantiateTypeParametersWithUpperBound(type));
   9.209 -            List<TypeMirror> checkedExceptions = new ArrayList<TypeMirror>();
   9.210 -            for (TypeMirror exc : ((ExecutableElement) e).getThrownTypes()) {
   9.211 -                if (types.isSubtype(exc, elements.getTypeElement("java.lang.Exception").asType()) &&
   9.212 -                        !types.isSubtype(exc, elements.getTypeElement("java.lang.RuntimeException").asType())) {
   9.213 -                    checkedExceptions.add(exc);
   9.214 -                }
   9.215 -            }
   9.216 -            if (checkedExceptions.isEmpty()) {
   9.217 -                emit("new " + fqn + "(" + params + ");");
   9.218 -            } else {
   9.219 -                StringBuilder b = new StringBuilder();
   9.220 -                for (TypeMirror exc : checkedExceptions) {
   9.221 -                    b.append(" catch (");
   9.222 -                    b.append(name(exc));
   9.223 -                    b.append(" _) {}");
   9.224 -                }
   9.225 -                emit("try {new " + fqn + "(" + params + ");}" + b);
   9.226 -            }
   9.227 -        }
   9.228 -    }
   9.229 -    
   9.230 -    private void processSupertypes(TypeElement type) {
   9.231 -        String fqn = name(instantiateTypeParametersWithUpperBound(type));
   9.232 -        for (TypeMirror t : supertypes(type, false, false)) {
   9.233 -            if (accessible(t)) {
   9.234 -                emit(name(t) + " _ = (" + fqn + ") null;");
   9.235 -            }
   9.236 -        }
   9.237 -    }
   9.238 -    
   9.239 -    private boolean accessible(TypeMirror type) {
   9.240 -        switch (type.getKind()) {
   9.241 -            case ERROR:
   9.242 -                return false;
   9.243 -            case DECLARED:
   9.244 -                return ((DeclaredType) type).asElement().getModifiers().contains(Modifier.PUBLIC);
   9.245 -            case WILDCARD:
   9.246 -                TypeMirror bound = ((WildcardType) type).getExtendsBound();
   9.247 -                return bound == null || accessible(bound);
   9.248 -            case ARRAY:
   9.249 -                return accessible(((ArrayType) type).getComponentType());
   9.250 -            case TYPEVAR:
   9.251 -                return accessible(((TypeVariable) type).getUpperBound());
   9.252 -            default:
   9.253 -                return true;
   9.254 -        }
   9.255 -    }
   9.256 -
   9.257 -    private String parameters(ExecutableElement e) {
   9.258 -        StringBuilder b = new StringBuilder();
   9.259 -        // e.getParameters() does not work for classes read from -g bytecode (cf. JDK bug #6468404)
   9.260 -        for (TypeMirror type : ((ExecutableType) e.asType()).getParameterTypes()) {
   9.261 -            if (b.length() > 0) {
   9.262 -                b.append(", ");
   9.263 -            }
   9.264 -            if (!accessible(type)) {
   9.265 -                return null;
   9.266 -            }
   9.267 -            TypeMirror type2 = instantiateTypeParametersWithUpperBound(type);
   9.268 -            switch (type2.getKind()) {
   9.269 -                case BOOLEAN:
   9.270 -                    b.append("false");
   9.271 -                    break;
   9.272 -                case BYTE:
   9.273 -                    b.append("(byte) 0");
   9.274 -                    break;
   9.275 -                case CHAR:
   9.276 -                    b.append("' '");
   9.277 -                    break;
   9.278 -                case SHORT:
   9.279 -                    b.append("(short) 0");
   9.280 -                    break;
   9.281 -                case INT:
   9.282 -                    b.append("0");
   9.283 -                    break;
   9.284 -                case LONG:
   9.285 -                    b.append("0L");
   9.286 -                    break;
   9.287 -                case FLOAT:
   9.288 -                    b.append("0.0f");
   9.289 -                    break;
   9.290 -                case DOUBLE:
   9.291 -                    b.append("0.0d");
   9.292 -                    break;
   9.293 -                case TYPEVAR:
   9.294 -                    // XXX what if it is an intersection type, e.g. Number & Runnable?
   9.295 -                    // fallthru
   9.296 -                case DECLARED:
   9.297 -                case ARRAY:
   9.298 -                    String n = name(type2);
   9.299 -                    if (n.equals("String")) {
   9.300 -                        b.append("\"\"");
   9.301 -                    } else {
   9.302 -                        b.append("(");
   9.303 -                        b.append(n);
   9.304 -                        b.append(") null");
   9.305 -                    }
   9.306 -                    break;
   9.307 -                default:
   9.308 -                    assert false : type2;
   9.309 -            }
   9.310 -        }
   9.311 -        return b.toString();
   9.312 -    }
   9.313 -    
   9.314 -}
    10.1 --- a/other/signatures/src/org/netbeans/signatures/antlib.xml	Tue Jul 19 08:01:26 2011 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,4 +0,0 @@
    10.4 -<?xml version="1.0" encoding="UTF-8"?>
    10.5 -<antlib>
    10.6 -    <taskdef name="signatures" classname="org.netbeans.signatures.SignatureTask"/>
    10.7 -</antlib>
    11.1 --- a/other/signatures/test/org/netbeans/signatures/ClassScannerTest.java	Tue Jul 19 08:01:26 2011 +0200
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,127 +0,0 @@
    11.4 -/*
    11.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.6 - *
    11.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    11.8 - *
    11.9 - * The contents of this file are subject to the terms of either the GNU
   11.10 - * General Public License Version 2 only ("GPL") or the Common
   11.11 - * Development and Distribution License("CDDL") (collectively, the
   11.12 - * "License"). You may not use this file except in compliance with the
   11.13 - * License. You can obtain a copy of the License at
   11.14 - * http://www.netbeans.org/cddl-gplv2.html
   11.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   11.16 - * specific language governing permissions and limitations under the
   11.17 - * License.  When distributing the software, include this License Header
   11.18 - * Notice in each file and include the License file at
   11.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   11.20 - * particular file as subject to the "Classpath" exception as provided
   11.21 - * by Sun in the GPL Version 2 section of the License file that
   11.22 - * accompanied this code. If applicable, add the following below the
   11.23 - * License Header, with the fields enclosed by brackets [] replaced by
   11.24 - * your own identifying information:
   11.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   11.26 - *
   11.27 - * Contributor(s):
   11.28 - *
   11.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   11.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   11.31 - * Microsystems, Inc. All Rights Reserved.
   11.32 - *
   11.33 - * If you wish your version of this file to be governed by only the CDDL
   11.34 - * or only the GPL Version 2, indicate your decision by adding
   11.35 - * "[Contributor] elects to include this software in this distribution
   11.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   11.37 - * single choice of license, a recipient has the option to distribute
   11.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   11.39 - * to extend the choice of license to its licensees as provided above.
   11.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   11.41 - * Version 2 license, then the option applies only if the new code is
   11.42 - * made subject to such option by the copyright holder.
   11.43 - */
   11.44 -
   11.45 -package org.netbeans.signatures;
   11.46 -
   11.47 -import java.io.File;
   11.48 -import java.util.Collection;
   11.49 -import java.util.Collections;
   11.50 -import java.util.HashSet;
   11.51 -import java.util.Set;
   11.52 -import junit.framework.TestCase;
   11.53 -
   11.54 -/**
   11.55 - * @author Jesse Glick
   11.56 - */
   11.57 -public class ClassScannerTest extends TestCase {
   11.58 -    
   11.59 -    public ClassScannerTest(String n) {
   11.60 -        super(n);
   11.61 -    }
   11.62 -    
   11.63 -    private File antJar;
   11.64 -    private File antModuleJar;
   11.65 -    private File javaHelpJar;
   11.66 -    
   11.67 -    protected void setUp() throws Exception {
   11.68 -        super.setUp();
   11.69 -        antJar = new File(Class.forName("org.apache.tools.ant.Project").getProtectionDomain().getCodeSource().getLocation().toURI());
   11.70 -        assertTrue(antJar.getAbsolutePath(), antJar.isFile());
   11.71 -        antModuleJar = new File(antJar.getParentFile().getParentFile().getParentFile().getParentFile(), "nbbuild/netbeans/ide8/modules/org-apache-tools-ant-module.jar");
   11.72 -        assertTrue(antModuleJar.getAbsolutePath(), antModuleJar.isFile());
   11.73 -        javaHelpJar = new File(antJar.getParentFile().getParentFile().getParentFile().getParentFile(), "nbbuild/netbeans/platform7/modules/org-netbeans-modules-javahelp.jar");
   11.74 -        assertTrue(javaHelpJar.getAbsolutePath(), javaHelpJar.isFile());
   11.75 -    }
   11.76 -
   11.77 -    public void testFindPackages() throws Exception {
   11.78 -        Collection<String> antClasses = ClassScanner.findTopLevelClasses(Collections.singleton(antJar), true, true);
   11.79 -        //System.out.println(antClasses);
   11.80 -        assertTrue(antClasses.contains("org.apache.tools.ant.Project"));
   11.81 -        assertTrue(antClasses.contains("org.apache.tools.ant.filters.TokenFilter$Filter"));
   11.82 -        Collection<String> antModuleClasses = ClassScanner.findTopLevelClasses(Collections.singleton(antModuleJar), true, true);
   11.83 -        assertFalse(antModuleClasses.contains("org.apache.tools.ant.module.run.StandardLogger"));
   11.84 -        //System.out.println(antModuleClasses);
   11.85 -        antModuleClasses = ClassScanner.findTopLevelClasses(Collections.singleton(antModuleJar), false, true);
   11.86 -        assertTrue(antModuleClasses.contains("org.apache.tools.ant.module.run.StandardLogger"));
   11.87 -        //System.out.println(antModuleClasses);
   11.88 -    }
   11.89 -    
   11.90 -    public void testClassPathExtensions() throws Exception {
   11.91 -        Set<File> cp = new HashSet<File>(Collections.singleton(javaHelpJar));
   11.92 -        Collection<String> c = ClassScanner.findTopLevelClasses(cp, true, true);
   11.93 -        assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
   11.94 -        assertFalse(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
   11.95 -        assertTrue(c.contains("javax.help.HelpSet"));
   11.96 -        assertTrue(c.contains("javax.help.event.HelpModelEvent"));
   11.97 -        assertFalse(c.contains("com.sun.java.help.impl.Tag"));
   11.98 -        assertEquals(2, cp.size());
   11.99 -        assertTrue(cp.remove(javaHelpJar));
  11.100 -        assertTrue(cp.iterator().next().getName().startsWith("jh"));
  11.101 -        
  11.102 -        cp = new HashSet<File>(Collections.singleton(javaHelpJar));
  11.103 -        c = ClassScanner.findTopLevelClasses(cp, false, true);
  11.104 -        assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
  11.105 -        assertTrue(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
  11.106 -        assertTrue(c.contains("javax.help.HelpSet"));
  11.107 -        assertTrue(c.contains("javax.help.event.HelpModelEvent"));
  11.108 -        assertTrue(c.contains("com.sun.java.help.impl.Tag"));
  11.109 -        assertEquals(2, cp.size());
  11.110 -        
  11.111 -        cp = new HashSet<File>(Collections.singleton(javaHelpJar));
  11.112 -        c = ClassScanner.findTopLevelClasses(cp, true, false);
  11.113 -        assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
  11.114 -        assertFalse(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
  11.115 -        assertFalse(c.contains("javax.help.HelpSet"));
  11.116 -        assertFalse(c.contains("javax.help.event.HelpModelEvent"));
  11.117 -        assertFalse(c.contains("com.sun.java.help.impl.Tag"));
  11.118 -        assertEquals(1, cp.size());
  11.119 -        
  11.120 -        cp = new HashSet<File>(Collections.singleton(javaHelpJar));
  11.121 -        c = ClassScanner.findTopLevelClasses(cp, false, false);
  11.122 -        assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
  11.123 -        assertTrue(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
  11.124 -        assertFalse(c.contains("javax.help.HelpSet"));
  11.125 -        assertFalse(c.contains("javax.help.event.HelpModelEvent"));
  11.126 -        assertFalse(c.contains("com.sun.java.help.impl.Tag"));
  11.127 -        assertEquals(1, cp.size());
  11.128 -    }
  11.129 -    
  11.130 -}
    12.1 --- a/other/signatures/test/org/netbeans/signatures/LoaderTest.java	Tue Jul 19 08:01:26 2011 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,78 +0,0 @@
    12.4 -/*
    12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.6 - *
    12.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    12.8 - *
    12.9 - * The contents of this file are subject to the terms of either the GNU
   12.10 - * General Public License Version 2 only ("GPL") or the Common
   12.11 - * Development and Distribution License("CDDL") (collectively, the
   12.12 - * "License"). You may not use this file except in compliance with the
   12.13 - * License. You can obtain a copy of the License at
   12.14 - * http://www.netbeans.org/cddl-gplv2.html
   12.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   12.16 - * specific language governing permissions and limitations under the
   12.17 - * License.  When distributing the software, include this License Header
   12.18 - * Notice in each file and include the License file at
   12.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   12.20 - * particular file as subject to the "Classpath" exception as provided
   12.21 - * by Sun in the GPL Version 2 section of the License file that
   12.22 - * accompanied this code. If applicable, add the following below the
   12.23 - * License Header, with the fields enclosed by brackets [] replaced by
   12.24 - * your own identifying information:
   12.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   12.26 - *
   12.27 - * Contributor(s):
   12.28 - *
   12.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   12.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   12.31 - * Microsystems, Inc. All Rights Reserved.
   12.32 - *
   12.33 - * If you wish your version of this file to be governed by only the CDDL
   12.34 - * or only the GPL Version 2, indicate your decision by adding
   12.35 - * "[Contributor] elects to include this software in this distribution
   12.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   12.37 - * single choice of license, a recipient has the option to distribute
   12.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   12.39 - * to extend the choice of license to its licensees as provided above.
   12.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   12.41 - * Version 2 license, then the option applies only if the new code is
   12.42 - * made subject to such option by the copyright holder.
   12.43 - */
   12.44 -
   12.45 -package org.netbeans.signatures;
   12.46 -
   12.47 -import java.io.File;
   12.48 -import java.util.Collections;
   12.49 -import javax.lang.model.element.TypeElement;
   12.50 -import junit.framework.TestCase;
   12.51 -
   12.52 -/**
   12.53 - * @author Jesse Glick
   12.54 - */
   12.55 -public class LoaderTest extends TestCase {
   12.56 -    
   12.57 -    public LoaderTest(String n) {
   12.58 -        super(n);
   12.59 -    }
   12.60 -    
   12.61 -    private File antJar;
   12.62 -    
   12.63 -    protected void setUp() throws Exception {
   12.64 -        super.setUp();
   12.65 -        antJar = new File(Class.forName("org.apache.tools.ant.Project").getProtectionDomain().getCodeSource().getLocation().toURI());
   12.66 -        assertTrue(antJar.getAbsolutePath(), antJar.isFile());
   12.67 -    }
   12.68 -
   12.69 -    public void testBasicUsage() throws Exception {
   12.70 -        new Loader(Collections.singleton(antJar)) {
   12.71 -            protected void run() {
   12.72 -                TypeElement set = elements().getTypeElement("java.util.Set");
   12.73 -                assertEquals("java.util.Set", set.getQualifiedName().toString());
   12.74 -                assertEquals(1, set.getTypeParameters().size());
   12.75 -                TypeElement prj = elements().getTypeElement("org.apache.tools.ant.Project");
   12.76 -                assertNotNull(prj);
   12.77 -            }
   12.78 -        };
   12.79 -    }
   12.80 -    
   12.81 -}
    13.1 --- a/other/signatures/test/org/netbeans/signatures/SignatureTaskTest.java	Tue Jul 19 08:01:26 2011 +0200
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,168 +0,0 @@
    13.4 -/*
    13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.6 - *
    13.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    13.8 - *
    13.9 - * The contents of this file are subject to the terms of either the GNU
   13.10 - * General Public License Version 2 only ("GPL") or the Common
   13.11 - * Development and Distribution License("CDDL") (collectively, the
   13.12 - * "License"). You may not use this file except in compliance with the
   13.13 - * License. You can obtain a copy of the License at
   13.14 - * http://www.netbeans.org/cddl-gplv2.html
   13.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   13.16 - * specific language governing permissions and limitations under the
   13.17 - * License.  When distributing the software, include this License Header
   13.18 - * Notice in each file and include the License file at
   13.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   13.20 - * particular file as subject to the "Classpath" exception as provided
   13.21 - * by Sun in the GPL Version 2 section of the License file that
   13.22 - * accompanied this code. If applicable, add the following below the
   13.23 - * License Header, with the fields enclosed by brackets [] replaced by
   13.24 - * your own identifying information:
   13.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   13.26 - *
   13.27 - * Contributor(s):
   13.28 - *
   13.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   13.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   13.31 - * Microsystems, Inc. All Rights Reserved.
   13.32 - *
   13.33 - * If you wish your version of this file to be governed by only the CDDL
   13.34 - * or only the GPL Version 2, indicate your decision by adding
   13.35 - * "[Contributor] elects to include this software in this distribution
   13.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   13.37 - * single choice of license, a recipient has the option to distribute
   13.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   13.39 - * to extend the choice of license to its licensees as provided above.
   13.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   13.41 - * Version 2 license, then the option applies only if the new code is
   13.42 - * made subject to such option by the copyright holder.
   13.43 - */
   13.44 -
   13.45 -package org.netbeans.signatures;
   13.46 -
   13.47 -import java.io.BufferedReader;
   13.48 -import java.io.File;
   13.49 -import java.io.FileReader;
   13.50 -import java.io.Reader;
   13.51 -import junit.framework.TestCase;
   13.52 -import org.apache.tools.ant.BuildEvent;
   13.53 -import org.apache.tools.ant.BuildListener;
   13.54 -import org.apache.tools.ant.BuildLogger;
   13.55 -import org.apache.tools.ant.Project;
   13.56 -import org.apache.tools.ant.types.FileSet;
   13.57 -
   13.58 -/**
   13.59 - * @author Jesse Glick
   13.60 - */
   13.61 -public class SignatureTaskTest extends TestCase {
   13.62 -    
   13.63 -    public SignatureTaskTest(String n) {
   13.64 -        super(n);
   13.65 -    }
   13.66 -    
   13.67 -    private File antJar;
   13.68 -    private File antLauncherJar;
   13.69 -    private File antModuleJar;
   13.70 -    private File nbdev;
   13.71 -    
   13.72 -    protected void setUp() throws Exception {
   13.73 -        super.setUp();
   13.74 -        antJar = new File(Class.forName("org.apache.tools.ant.Project").getProtectionDomain().getCodeSource().getLocation().toURI());
   13.75 -        assertTrue(antJar.getAbsolutePath(), antJar.isFile());
   13.76 -        antLauncherJar = new File(antJar.getParentFile(), "ant-launcher.jar");
   13.77 -        assertTrue(antLauncherJar.getAbsolutePath(), antLauncherJar.isFile());
   13.78 -        nbdev = new File(antJar.getParentFile().getParentFile().getParentFile().getParentFile(), "nbbuild/netbeans");
   13.79 -        assertTrue(nbdev.isDirectory());
   13.80 -        antModuleJar = new File(nbdev, "ide8/modules/org-apache-tools-ant-module.jar");
   13.81 -        assertTrue(antModuleJar.getAbsolutePath(), antModuleJar.isFile());
   13.82 -    }
   13.83 -    
   13.84 -    public void testExecuteAnt() throws Exception {
   13.85 -        Project p = new Project();
   13.86 -        p.addBuildListener(new Listener());
   13.87 -        SignatureTask task = new SignatureTask();
   13.88 -        task.setProject(p);
   13.89 -        File out = File.createTempFile("signatures", ".java");
   13.90 -        task.setOut(out);
   13.91 -        FileSet fs = new FileSet();
   13.92 -        fs.setProject(p);
   13.93 -        fs.setDir(antJar.getParentFile());
   13.94 -        fs.setIncludes(antJar.getName());
   13.95 -        task.addFileSet(fs);
   13.96 -        fs = new FileSet();
   13.97 -        fs.setProject(p);
   13.98 -        fs.setDir(antLauncherJar.getParentFile());
   13.99 -        fs.setIncludes(antLauncherJar.getName());
  13.100 -        task.addFileSet(fs);
  13.101 -        task.execute();
  13.102 -        assertTrue(out.isFile());
  13.103 -        Reader r = new FileReader(out);
  13.104 -        try {
  13.105 -            BufferedReader b = new BufferedReader(r);
  13.106 -            while (true) {
  13.107 -                String l = b.readLine();
  13.108 -                assertNotNull("found matching line in " + out, l);
  13.109 -                if (l.equals("{Class _ = org.apache.tools.ant.Task.class;}")) {
  13.110 -                    break;
  13.111 -                }
  13.112 -            }
  13.113 -        } finally {
  13.114 -            r.close();
  13.115 -        }
  13.116 -    }
  13.117 -    
  13.118 -    public void testExecuteNB() throws Exception {
  13.119 -        Project p = new Project();
  13.120 -        p.addBuildListener(new Listener());
  13.121 -        SignatureTask task = new SignatureTask();
  13.122 -        task.setProject(p);
  13.123 -        File out = File.createTempFile("signatures", ".java");
  13.124 -        task.setOut(out);
  13.125 -        FileSet fs = new FileSet();
  13.126 -        fs.setProject(p);
  13.127 -        fs.setDir(nbdev);
  13.128 -        fs.setIncludes("*/modules/*.jar,*/lib/*.jar,*/core/*.jar");
  13.129 -        task.addFileSet(fs);
  13.130 -        task.execute();
  13.131 -        assertTrue(out.isFile());
  13.132 -        Reader r = new FileReader(out);
  13.133 -        try {
  13.134 -            BufferedReader b = new BufferedReader(r);
  13.135 -            while (true) {
  13.136 -                String l = b.readLine();
  13.137 -                assertNotNull("found matching line in " + out, l);
  13.138 -                if (l.equals("{Class _ = javax.help.HelpSet.class;}")) {
  13.139 -                    break;
  13.140 -                }
  13.141 -            }
  13.142 -        } finally {
  13.143 -            r.close();
  13.144 -        }
  13.145 -    }
  13.146 -    
  13.147 -    private static final class Listener implements BuildListener {
  13.148 -        
  13.149 -        Listener() {}
  13.150 -        
  13.151 -        public void buildStarted(BuildEvent event) {}
  13.152 -
  13.153 -        public void buildFinished(BuildEvent event) {}
  13.154 -
  13.155 -        public void targetStarted(BuildEvent event) {}
  13.156 -
  13.157 -        public void targetFinished(BuildEvent event) {}
  13.158 -
  13.159 -        public void taskStarted(BuildEvent event) {}
  13.160 -
  13.161 -        public void taskFinished(BuildEvent event) {}
  13.162 -
  13.163 -        public void messageLogged(BuildEvent event) {
  13.164 -            if (event.getPriority() <= Project.MSG_INFO) {
  13.165 -                System.err.println(event.getMessage());
  13.166 -            }
  13.167 -        }
  13.168 -        
  13.169 -    }
  13.170 -
  13.171 -}
    14.1 --- a/other/signatures/test/org/netbeans/signatures/SignatureWriterTest.java	Tue Jul 19 08:01:26 2011 +0200
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,368 +0,0 @@
    14.4 -/*
    14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6 - *
    14.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    14.8 - *
    14.9 - * The contents of this file are subject to the terms of either the GNU
   14.10 - * General Public License Version 2 only ("GPL") or the Common
   14.11 - * Development and Distribution License("CDDL") (collectively, the
   14.12 - * "License"). You may not use this file except in compliance with the
   14.13 - * License. You can obtain a copy of the License at
   14.14 - * http://www.netbeans.org/cddl-gplv2.html
   14.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   14.16 - * specific language governing permissions and limitations under the
   14.17 - * License.  When distributing the software, include this License Header
   14.18 - * Notice in each file and include the License file at
   14.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   14.20 - * particular file as subject to the "Classpath" exception as provided
   14.21 - * by Sun in the GPL Version 2 section of the License file that
   14.22 - * accompanied this code. If applicable, add the following below the
   14.23 - * License Header, with the fields enclosed by brackets [] replaced by
   14.24 - * your own identifying information:
   14.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   14.26 - *
   14.27 - * Contributor(s):
   14.28 - *
   14.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   14.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   14.31 - * Microsystems, Inc. All Rights Reserved.
   14.32 - *
   14.33 - * If you wish your version of this file to be governed by only the CDDL
   14.34 - * or only the GPL Version 2, indicate your decision by adding
   14.35 - * "[Contributor] elects to include this software in this distribution
   14.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   14.37 - * single choice of license, a recipient has the option to distribute
   14.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   14.39 - * to extend the choice of license to its licensees as provided above.
   14.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   14.41 - * Version 2 license, then the option applies only if the new code is
   14.42 - * made subject to such option by the copyright holder.
   14.43 - */
   14.44 -
   14.45 -package org.netbeans.signatures;
   14.46 -
   14.47 -import java.io.File;
   14.48 -import java.io.IOException;
   14.49 -import java.io.PrintWriter;
   14.50 -import java.io.StringWriter;
   14.51 -import java.io.Writer;
   14.52 -import java.net.URI;
   14.53 -import java.util.ArrayList;
   14.54 -import java.util.Arrays;
   14.55 -import java.util.Collections;
   14.56 -import java.util.List;
   14.57 -import java.util.Set;
   14.58 -import java.util.SortedSet;
   14.59 -import java.util.TreeSet;
   14.60 -import java.util.regex.Matcher;
   14.61 -import java.util.regex.Pattern;
   14.62 -import javax.annotation.processing.AbstractProcessor;
   14.63 -import javax.annotation.processing.RoundEnvironment;
   14.64 -import javax.annotation.processing.SupportedAnnotationTypes;
   14.65 -import javax.annotation.processing.SupportedSourceVersion;
   14.66 -import javax.lang.model.SourceVersion;
   14.67 -import javax.lang.model.element.TypeElement;
   14.68 -import javax.tools.JavaCompiler;
   14.69 -import javax.tools.JavaFileObject;
   14.70 -import javax.tools.SimpleJavaFileObject;
   14.71 -import javax.tools.ToolProvider;
   14.72 -import junit.framework.TestCase;
   14.73 -
   14.74 -/**
   14.75 - * @author Jesse Glick
   14.76 - */
   14.77 -public class SignatureWriterTest extends TestCase {
   14.78 -    
   14.79 -    public SignatureWriterTest(String n) {
   14.80 -        super(n);
   14.81 -    }
   14.82 -    
   14.83 -    public void testBasicClass() {
   14.84 -        assertEmitted("package p; class X {}", "p.X", "");
   14.85 -    }
   14.86 -    
   14.87 -    public void testConstructors() {
   14.88 -        assertEmitted("package p; public final class X {private X() {}}",
   14.89 -                "p.X",
   14.90 -                "Class _ = p.X.class;");
   14.91 -        assertEmitted("package p; public class X {private X() {}}",
   14.92 -                "p.X",
   14.93 -                "Class _ = p.X.class;");
   14.94 -        assertEmitted("package p; public final class X {public X() {}}",
   14.95 -                "p.X",
   14.96 -                "Class _ = p.X.class;  " +
   14.97 -                "new p.X();");
   14.98 -        assertEmitted("package p; public final class X {}",
   14.99 -                "p.X",
  14.100 -                "Class _ = p.X.class;  " +
  14.101 -                "new p.X();");
  14.102 -        assertEmitted("package p; public final class X {public X() {} public X(int x, String y, int[] z, java.util.Set<String> w) {}}",
  14.103 -                "p.X",
  14.104 -                "Class _ = p.X.class;  " +
  14.105 -                "new p.X();  " +
  14.106 -                "new p.X(0, \"\", (int[]) null, (java.util.Set<String>) null);");
  14.107 -        assertEmitted("package p; public class S {} package p; public final class X extends S {}",
  14.108 -                "p.X",
  14.109 -                "Class _ = p.X.class;  " +
  14.110 -                "p.S _ = (p.X) null;  " +
  14.111 -                "new p.X();");
  14.112 -        assertEmitted("package p; public class S<T> {} package p; public final class X<T> extends S<T> {public X() {} public X(T x) {}}",
  14.113 -                "p.X",
  14.114 -                "Class _ = p.X.class;  " +
  14.115 -                "p.S<Object> _ = (p.X<Object>) null;  " +
  14.116 -                "new p.X<Object>();  " +
  14.117 -                "new p.X<Object>((Object) null);");
  14.118 -        assertEmitted("package p; public class S<T> {} package p; public final class X extends S<String> {}",
  14.119 -                "p.X",
  14.120 -                "Class _ = p.X.class;  " +
  14.121 -                "p.S<String> _ = (p.X) null;  " +
  14.122 -                "new p.X();");
  14.123 -        assertEmitted("package p; public abstract class X {}",
  14.124 -                "p.X",
  14.125 -                "Class _ = p.X.class;");
  14.126 -        assertEmitted("package p; class S {} package p; public final class X extends S {}",
  14.127 -                "p.X",
  14.128 -                "Class _ = p.X.class;  " +
  14.129 -                "new p.X();");
  14.130 -        assertEmitted("package p; public final class X {public X(char c) throws ClassNotFoundException, java.io.IOException, IllegalArgumentException {}}",
  14.131 -                "p.X",
  14.132 -                "Class _ = p.X.class;  " +
  14.133 -                "try {new p.X(' ');} catch (ClassNotFoundException _) {} catch (java.io.IOException _) {}");
  14.134 -        assertEmitted("package p; public final class X {public X(java.lang.reflect.Method m) {}}",
  14.135 -                "p.X",
  14.136 -                "Class _ = p.X.class;  " +
  14.137 -                "new p.X((java.lang.reflect.Method) null);");
  14.138 -        assertEmitted("package p; class Hidden {} package p; public final class X {public X(Hidden h) {}}",
  14.139 -                "p.X",
  14.140 -                "Class _ = p.X.class;");
  14.141 -        assertEmitted("package p; public final class X {public <T> X(T t, Class<T> c) {}}",
  14.142 -                "p.X",
  14.143 -                "Class _ = p.X.class;  " +
  14.144 -                "new p.X((Object) null, (Class<Object>) null);");
  14.145 -        assertEmitted("package p; public final class X {public X(String s1, java.util.List<String> l, String s2, String s3) {}}",
  14.146 -                "p.X",
  14.147 -                "Class _ = p.X.class;  " +
  14.148 -                "new p.X(\"\", (java.util.List<String>) null, \"\", \"\");");
  14.149 -        assertEmitted("package p; public final class X<T> {public X(java.util.List<? extends T> l) {}}",
  14.150 -                "p.X",
  14.151 -                "Class _ = p.X.class;  " +
  14.152 -                "new p.X<Object>((java.util.List<Object>) null);");
  14.153 -        assertEmitted("package p; public final class X<T extends Number> {public X(java.util.List<? extends T> l) {}}",
  14.154 -                "p.X",
  14.155 -                "Class _ = p.X.class;  " +
  14.156 -                "new p.X<Number>((java.util.List<Number>) null);");
  14.157 -        assertEmitted("package p; public final class X {public X(String s) {} public <T> X(T t) {}}",
  14.158 -                "p.X",
  14.159 -                "Class _ = p.X.class;  " +
  14.160 -                // XXX first call is ambiguous, both constructors match!
  14.161 -                // Take example from javax.management.openmbean.OpenMBeanAttributeInfoSupport
  14.162 -                "new p.X(\"\");  " +
  14.163 -                "new p.X((Object) null);");
  14.164 -    }
  14.165 -
  14.166 -    private static void assertEmitted(String source, String clazz, String sig) {
  14.167 -        // First compile the test sources.
  14.168 -        //MemoryOutputFileManager mgr = new MemoryOutputFileManager();
  14.169 -        // XXX would be better to compile to memory, but cannot get it to work.
  14.170 -        File dir = new File(System.getProperty("java.io.tmpdir"));
  14.171 -        List<JavaFileObject> compUnits = new ArrayList<JavaFileObject>();
  14.172 -        for (final String chunk : source.split("(?!^)(?=package [a-z.]+;)")) {
  14.173 -            //System.err.println("Got: " + chunk);
  14.174 -            Matcher m = Pattern.compile("package ([a-z.]+); [a-z ]*(class|enum|interface|@interface) ([a-zA-Z0-9_]+).*").matcher(chunk);
  14.175 -            assertTrue(chunk, m.matches());
  14.176 -            String path = m.group(1).replace('.', '/') + "/" + m.group(3) + ".java";
  14.177 -            //System.err.println("with path: " + path);
  14.178 -            //compunits.add(mgr.store(path, chunk));
  14.179 -            compUnits.add(new SimpleJavaFileObject(URI.create("nowhere:/" + path), JavaFileObject.Kind.SOURCE) {
  14.180 -                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
  14.181 -                    return chunk;
  14.182 -                }
  14.183 -            });
  14.184 -        }
  14.185 -        StringWriter err = new StringWriter();
  14.186 -        JavaCompiler.CompilationTask task = ToolProvider.getSystemJavaCompiler().getTask(
  14.187 -                err,
  14.188 -                null,
  14.189 -                null,
  14.190 -                Arrays.asList("-source", "1.6", "-d", dir.getAbsolutePath(), /* exercise JDK bug #6468404 */"-g"),
  14.191 -                null,
  14.192 -                compUnits);
  14.193 -        boolean ok = task.call();
  14.194 -        String errors = err.toString();
  14.195 -        assertTrue(errors, ok);
  14.196 -        assertEquals(errors, 0, errors.length());
  14.197 -        // Now compile a dummy class so we can run the processor.
  14.198 -        task = ToolProvider.getSystemJavaCompiler().getTask(
  14.199 -                err,
  14.200 -                Loader.nullOutputFileManager(),
  14.201 -                null,
  14.202 -                Arrays.asList("-source", "1.6", "-classpath", dir.getAbsolutePath()),
  14.203 -                null,
  14.204 -                Collections.singleton(Loader.dummyCompilationUnit()));
  14.205 -        StringWriter result = new StringWriter();
  14.206 -        task.setProcessors(Collections.singleton(new P(result, clazz)));
  14.207 -        ok = task.call();
  14.208 -        // XXX could now delete the .class files in dir
  14.209 -        errors = err.toString();
  14.210 -        assertTrue(errors, ok);
  14.211 -        assertEquals(errors, 0, errors.length());
  14.212 -        SortedSet<String> lines = new TreeSet<String>(Arrays.asList(sig.split("  ")));
  14.213 -        StringBuilder b = new StringBuilder();
  14.214 -        for (String line : lines) {
  14.215 -            if (b.length() > 0) {
  14.216 -                b.append("  ");
  14.217 -            }
  14.218 -            b.append(line);
  14.219 -        }
  14.220 -        assertEquals(source, b.toString(), result.toString().replaceAll("^\\{", "").replaceAll("\\}\n\n$", "").replaceAll("\\}\n\\{", "  "));
  14.221 -        // XXX check that sig is compilable, too
  14.222 -    }
  14.223 -    
  14.224 -    /* Just does not work, not obvious why. Never writes out a .class file.
  14.225 -    private static final class MemoryOutputFileManager extends ForwardingJavaFileManager<JavaFileManager> {
  14.226 -        
  14.227 -        final Map<String,String> data = new HashMap<String,String>();
  14.228 -        
  14.229 -        public MemoryOutputFileManager() {
  14.230 -            super(ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null));
  14.231 -        }
  14.232 -        
  14.233 -        public JavaFileObject store(String path, String contents) {
  14.234 -            data.put(path, contents);
  14.235 -            return new FO(path, null);
  14.236 -        }
  14.237 -
  14.238 -        public JavaFileObject getJavaFileForInput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind) throws IOException {
  14.239 -            String path = className.replace('.', '/') + ".java";
  14.240 -            if (data.containsKey(path)) {
  14.241 -                return new FO(path, kind);
  14.242 -            } else {
  14.243 -                return super.getJavaFileForInput(location, className, kind);
  14.244 -            }
  14.245 -        }
  14.246 -
  14.247 -        public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException {
  14.248 -            return new FO(className.replace('.', '/') + ".java", kind);
  14.249 -        }
  14.250 -
  14.251 -        public FileObject getFileForInput(JavaFileManager.Location location, String packageName, String relativeName) throws IOException {
  14.252 -            String path = packageName.replace('.', '/') + "/" + relativeName;
  14.253 -            if (data.containsKey(path)) {
  14.254 -                return new FO(path, null);
  14.255 -            } else {
  14.256 -                return super.getFileForInput(location, packageName, relativeName);
  14.257 -            }
  14.258 -        }
  14.259 -
  14.260 -        public FileObject getFileForOutput(JavaFileManager.Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
  14.261 -            return new FO(packageName.replace('.', '/') + "/" + relativeName, null);
  14.262 -        }
  14.263 -
  14.264 -        public Iterable<JavaFileObject> list(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException {
  14.265 -            List<JavaFileObject> files = new ArrayList<JavaFileObject>();
  14.266 -            for (JavaFileObject f : super.list(location, packageName, kinds, recurse)) {
  14.267 -                files.add(f);
  14.268 -            }
  14.269 -            for (Map.Entry<String,String> entry : data.entrySet()) {
  14.270 -                String path = entry.getKey();
  14.271 -                if (path.startsWith(packageName.replace('.', '/') + "/") && kinds.contains(kindFor(path))) {
  14.272 -                    files.add(new FO(path, null));
  14.273 -                }
  14.274 -            }
  14.275 -            System.err.println("XXX list: " + location + " " + packageName + " " + kinds + " " + recurse + " -> " + files);
  14.276 -            return files;
  14.277 -        }
  14.278 -
  14.279 -        public boolean hasLocation(JavaFileManager.Location location) {
  14.280 -            return true;
  14.281 -            / *
  14.282 -            boolean retValue;
  14.283 -            
  14.284 -            retValue = super.hasLocation(location);
  14.285 -            System.err.println("XXX hasLocation " + location + " -> " + retValue);
  14.286 -            return retValue;
  14.287 -             * /
  14.288 -        }
  14.289 -        
  14.290 -        private JavaFileObject.Kind kindFor(String path) {
  14.291 -            if (path.endsWith(".java")) {
  14.292 -                return JavaFileObject.Kind.SOURCE;
  14.293 -            } else if (path.endsWith(".class")) {
  14.294 -                return JavaFileObject.Kind.CLASS;
  14.295 -            } else {
  14.296 -                return JavaFileObject.Kind.OTHER;
  14.297 -            }
  14.298 -        }
  14.299 -
  14.300 -        public String inferBinaryName(JavaFileManager.Location location, JavaFileObject file) {
  14.301 -            if (file instanceof FO) {
  14.302 -                return file.getName().replaceFirst("\\.[^/.]+$", "").replace('/', '.');
  14.303 -            } else {
  14.304 -                return super.inferBinaryName(location, file);
  14.305 -            }
  14.306 -        }
  14.307 -
  14.308 -        private class FO extends SimpleJavaFileObject {
  14.309 -            
  14.310 -            public FO(String path, JavaFileObject.Kind kind) {
  14.311 -                super(URI.create("mem:/" + path), kind != null ? kind : kindFor(path));
  14.312 -                System.err.println("XXX made FO for " + uri + " " + kind);
  14.313 -            }
  14.314 -
  14.315 -            public InputStream openInputStream() throws IOException {
  14.316 -                return new ByteArrayInputStream(data.get(getName()).getBytes("UTF-8"));
  14.317 -            }
  14.318 -
  14.319 -            public OutputStream openOutputStream() throws IOException {
  14.320 -                return new ByteArrayOutputStream() {
  14.321 -                    public void close() throws IOException {
  14.322 -                        super.close();
  14.323 -                        data.put(getName(), toString("UTF-8"));
  14.324 -                    }
  14.325 -                };
  14.326 -            }
  14.327 -
  14.328 -            public Writer openWriter() throws IOException {
  14.329 -                return new StringWriter() {
  14.330 -                    public void close() throws IOException {
  14.331 -                        super.close();
  14.332 -                        data.put(getName(), toString());
  14.333 -                    }
  14.334 -                };
  14.335 -            }
  14.336 -
  14.337 -            public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
  14.338 -                return data.get(getName());
  14.339 -            }
  14.340 -            
  14.341 -        }
  14.342 -        
  14.343 -    }
  14.344 -     */
  14.345 -    
  14.346 -    @SupportedAnnotationTypes("*")
  14.347 -    @SupportedSourceVersion(SourceVersion.RELEASE_6)
  14.348 -    private static final class P extends AbstractProcessor {
  14.349 -        
  14.350 -        private final Writer w;
  14.351 -        private final String clazz;
  14.352 -        private boolean ran = false;
  14.353 -        
  14.354 -        P(Writer w, String clazz) {
  14.355 -            this.w = w;
  14.356 -            this.clazz = clazz;
  14.357 -        }
  14.358 -        
  14.359 -        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  14.360 -            if (!ran) {
  14.361 -                ran = true;
  14.362 -            } else {
  14.363 -                return true;
  14.364 -            }
  14.365 -            new SignatureWriter(new PrintWriter(w), processingEnv.getElementUtils(), processingEnv.getTypeUtils()).process(clazz);
  14.366 -            return true;
  14.367 -        }
  14.368 -        
  14.369 -    }
  14.370 -
  14.371 -}