Mon, 24 Aug 2009 22:28:37 -0700
Merge
1.1 --- a/make/build.properties Thu Aug 20 11:20:31 2009 -0700 1.2 +++ b/make/build.properties Mon Aug 24 22:28:37 2009 -0700 1.3 @@ -26,10 +26,10 @@ 1.4 # This is the JDK used to build and run the bootstrap version of javac. 1.5 # The bootstrap javac is used to compile both boostrap versions of the 1.6 # other tools, and product versions of all the tools. 1.7 -# Override this path as needed, either on the command line or in 1.8 +# Override this path as needed, either on the command line or in 1.9 # one of the standard user build.properties files (see build.xml) 1.10 1.11 -# boot.java.home = /opt/jdk/1.6.0 1.12 +# boot.java.home = /opt/jdk/1.6.0 1.13 boot.java = ${boot.java.home}/bin/java 1.14 boot.javac = ${boot.java.home}/bin/javac 1.15 boot.javac.source = 6 1.16 @@ -37,7 +37,7 @@ 1.17 1.18 # This is the JDK used to run the product version of the tools, 1.19 # for example, for testing. If you're building a complete JDK, specify that. 1.20 -# Override this path as needed, either on the command line or in 1.21 +# Override this path as needed, either on the command line or in 1.22 # one of the standard user build.properties files (see build.xml) 1.23 1.24 # target.java.home = /opt/jdk/1.7.0 1.25 @@ -66,23 +66,23 @@ 1.26 javac.debuglevel = source,lines 1.27 javac.no.jdk.warnings = -XDignore.symbol.file=true 1.28 # set the following to -version to verify the versions of javac being used 1.29 -javac.version.opt = 1.30 +javac.version.opt = 1.31 # in time, there should be no exceptions to -Xlint:all 1.32 javac.lint.opts = -Xlint:all,-deprecation -Werror 1.33 1.34 # options for the <javadoc> task for javac 1.35 javadoc.jls3.url=http://java.sun.com/docs/books/jls/ 1.36 -javadoc.jls3.cite=<a href="${javadoc.jls3.url}">The Java Language Specification, Third Edition</a> 1.37 +javadoc.jls3.cite=<a href="${javadoc.jls3.url}">The Java Language Specification, Third Edition</a> 1.38 javadoc.jls3.option=-tag "jls3:a:See <cite>${javadoc.jls3.cite}</cite>:" 1.39 1.40 # jtreg, used to run the JDK regression tests 1.41 -# Override this path as needed, either on the command line or in 1.42 +# Override this path as needed, either on the command line or in 1.43 # one of the standard user build.properties files (see build.xml) 1.44 1.45 # jtreg.home = /opt/jtreg/3.2.2_02 1.46 1.47 # findbugs 1.48 -# Override this path as needed, either on the command line or in 1.49 +# Override this path as needed, either on the command line or in 1.50 # one of the standard user build.properties files (see build.xml) 1.51 1.52 # findbugs.home = /opt/findbugs/1.2.1 1.53 @@ -94,46 +94,61 @@ 1.54 # parameter of Ant filesets. In particular, note the trailing '/'. 1.55 1.56 javac.includes = \ 1.57 - javax/annotation/processing/ \ 1.58 - javax/lang/model/ \ 1.59 - javax/tools/ \ 1.60 - com/sun/source/ com/sun/tools/javac/ 1.61 + javax/annotation/processing/ \ 1.62 + javax/lang/model/ \ 1.63 + javax/tools/ \ 1.64 + com/sun/source/ com/sun/tools/javac/ 1.65 1.66 javac.tests = \ 1.67 - tools/javac 1.68 - 1.69 + tools/javac 1.70 + 1.71 +# 1.72 + 1.73 javadoc.includes = \ 1.74 - com/sun/javadoc/ \ 1.75 - com/sun/tools/javadoc/ 1.76 + com/sun/javadoc/ \ 1.77 + com/sun/tools/javadoc/ 1.78 1.79 javadoc.tests = \ 1.80 - tools/javadoc/ 1.81 - 1.82 + tools/javadoc/ 1.83 + 1.84 +# 1.85 + 1.86 doclets.includes = \ 1.87 - com/sun/tools/doclets/ 1.88 + com/sun/tools/doclets/ 1.89 1.90 doclets.tests = \ 1.91 - com/sun/javadoc/ 1.92 + com/sun/javadoc/ 1.93 + 1.94 +# 1.95 1.96 javah.includes = \ 1.97 - com/sun/tools/javah/ 1.98 + com/sun/tools/javah/ 1.99 1.100 javah.tests = \ 1.101 - tools/javah/ 1.102 + tools/javah/ 1.103 + 1.104 +# 1.105 1.106 javap.includes = \ 1.107 - com/sun/tools/classfile/ \ 1.108 - com/sun/tools/javap/ \ 1.109 - sun/tools/javap/ 1.110 + com/sun/tools/classfile/ \ 1.111 + com/sun/tools/javap/ \ 1.112 + sun/tools/javap/ 1.113 1.114 javap.tests = \ 1.115 - tools/javap/ 1.116 + tools/javap/ 1.117 + 1.118 +# 1.119 1.120 apt.includes = \ 1.121 - com/sun/mirror/ \ 1.122 - com/sun/tools/apt/ 1.123 + com/sun/mirror/ \ 1.124 + com/sun/tools/apt/ 1.125 1.126 apt.tests = \ 1.127 - tools/apt/ 1.128 - 1.129 + tools/apt/ 1.130 1.131 +# 1.132 + 1.133 +# The following value is used by the main jtreg target. 1.134 +# An empty value means all tests 1.135 +# Override as desired to run a specific set of tests 1.136 +jtreg.tests =
2.1 --- a/make/build.xml Thu Aug 20 11:20:31 2009 -0700 2.2 +++ b/make/build.xml Mon Aug 24 22:28:37 2009 -0700 2.3 @@ -31,7 +31,7 @@ 2.4 --> 2.5 2.6 <project name="langtools" default="build" basedir=".."> 2.7 - 2.8 + 2.9 <!-- Force full debuginfo for javac if the debug.classfiles 2.10 property is set. This must be BEFORE the include of 2.11 build.properties because it sets javac.debuglevel. --> 2.12 @@ -49,8 +49,8 @@ 2.13 2.14 <!-- Use this location for customizations common to all OpenJDK workspaces --> 2.15 <property file="${user.home}/.openjdk/build.properties"/> 2.16 - 2.17 - <!-- Convenient shorthands for standard locations within the workspace. --> 2.18 + 2.19 + <!-- Convenient shorthands for standard locations within the workspace. --> 2.20 <property name="build.dir" location="build"/> 2.21 <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/> 2.22 <property name="build.coverage.dir" location="${build.dir}/coverage"/> 2.23 @@ -75,15 +75,25 @@ 2.24 The best file to check for across Solaris/Linux/Windows/MacOS is one of the 2.25 executables; regrettably, that is OS-specific. --> 2.26 <condition property="java.marker" value="bin/java"> 2.27 - <os family="unix"/> 2.28 + <os family="unix"/> 2.29 </condition> 2.30 <condition property="java.marker" value="bin/java.exe"> 2.31 - <os family="windows"/> 2.32 + <os family="windows"/> 2.33 </condition> 2.34 - 2.35 + 2.36 <!-- Standard property values, if not overriden by earlier settings. --> 2.37 - <property file="${make.dir}/build.properties"/> 2.38 - 2.39 + <property file="${make.dir}/build.properties"/> 2.40 + 2.41 + <!-- launcher.java is used in the launcher scripts provided to run 2.42 + the tools' jar files. If it has not already been set, then 2.43 + default it to use ${target.java.home}, if available, otherwise 2.44 + quietly default to simply use "java". --> 2.45 + <condition property="launcher.java" 2.46 + value="${target.java.home}/bin/java" else="java"> 2.47 + <isset property="target.java.home"/> 2.48 + </condition> 2.49 + 2.50 + 2.51 <!-- Standard target to build deliverables for JDK build. --> 2.52 2.53 <target name="build" depends="build-bootstrap-tools,build-all-classes"> 2.54 @@ -97,13 +107,13 @@ 2.55 <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/> 2.56 <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/> 2.57 </target> 2.58 - 2.59 + 2.60 <target name="build-bootstrap-tools" depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"/> 2.61 - 2.62 + 2.63 <target name="build-all-tools" depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"/> 2.64 - 2.65 + 2.66 <target name="build-all-classes" depends="build-classes-javac,build-classes-javadoc,build-classes-doclets,build-classes-javah,build-classes-javap,build-classes-apt"/> 2.67 - 2.68 + 2.69 <!-- clean --> 2.70 2.71 <target name="clean" description="Delete all generated files"> 2.72 @@ -112,13 +122,11 @@ 2.73 </target> 2.74 2.75 <!-- Additional targets for running tools on the build --> 2.76 - 2.77 - <!-- An alternative for the following would be to do a single jtreg run for all tests. 2.78 - However, that would currently be slower, since we would have to run all the tests 2.79 - with samevm="false", since not all test directories currently support samevm="true". --> 2.80 2.81 - <target name="jtreg" depends="jtreg-javac,jtreg-javadoc,jtreg-doclets,jtreg-javah,jtreg-javap,jtreg-apt"/> 2.82 - 2.83 + <target name="jtreg" depends="build-all-tools,-def-jtreg"> 2.84 + <jtreg-tool name="all" tests="${jtreg.tests}"/> 2.85 + </target> 2.86 + 2.87 <target name="findbugs" depends="-def-findbugs,build-all-tools"> 2.88 <property name="findbugs.reportLevel" value="medium"/> 2.89 <mkdir dir="${dist.findbugs.dir}"/> 2.90 @@ -160,52 +168,52 @@ 2.91 <delete file="${build.coverage.dir}/cobertura.ser"/> 2.92 <cobertura-instrument todir="${build.coverage.dir}/classes" 2.93 datafile="${build.coverage.dir}/cobertura.ser"> 2.94 - <fileset dir="${build.classes.dir}" 2.95 + <fileset dir="${build.classes.dir}" 2.96 includes="**/*.class" excludes="**/resources/*.class"/> 2.97 </cobertura-instrument> 2.98 - </target> 2.99 + </target> 2.100 2.101 <target name="coverage-report" depends="-def-cobertura"> 2.102 <mkdir dir="${dist.coverage.dir}"/> 2.103 - <cobertura-report 2.104 + <cobertura-report 2.105 srcdir="${src.classes.dir}" 2.106 destdir="${dist.coverage.dir}" 2.107 datafile="${build.coverage.dir}/cobertura.ser"/> 2.108 - <cobertura-report 2.109 - format="xml" 2.110 - srcdir="${src.classes.dir}" 2.111 + <cobertura-report 2.112 + format="xml" 2.113 + srcdir="${src.classes.dir}" 2.114 destdir="${dist.coverage.dir}" 2.115 datafile="${build.coverage.dir}/cobertura.ser"/> 2.116 </target> 2.117 - 2.118 + 2.119 <!-- javac targets --> 2.120 2.121 <target name="build-bootstrap-javac" depends="-def-build-bootstrap-tool"> 2.122 <build-bootstrap-tool name="javac" includes="${javac.includes}"/> 2.123 </target> 2.124 - 2.125 + 2.126 <target name="build-classes-javac" depends="build-bootstrap-javac"> 2.127 <build-classes name="javac" includes="${javac.includes}"/> 2.128 </target> 2.129 - 2.130 + 2.131 <target name="build-javac" depends="build-bootstrap-javac"> 2.132 <build-tool name="javac" includes="${javac.includes}"/> 2.133 </target> 2.134 - 2.135 + 2.136 <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool"> 2.137 <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls3.option}"/> 2.138 </target> 2.139 - 2.140 + 2.141 <target name="jtreg-javac" depends="build-javac,-def-jtreg"> 2.142 - <jtreg-tool name="javac" samevm="true" tests="${javac.tests}"/> 2.143 + <jtreg-tool name="javac" tests="${javac.tests}"/> 2.144 </target> 2.145 - 2.146 + 2.147 <target name="findbugs-javac" depends="build-javac,-def-findbugs"> 2.148 <findbugs-tool name="javac"/> 2.149 </target> 2.150 - 2.151 + 2.152 <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/> 2.153 - 2.154 + 2.155 <!-- javadoc targets --> 2.156 2.157 <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac"> 2.158 @@ -213,31 +221,31 @@ 2.159 includes="${javadoc.includes}" 2.160 jarclasspath="javac.jar doclets.jar"/> 2.161 </target> 2.162 - 2.163 + 2.164 <target name="build-classes-javadoc" depends="build-classes-javac"> 2.165 <build-classes name="javadoc" includes="${javadoc.includes}"/> 2.166 </target> 2.167 - 2.168 + 2.169 <target name="build-javadoc" depends="build-javac"> 2.170 <build-tool name="javadoc" 2.171 includes="${javadoc.includes}" 2.172 jarclasspath="javac.jar doclets.jar"/> 2.173 </target> 2.174 - 2.175 + 2.176 <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool"> 2.177 <javadoc-tool name="javadoc" includes="${javadoc.includes}"/> 2.178 </target> 2.179 - 2.180 + 2.181 <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg"> 2.182 - <jtreg-tool name="javadoc" samevm="false" tests="${javadoc.tests}"/> 2.183 + <jtreg-tool name="javadoc" tests="${javadoc.tests}"/> 2.184 </target> 2.185 - 2.186 + 2.187 <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs"> 2.188 <findbugs-tool name="javadoc"/> 2.189 </target> 2.190 - 2.191 + 2.192 <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/> 2.193 - 2.194 + 2.195 <!-- doclets targets --> 2.196 2.197 <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar"> 2.198 @@ -246,11 +254,11 @@ 2.199 jarmainclass="com.sun.tools.javadoc.Main" 2.200 jarclasspath="javadoc.jar"/> 2.201 </target> 2.202 - 2.203 + 2.204 <target name="build-classes-doclets" depends="build-classes-javadoc"> 2.205 <build-classes name="doclets" includes="${doclets.includes}"/> 2.206 </target> 2.207 - 2.208 + 2.209 <target name="build-doclets" depends="build-javadoc"> 2.210 <!-- just jar, no bin for doclets --> 2.211 <build-jar name="doclets" 2.212 @@ -259,17 +267,17 @@ 2.213 </target> 2.214 2.215 <!-- (no javadoc for doclets) --> 2.216 - 2.217 + 2.218 <target name="jtreg-doclets" depends="build-doclets,-def-jtreg"> 2.219 - <jtreg-tool name="doclets" samevm="false" tests="${doclets.tests}"/> 2.220 + <jtreg-tool name="doclets" tests="${doclets.tests}"/> 2.221 </target> 2.222 - 2.223 + 2.224 <target name="findbugs-doclets" depends="build-doclets,-def-findbugs"> 2.225 <findbugs-tool name="doclets"/> 2.226 </target> 2.227 - 2.228 + 2.229 <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/> 2.230 - 2.231 + 2.232 <!-- javah targets --> 2.233 2.234 <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc"> 2.235 @@ -277,29 +285,29 @@ 2.236 includes="${javah.includes}" 2.237 jarclasspath="javadoc.jar doclets.jar javac.jar"/> 2.238 </target> 2.239 - 2.240 + 2.241 <target name="build-javah" depends="build-javadoc"> 2.242 <build-tool name="javah" 2.243 includes="${javah.includes}" 2.244 jarclasspath="javadoc.jar doclets.jar javac.jar"/> 2.245 </target> 2.246 - 2.247 + 2.248 <target name="build-classes-javah" depends="build-classes-javadoc"> 2.249 <build-classes name="javah" includes="${javah.includes}"/> 2.250 </target> 2.251 - 2.252 + 2.253 <!-- (no javadoc for javah) --> 2.254 2.255 <target name="jtreg-javah" depends="build-javah,-def-jtreg"> 2.256 - <jtreg-tool name="javah" samevm="true" tests="${javah.tests}"/> 2.257 + <jtreg-tool name="javah" tests="${javah.tests}"/> 2.258 </target> 2.259 - 2.260 + 2.261 <target name="findbugs-javah" depends="build-javah,-def-findbugs"> 2.262 <findbugs-tool name="javah"/> 2.263 </target> 2.264 - 2.265 + 2.266 <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/> 2.267 - 2.268 + 2.269 <!-- javap targets --> 2.270 2.271 <target name="build-bootstrap-javap" depends="-def-build-bootstrap-tool"> 2.272 @@ -307,85 +315,85 @@ 2.273 includes="${javap.includes}" 2.274 jarmainclass="sun.tools.javap.Main"/> 2.275 </target> 2.276 - 2.277 + 2.278 <target name="build-classes-javap" depends="build-classes-javac"> 2.279 <build-classes name="javap" includes="${javap.includes}"/> 2.280 </target> 2.281 - 2.282 + 2.283 <target name="build-javap" depends="build-javac"> 2.284 <build-tool name="javap" 2.285 includes="${javap.includes}" 2.286 jarmainclass="com.sun.tools.javap.Main" 2.287 jarclasspath="javac.jar"/> 2.288 </target> 2.289 - 2.290 + 2.291 <!-- (no javadoc for javap) --> 2.292 2.293 <target name="jtreg-javap" depends="build-javap,-def-jtreg"> 2.294 - <jtreg-tool name="javap" samevm="true" tests="${javap.tests}"/> 2.295 + <jtreg-tool name="javap" tests="${javap.tests}"/> 2.296 </target> 2.297 - 2.298 + 2.299 <target name="findbugs-javap" depends="build-javap,-def-findbugs"> 2.300 <findbugs-tool name="javap"/> 2.301 </target> 2.302 - 2.303 + 2.304 <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/> 2.305 - 2.306 + 2.307 <!-- apt targets --> 2.308 - 2.309 + 2.310 <target name="build-bootstrap-apt" depends="build-bootstrap-javac"> 2.311 <build-bootstrap-tool name="apt" 2.312 includes="${apt.includes}" 2.313 jarclasspath="javac.jar"/> 2.314 </target> 2.315 - 2.316 + 2.317 <target name="build-apt" depends="build-javac"> 2.318 <build-tool name="apt" 2.319 includes="${apt.includes}" 2.320 jarclasspath="javac.jar"/> 2.321 </target> 2.322 - 2.323 + 2.324 <target name="build-classes-apt" depends="build-classes-javac"> 2.325 <build-classes name="apt" includes="${apt.includes}"/> 2.326 </target> 2.327 - 2.328 + 2.329 <target name="javadoc-apt" depends="build-apt,-def-javadoc-tool"> 2.330 <javadoc-tool name="apt" includes="${apt.includes}"/> 2.331 </target> 2.332 - 2.333 - 2.334 + 2.335 + 2.336 <target name="jtreg-apt" depends="build-apt,-def-jtreg"> 2.337 - <jtreg-tool name="apt" samevm="true" tests="${apt.tests}"/> 2.338 + <jtreg-tool name="apt" tests="${apt.tests}"/> 2.339 </target> 2.340 - 2.341 + 2.342 <target name="findbugs-apt" depends="build-apt,-def-findbugs"> 2.343 <findbugs-tool name="apt"/> 2.344 </target> 2.345 - 2.346 + 2.347 <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/> 2.348 2.349 <!-- Check targets --> 2.350 - 2.351 + 2.352 <target name="-check-boot.java.home" depends="-def-check"> 2.353 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/> 2.354 </target> 2.355 - 2.356 + 2.357 <target name="-check-target.java.home" depends="-def-check"> 2.358 <check name="target java" property="target.java.home" marker="${java.marker}"/> 2.359 </target> 2.360 - 2.361 + 2.362 <target name="-check-cobertura.home" depends="-def-check"> 2.363 <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/> 2.364 </target> 2.365 - 2.366 + 2.367 <target name="-check-findbugs.home" depends="-def-check"> 2.368 <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/> 2.369 </target> 2.370 - 2.371 + 2.372 <target name="-check-jtreg.home" depends="-def-check"> 2.373 <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/> 2.374 </target> 2.375 - 2.376 + 2.377 <!-- Ant macro and preset defs --> 2.378 2.379 <target name="-def-build-tool" depends="-def-build-jar"> 2.380 @@ -397,7 +405,7 @@ 2.381 <attribute name="classes.dir" default="${build.classes.dir}"/> 2.382 <attribute name="gensrc.dir" default="${build.gensrc.dir}"/> 2.383 <attribute name="lib.dir" default="${dist.lib.dir}"/> 2.384 - <attribute name="java" default="java"/> 2.385 + <attribute name="java" default="${launcher.java}"/> 2.386 <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/> 2.387 <attribute name="javac.java.home" default="${boot.java.home}"/> 2.388 <attribute name="javac.source" default="${javac.source}"/> 2.389 @@ -425,8 +433,8 @@ 2.390 <mkdir dir="@{bin.dir}"/> 2.391 <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}"> 2.392 <filterset begintoken="#" endtoken="#"> 2.393 - <filter token="PROGRAM" value="@{name}"/> 2.394 - <filter token="TARGET_JAVA" value="@{java}"/> 2.395 + <filter token="PROGRAM" value="@{name}"/> 2.396 + <filter token="TARGET_JAVA" value="@{java}"/> 2.397 </filterset> 2.398 </copy> 2.399 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/> 2.400 @@ -467,7 +475,7 @@ 2.401 <jar destfile="@{lib.dir}/@{name}.jar" 2.402 basedir="@{classes.dir}" 2.403 includes="@{includes}"> 2.404 - <manifest> 2.405 + <manifest> 2.406 <attribute name="Main-Class" value="@{jarmainclass}"/> 2.407 <attribute name="Class-Path" value="@{jarclasspath}"/> 2.408 </manifest> 2.409 @@ -530,7 +538,7 @@ 2.410 includeAntRuntime="no" 2.411 source="@{javac.source}" 2.412 target="@{javac.target}" 2.413 - debug="${javac.debug}" 2.414 + debug="${javac.debug}" 2.415 debuglevel="${javac.debuglevel}"> 2.416 <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/> 2.417 <compilerarg value="-Xbootclasspath/p:@{classes.dir}"/> 2.418 @@ -539,7 +547,7 @@ 2.419 <compilerarg line="${javac.lint.opts}"/> 2.420 </javac> 2.421 <copy todir="@{classes.dir}"> 2.422 - <fileset dir="${src.classes.dir}"> 2.423 + <fileset dir="${src.classes.dir}"> 2.424 <include name="@{includes}"/> 2.425 <exclude name="**/*.java"/> 2.426 <exclude name="**/*.properties"/> 2.427 @@ -550,7 +558,7 @@ 2.428 </sequential> 2.429 </macrodef> 2.430 </target> 2.431 - 2.432 + 2.433 <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool"> 2.434 <presetdef name="build-bootstrap-tool"> 2.435 <build-tool 2.436 @@ -566,7 +574,7 @@ 2.437 full.version="${bootstrap.full.version}"/> 2.438 </presetdef> 2.439 </target> 2.440 - 2.441 + 2.442 <target name="-def-build-bootstrap-jar" depends="-def-build-jar"> 2.443 <presetdef name="build-bootstrap-jar"> 2.444 <build-jar 2.445 @@ -580,19 +588,21 @@ 2.446 full.version="${bootstrap.full.version}"/> 2.447 </presetdef> 2.448 </target> 2.449 - 2.450 + 2.451 <target name="-def-pcompile"> 2.452 <mkdir dir="${build.toolclasses.dir}"/> 2.453 <javac fork="true" 2.454 + source="${boot.javac.source}" 2.455 + target="${boot.javac.target}" 2.456 executable="${boot.java.home}/bin/javac" 2.457 srcdir="${make.tools.dir}/CompileProperties" 2.458 destdir="${build.toolclasses.dir}/" 2.459 classpath="${ant.home}/lib/ant.jar"/> 2.460 <taskdef name="pcompile" 2.461 - classname="CompilePropertiesTask" 2.462 + classname="CompilePropertiesTask" 2.463 classpath="${build.toolclasses.dir}/"/> 2.464 </target> 2.465 - 2.466 + 2.467 <target name="-def-javadoc-tool" depends="-check-target.java.home"> 2.468 <macrodef name="javadoc-tool"> 2.469 <attribute name="name"/> 2.470 @@ -604,14 +614,14 @@ 2.471 <!-- Note: even with this default value, includes 2.472 from src.classes.dir get javadoc'd; see packageset below --> 2.473 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> 2.474 - <javadoc 2.475 + <javadoc 2.476 executable="${target.java.home}/bin/javadoc" 2.477 - destdir="${build.javadoc.dir}/@{name}" 2.478 + destdir="${build.javadoc.dir}/@{name}" 2.479 source="@{source}" 2.480 - windowtitle="UNOFFICIAL" 2.481 - failonerror="true" 2.482 + windowtitle="UNOFFICIAL" 2.483 + failonerror="true" 2.484 use="true" 2.485 - author="false" 2.486 + author="false" 2.487 version="false" 2.488 packagenames="${javadoc.packagenames}" > 2.489 <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header> 2.490 @@ -640,8 +650,8 @@ 2.491 </sequential> 2.492 </macrodef> 2.493 </target> 2.494 - 2.495 - <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home"> 2.496 + 2.497 + <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home"> 2.498 <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant"> 2.499 <classpath> 2.500 <pathelement location="${jtreg.home}/lib/jtreg.jar"/> 2.501 @@ -652,7 +662,7 @@ 2.502 <attribute name="name"/> 2.503 <attribute name="tests"/> 2.504 <attribute name="jdk" default="${target.java.home}"/> 2.505 - <attribute name="samevm" default="false"/> 2.506 + <attribute name="samevm" default="true"/> 2.507 <attribute name="verbose" default="summary"/> 2.508 <attribute name="options" default=""/> 2.509 <attribute name="keywords" default="-keywords:!ignore"/> 2.510 @@ -660,9 +670,9 @@ 2.511 <sequential> 2.512 <property name="coverage.options" value=""/> <!-- default --> 2.513 <property name="coverage.classpath" value=""/> <!-- default --> 2.514 - <jtreg 2.515 + <jtreg 2.516 dir="${test.dir}" 2.517 - workDir="${build.jtreg.dir}/@{name}/work" 2.518 + workDir="${build.jtreg.dir}/@{name}/work" 2.519 reportDir="${build.jtreg.dir}/@{name}/report" 2.520 jdk="@{jdk}" 2.521 samevm="@{samevm}" verbose="@{verbose}" 2.522 @@ -673,7 +683,7 @@ 2.523 <arg line="@{options}"/> 2.524 <arg line="@{tests}"/> 2.525 </jtreg> 2.526 - <!-- the next two properties are for convenience, when only 2.527 + <!-- the next two properties are for convenience, when only 2.528 a single instance of jtreg will be invoked. --> 2.529 <condition property="jtreg.passed"> 2.530 <equals arg1="${jtreg.@{name}.result}" arg2="0"/> 2.531 @@ -691,9 +701,9 @@ 2.532 <include name="lib/**/*.jar"/> 2.533 </fileset> 2.534 </path> 2.535 - <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/> 2.536 + <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/> 2.537 </target> 2.538 - 2.539 + 2.540 <target name="-def-findbugs" unless="findbugs.defined" depends="-check-findbugs.home"> 2.541 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"> 2.542 <classpath> 2.543 @@ -706,7 +716,7 @@ 2.544 <attribute name="outputFile" default=""/> 2.545 <attribute name="reportLevel" default="high"/> 2.546 <sequential> 2.547 - <findbugs 2.548 + <findbugs 2.549 home="${findbugs.home}" 2.550 output="@{output}" 2.551 outputFile="@{outputFile}" 2.552 @@ -727,7 +737,7 @@ 2.553 </macrodef> 2.554 <property name="findbugs.defined" value="true"/> 2.555 </target> 2.556 - 2.557 + 2.558 <target name="-def-check"> 2.559 <macrodef name="check"> 2.560 <attribute name="name"/> 2.561 @@ -753,7 +763,7 @@ 2.562 </target> 2.563 2.564 <!-- standard JDK target --> 2.565 - <target name="sanity" 2.566 + <target name="sanity" 2.567 description="display settings of congiguration values"> 2.568 <echo level="info">ant.home = ${ant.home}</echo> 2.569 <echo level="info">boot.java.home = ${boot.java.home}</echo> 2.570 @@ -769,15 +779,15 @@ 2.571 2.572 <target name="post-sanity" depends="-def-jtreg,sanity,build" 2.573 description="perform basic validation after a standard build"> 2.574 - <jtreg 2.575 + <jtreg 2.576 dir="make/test" 2.577 - workDir="${build.jtreg.dir}/post-sanity/work" 2.578 + workDir="${build.jtreg.dir}/post-sanity/work" 2.579 reportDir="${build.jtreg.dir}/post-sanity/report" 2.580 jdk="${target.java.home}" 2.581 verbose="summary" 2.582 failonerror="false" resultproperty="jtreg.post-sanity.result"> 2.583 </jtreg> 2.584 - 2.585 + 2.586 </target> 2.587 </project> 2.588
3.1 --- a/src/share/bin/launcher.sh-template Thu Aug 20 11:20:31 2009 -0700 3.2 +++ b/src/share/bin/launcher.sh-template Mon Aug 24 22:28:37 2009 -0700 3.3 @@ -45,7 +45,7 @@ 3.4 fi 3.5 3.6 # tools currently assumes that assertions are enabled in the launcher 3.7 -ea=-ea:com.sun.tools 3.8 +ea=-ea:com.sun.tools... 3.9 3.10 # Any parameters starting with -J are passed to the JVM. 3.11 # All other parameters become parameters of #PROGRAM#.
4.1 --- a/src/share/classes/com/sun/tools/javac/code/Lint.java Thu Aug 20 11:20:31 2009 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Lint.java Mon Aug 24 22:28:37 2009 -0700 4.3 @@ -193,10 +193,20 @@ 4.4 /** 4.5 * Warn about unchecked operations on raw types. 4.6 */ 4.7 - RAW("rawtypes"); 4.8 + RAW("rawtypes"), 4.9 + 4.10 + /** 4.11 + * Warn about Sun proprietary API that may be removed in a future release. 4.12 + */ 4.13 + SUNAPI("sunapi", true); 4.14 4.15 LintCategory(String option) { 4.16 + this(option, false); 4.17 + } 4.18 + 4.19 + LintCategory(String option, boolean hidden) { 4.20 this.option = option; 4.21 + this.hidden = hidden; 4.22 map.put(option, this); 4.23 } 4.24 4.25 @@ -205,6 +215,7 @@ 4.26 } 4.27 4.28 public final String option; 4.29 + public final boolean hidden; 4.30 }; 4.31 4.32 /**
5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Aug 20 11:20:31 2009 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Aug 24 22:28:37 2009 -0700 5.3 @@ -119,6 +119,7 @@ 5.4 options.get("-relax") != null); 5.5 useBeforeDeclarationWarning = options.get("useBeforeDeclarationWarning") != null; 5.6 allowInvokedynamic = options.get("invokedynamic") != null; 5.7 + enableSunApiLintControl = options.get("enableSunApiLintControl") != null; 5.8 } 5.9 5.10 /** Switch: relax some constraints for retrofit mode. 5.11 @@ -160,6 +161,12 @@ 5.12 */ 5.13 boolean useBeforeDeclarationWarning; 5.14 5.15 + /** 5.16 + * Switch: allow lint infrastructure to control Sun proprietary 5.17 + * API warnings. 5.18 + */ 5.19 + boolean enableSunApiLintControl; 5.20 + 5.21 /** Check kind and type of given tree against protokind and prototype. 5.22 * If check succeeds, store type in tree and return it. 5.23 * If check fails, store errType in tree and return it. 5.24 @@ -2215,8 +2222,12 @@ 5.25 sym.outermostClass() != env.info.scope.owner.outermostClass()) 5.26 chk.warnDeprecated(tree.pos(), sym); 5.27 5.28 - if ((sym.flags() & PROPRIETARY) != 0) 5.29 - log.strictWarning(tree.pos(), "sun.proprietary", sym); 5.30 + if ((sym.flags() & PROPRIETARY) != 0) { 5.31 + if (enableSunApiLintControl) 5.32 + chk.warnSunApi(tree.pos(), "sun.proprietary", sym); 5.33 + else 5.34 + log.strictWarning(tree.pos(), "sun.proprietary", sym); 5.35 + } 5.36 5.37 // Test (3): if symbol is a variable, check that its type and 5.38 // kind are compatible with the prototype and protokind.
6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Aug 20 11:20:31 2009 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Aug 24 22:28:37 2009 -0700 6.3 @@ -104,12 +104,15 @@ 6.4 6.5 boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION); 6.6 boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED); 6.7 + boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI); 6.8 boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings(); 6.9 6.10 deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated, 6.11 enforceMandatoryWarnings, "deprecated"); 6.12 uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked, 6.13 enforceMandatoryWarnings, "unchecked"); 6.14 + sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi, 6.15 + enforceMandatoryWarnings, "sunapi"); 6.16 } 6.17 6.18 /** Switch: generics enabled? 6.19 @@ -137,6 +140,9 @@ 6.20 */ 6.21 private MandatoryWarningHandler uncheckedHandler; 6.22 6.23 + /** A handler for messages about using Sun proprietary API. 6.24 + */ 6.25 + private MandatoryWarningHandler sunApiHandler; 6.26 6.27 /* ************************************************************************* 6.28 * Errors and Warnings 6.29 @@ -166,12 +172,22 @@ 6.30 uncheckedHandler.report(pos, msg, args); 6.31 } 6.32 6.33 + /** Warn about using Sun proprietary API. 6.34 + * @param pos Position to be used for error reporting. 6.35 + * @param msg A string describing the problem. 6.36 + */ 6.37 + public void warnSunApi(DiagnosticPosition pos, String msg, Object... args) { 6.38 + if (!lint.isSuppressed(LintCategory.SUNAPI)) 6.39 + sunApiHandler.report(pos, msg, args); 6.40 + } 6.41 + 6.42 /** 6.43 * Report any deferred diagnostics. 6.44 */ 6.45 public void reportDeferredDiagnostics() { 6.46 deprecationHandler.reportDeferredDiagnostic(); 6.47 uncheckedHandler.reportDeferredDiagnostic(); 6.48 + sunApiHandler.reportDeferredDiagnostic(); 6.49 } 6.50 6.51
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/src/share/classes/com/sun/tools/javac/file/CloseableURLClassLoader.java Mon Aug 24 22:28:37 2009 -0700 7.3 @@ -0,0 +1,105 @@ 7.4 +/* 7.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. Sun designates this 7.11 + * particular file as subject to the "Classpath" exception as provided 7.12 + * by Sun in the LICENSE file that accompanied this code. 7.13 + * 7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.17 + * version 2 for more details (a copy is included in the LICENSE file that 7.18 + * accompanied this code). 7.19 + * 7.20 + * You should have received a copy of the GNU General Public License version 7.21 + * 2 along with this work; if not, write to the Free Software Foundation, 7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.23 + * 7.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 7.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 7.26 + * have any questions. 7.27 + */ 7.28 + 7.29 +package com.sun.tools.javac.file; 7.30 + 7.31 +import java.io.Closeable; 7.32 +import java.io.IOException; 7.33 +import java.lang.reflect.Field; 7.34 +import java.net.URL; 7.35 +import java.net.URLClassLoader; 7.36 +import java.util.ArrayList; 7.37 +import java.util.jar.JarFile; 7.38 + 7.39 +/** 7.40 + * A URLClassLoader that also implements Closeable. 7.41 + * Reflection is used to access internal data structures in the URLClassLoader, 7.42 + * since no public API exists for this purpose. Therefore this code is somewhat 7.43 + * fragile. Caveat emptor. 7.44 + * @throws Error if the internal data structures are not as expected. 7.45 + * 7.46 + * <p><b>This is NOT part of any API supported by Sun Microsystems. If 7.47 + * you write code that depends on this, you do so at your own risk. 7.48 + * This code and its internal interfaces are subject to change or 7.49 + * deletion without notice.</b> 7.50 + */ 7.51 +class CloseableURLClassLoader 7.52 + extends URLClassLoader implements Closeable { 7.53 + CloseableURLClassLoader(URL[] urls, ClassLoader parent) throws Error { 7.54 + super(urls, parent); 7.55 + try { 7.56 + getLoaders(); //proactive check that URLClassLoader is as expected 7.57 + } catch (Throwable t) { 7.58 + throw new Error("cannot create CloseableURLClassLoader", t); 7.59 + } 7.60 + } 7.61 + 7.62 + /** 7.63 + * Close any jar files that may have been opened by the class loader. 7.64 + * Reflection is used to access the jar files in the URLClassLoader's 7.65 + * internal data structures. 7.66 + * @throws java.io.IOException if the jar files cannot be found for any 7.67 + * reson, or if closing the jar file itself causes an IOException. 7.68 + */ 7.69 + public void close() throws IOException { 7.70 + try { 7.71 + for (Object l: getLoaders()) { 7.72 + if (l.getClass().getName().equals("sun.misc.URLClassPath$JarLoader")) { 7.73 + Field jarField = l.getClass().getDeclaredField("jar"); 7.74 + JarFile jar = (JarFile) getField(l, jarField); 7.75 + //System.err.println("CloseableURLClassLoader: closing " + jar); 7.76 + jar.close(); 7.77 + } 7.78 + } 7.79 + } catch (Throwable t) { 7.80 + IOException e = new IOException("cannot close class loader"); 7.81 + e.initCause(t); 7.82 + throw e; 7.83 + } 7.84 + } 7.85 + 7.86 + private ArrayList<?> getLoaders() 7.87 + throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException 7.88 + { 7.89 + Field ucpField = URLClassLoader.class.getDeclaredField("ucp"); 7.90 + Object urlClassPath = getField(this, ucpField); 7.91 + if (urlClassPath == null) 7.92 + throw new AssertionError("urlClassPath not set in URLClassLoader"); 7.93 + Field loadersField = urlClassPath.getClass().getDeclaredField("loaders"); 7.94 + return (ArrayList<?>) getField(urlClassPath, loadersField); 7.95 + } 7.96 + 7.97 + private Object getField(Object o, Field f) 7.98 + throws IllegalArgumentException, IllegalAccessException { 7.99 + boolean prev = f.isAccessible(); 7.100 + try { 7.101 + f.setAccessible(true); 7.102 + return f.get(o); 7.103 + } finally { 7.104 + f.setAccessible(prev); 7.105 + } 7.106 + } 7.107 + 7.108 +}
8.1 --- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Thu Aug 20 11:20:31 2009 -0700 8.2 +++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Mon Aug 24 22:28:37 2009 -0700 8.3 @@ -33,6 +33,7 @@ 8.4 import java.io.InputStream; 8.5 import java.io.OutputStreamWriter; 8.6 import java.lang.ref.SoftReference; 8.7 +import java.lang.reflect.Constructor; 8.8 import java.net.MalformedURLException; 8.9 import java.net.URI; 8.10 import java.net.URL; 8.11 @@ -76,6 +77,7 @@ 8.12 import com.sun.tools.javac.util.Log; 8.13 import com.sun.tools.javac.util.Options; 8.14 8.15 +import java.io.Closeable; 8.16 import static javax.tools.StandardLocation.*; 8.17 import static com.sun.tools.javac.main.OptionName.*; 8.18 8.19 @@ -131,6 +133,7 @@ 8.20 8.21 protected boolean mmappedIO; 8.22 protected boolean ignoreSymbolFile; 8.23 + protected String classLoaderClass; 8.24 8.25 /** 8.26 * User provided charset (through javax.tools). 8.27 @@ -180,6 +183,7 @@ 8.28 8.29 mmappedIO = options.get("mmappedIO") != null; 8.30 ignoreSymbolFile = options.get("ignore.symbol.file") != null; 8.31 + classLoaderClass = options.get("procloader"); 8.32 } 8.33 8.34 public JavaFileObject getFileForInput(String name) { 8.35 @@ -747,8 +751,40 @@ 8.36 throw new AssertionError(e); 8.37 } 8.38 } 8.39 - return new URLClassLoader(lb.toArray(new URL[lb.size()]), 8.40 - getClass().getClassLoader()); 8.41 + 8.42 + URL[] urls = lb.toArray(new URL[lb.size()]); 8.43 + ClassLoader thisClassLoader = getClass().getClassLoader(); 8.44 + 8.45 + // Bug: 6558476 8.46 + // Ideally, ClassLoader should be Closeable, but before JDK7 it is not. 8.47 + // On older versions, try the following, to get a closeable classloader. 8.48 + 8.49 + // 1: Allow client to specify the class to use via hidden option 8.50 + if (classLoaderClass != null) { 8.51 + try { 8.52 + Class<? extends ClassLoader> loader = 8.53 + Class.forName(classLoaderClass).asSubclass(ClassLoader.class); 8.54 + Class<?>[] constrArgTypes = { URL[].class, ClassLoader.class }; 8.55 + Constructor<? extends ClassLoader> constr = loader.getConstructor(constrArgTypes); 8.56 + return constr.newInstance(new Object[] { urls, thisClassLoader }); 8.57 + } catch (Throwable t) { 8.58 + // ignore errors loading user-provided class loader, fall through 8.59 + } 8.60 + } 8.61 + 8.62 + // 2: If URLClassLoader implements Closeable, use that. 8.63 + if (Closeable.class.isAssignableFrom(URLClassLoader.class)) 8.64 + return new URLClassLoader(urls, thisClassLoader); 8.65 + 8.66 + // 3: Try using private reflection-based CloseableURLClassLoader 8.67 + try { 8.68 + return new CloseableURLClassLoader(urls, thisClassLoader); 8.69 + } catch (Throwable t) { 8.70 + // ignore errors loading workaround class loader, fall through 8.71 + } 8.72 + 8.73 + // 4: If all else fails, use plain old standard URLClassLoader 8.74 + return new URLClassLoader(urls, thisClassLoader); 8.75 } 8.76 8.77 public Iterable<JavaFileObject> list(Location location,
9.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Aug 20 11:20:31 2009 -0700 9.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Mon Aug 24 22:28:37 2009 -0700 9.3 @@ -813,6 +813,9 @@ 9.4 } catch (Abort ex) { 9.5 if (devVerbose) 9.6 ex.printStackTrace(); 9.7 + } finally { 9.8 + if (procEnvImpl != null) 9.9 + procEnvImpl.close(); 9.10 } 9.11 } 9.12 9.13 @@ -936,7 +939,7 @@ 9.14 /** 9.15 * Object to handle annotation processing. 9.16 */ 9.17 - JavacProcessingEnvironment procEnvImpl = null; 9.18 + private JavacProcessingEnvironment procEnvImpl = null; 9.19 9.20 /** 9.21 * Check if we should process annotations. 9.22 @@ -947,7 +950,8 @@ 9.23 * @param processors user provided annotation processors to bypass 9.24 * discovery, {@code null} means that no processors were provided 9.25 */ 9.26 - public void initProcessAnnotations(Iterable<? extends Processor> processors) { 9.27 + public void initProcessAnnotations(Iterable<? extends Processor> processors) 9.28 + throws IOException { 9.29 // Process annotations if processing is not disabled and there 9.30 // is at least one Processor available. 9.31 Options options = Options.instance(context); 9.32 @@ -974,7 +978,8 @@ 9.33 } 9.34 9.35 // TODO: called by JavacTaskImpl 9.36 - public JavaCompiler processAnnotations(List<JCCompilationUnit> roots) throws IOException { 9.37 + public JavaCompiler processAnnotations(List<JCCompilationUnit> roots) 9.38 + throws IOException { 9.39 return processAnnotations(roots, List.<String>nil()); 9.40 } 9.41 9.42 @@ -1061,10 +1066,14 @@ 9.43 return this; 9.44 } 9.45 } 9.46 - JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols); 9.47 - if (c != this) 9.48 - annotationProcessingOccurred = c.annotationProcessingOccurred = true; 9.49 - return c; 9.50 + try { 9.51 + JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols); 9.52 + if (c != this) 9.53 + annotationProcessingOccurred = c.annotationProcessingOccurred = true; 9.54 + return c; 9.55 + } finally { 9.56 + procEnvImpl.close(); 9.57 + } 9.58 } catch (CompletionFailure ex) { 9.59 log.error("cant.access", ex.sym, ex.getDetailValue()); 9.60 return this;
10.1 --- a/src/share/classes/com/sun/tools/javac/main/JavacOption.java Thu Aug 20 11:20:31 2009 -0700 10.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavacOption.java Mon Aug 24 22:28:37 2009 -0700 10.3 @@ -25,11 +25,11 @@ 10.4 10.5 package com.sun.tools.javac.main; 10.6 10.7 +import java.io.PrintWriter; 10.8 +import java.util.LinkedHashMap; 10.9 +import java.util.Map; 10.10 import com.sun.tools.javac.util.Log; 10.11 import com.sun.tools.javac.util.Options; 10.12 -import java.io.PrintWriter; 10.13 -import java.util.Arrays; 10.14 -import java.util.Collection; 10.15 10.16 /** 10.17 * TODO: describe com.sun.tools.javac.main.JavacOption 10.18 @@ -106,9 +106,10 @@ 10.19 */ 10.20 ChoiceKind choiceKind; 10.21 10.22 - /** The choices for this option, if any. 10.23 + /** The choices for this option, if any, and whether or not the choices 10.24 + * are hidden 10.25 */ 10.26 - Collection<String> choices; 10.27 + Map<String,Boolean> choices; 10.28 10.29 Option(OptionName name, String argsNameKey, String descrKey) { 10.30 this.name = name; 10.31 @@ -123,10 +124,18 @@ 10.32 } 10.33 10.34 Option(OptionName name, String descrKey, ChoiceKind choiceKind, String... choices) { 10.35 - this(name, descrKey, choiceKind, Arrays.asList(choices)); 10.36 + this(name, descrKey, choiceKind, createChoices(choices)); 10.37 } 10.38 10.39 - Option(OptionName name, String descrKey, ChoiceKind choiceKind, Collection<String> choices) { 10.40 + private static Map<String,Boolean> createChoices(String... choices) { 10.41 + Map<String,Boolean> map = new LinkedHashMap<String,Boolean>(); 10.42 + for (String c: choices) 10.43 + map.put(c, true); 10.44 + return map; 10.45 + } 10.46 + 10.47 + Option(OptionName name, String descrKey, ChoiceKind choiceKind, 10.48 + Map<String,Boolean> choices) { 10.49 this(name, null, descrKey); 10.50 if (choiceKind == null || choices == null) 10.51 throw new NullPointerException(); 10.52 @@ -153,10 +162,10 @@ 10.53 if (choices != null) { 10.54 String arg = option.substring(name.optionName.length()); 10.55 if (choiceKind == ChoiceKind.ONEOF) 10.56 - return choices.contains(arg); 10.57 + return choices.keySet().contains(arg); 10.58 else { 10.59 for (String a: arg.split(",+")) { 10.60 - if (!choices.contains(a)) 10.61 + if (!choices.keySet().contains(a)) 10.62 return false; 10.63 } 10.64 } 10.65 @@ -181,10 +190,12 @@ 10.66 if (argsNameKey == null) { 10.67 if (choices != null) { 10.68 String sep = "{"; 10.69 - for (String c: choices) { 10.70 - sb.append(sep); 10.71 - sb.append(c); 10.72 - sep = ","; 10.73 + for (Map.Entry<String,Boolean> e: choices.entrySet()) { 10.74 + if (!e.getValue()) { 10.75 + sb.append(sep); 10.76 + sb.append(e.getKey()); 10.77 + sep = ","; 10.78 + } 10.79 } 10.80 sb.append("}"); 10.81 } 10.82 @@ -209,8 +220,8 @@ 10.83 if (choices != null) { 10.84 if (choiceKind == ChoiceKind.ONEOF) { 10.85 // some clients like to see just one of option+choice set 10.86 - for (String c: choices) 10.87 - options.remove(option + c); 10.88 + for (String s: choices.keySet()) 10.89 + options.remove(option + s); 10.90 String opt = option + arg; 10.91 options.put(opt, opt); 10.92 // some clients like to see option (without trailing ":") 10.93 @@ -256,7 +267,7 @@ 10.94 XOption(OptionName name, String descrKey, ChoiceKind kind, String... choices) { 10.95 super(name, descrKey, kind, choices); 10.96 } 10.97 - XOption(OptionName name, String descrKey, ChoiceKind kind, Collection<String> choices) { 10.98 + XOption(OptionName name, String descrKey, ChoiceKind kind, Map<String,Boolean> choices) { 10.99 super(name, descrKey, kind, choices); 10.100 } 10.101 @Override
11.1 --- a/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Thu Aug 20 11:20:31 2009 -0700 11.2 +++ b/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Mon Aug 24 22:28:37 2009 -0700 11.3 @@ -38,9 +38,9 @@ 11.4 import java.io.File; 11.5 import java.io.FileWriter; 11.6 import java.io.PrintWriter; 11.7 -import java.util.Collection; 11.8 import java.util.EnumSet; 11.9 -import java.util.LinkedHashSet; 11.10 +import java.util.LinkedHashMap; 11.11 +import java.util.Map; 11.12 import java.util.Set; 11.13 import javax.lang.model.SourceVersion; 11.14 11.15 @@ -598,14 +598,14 @@ 11.16 }; 11.17 } 11.18 11.19 - private static Collection<String> getXLintChoices() { 11.20 - Collection<String> choices = new LinkedHashSet<String>(); 11.21 - choices.add("all"); 11.22 + private static Map<String,Boolean> getXLintChoices() { 11.23 + Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>(); 11.24 + choices.put("all", false); 11.25 for (Lint.LintCategory c : Lint.LintCategory.values()) 11.26 - choices.add(c.option); 11.27 + choices.put(c.option, c.hidden); 11.28 for (Lint.LintCategory c : Lint.LintCategory.values()) 11.29 - choices.add("-" + c.option); 11.30 - choices.add("none"); 11.31 + choices.put("-" + c.option, c.hidden); 11.32 + choices.put("none", false); 11.33 return choices; 11.34 } 11.35
12.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Aug 20 11:20:31 2009 -0700 12.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Mon Aug 24 22:28:37 2009 -0700 12.3 @@ -136,6 +136,8 @@ 12.4 */ 12.5 Source source; 12.6 12.7 + private ClassLoader processorClassLoader; 12.8 + 12.9 /** 12.10 * JavacMessages object used for localization 12.11 */ 12.12 @@ -203,7 +205,7 @@ 12.13 JavaFileManager fileManager = context.get(JavaFileManager.class); 12.14 try { 12.15 // If processorpath is not explicitly set, use the classpath. 12.16 - ClassLoader processorCL = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) 12.17 + processorClassLoader = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) 12.18 ? fileManager.getClassLoader(ANNOTATION_PROCESSOR_PATH) 12.19 : fileManager.getClassLoader(CLASS_PATH); 12.20 12.21 @@ -213,9 +215,9 @@ 12.22 * provider mechanism to create the processor iterator. 12.23 */ 12.24 if (processorNames != null) { 12.25 - processorIterator = new NameProcessIterator(processorNames, processorCL, log); 12.26 + processorIterator = new NameProcessIterator(processorNames, processorClassLoader, log); 12.27 } else { 12.28 - processorIterator = new ServiceIterator(processorCL, log); 12.29 + processorIterator = new ServiceIterator(processorClassLoader, log); 12.30 } 12.31 } catch (SecurityException e) { 12.32 /* 12.33 @@ -1019,9 +1021,11 @@ 12.34 /** 12.35 * Free resources related to annotation processing. 12.36 */ 12.37 - public void close() { 12.38 + public void close() throws IOException { 12.39 filer.close(); 12.40 discoveredProcs = null; 12.41 + if (processorClassLoader != null && processorClassLoader instanceof Closeable) 12.42 + ((Closeable) processorClassLoader).close(); 12.43 } 12.44 12.45 private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) {
13.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Aug 20 11:20:31 2009 -0700 13.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Aug 24 22:28:37 2009 -0700 13.3 @@ -564,12 +564,6 @@ 13.4 compiler.note.deprecated.plural.additional=\ 13.5 Some input files additionally use or override a deprecated API. 13.6 13.7 -# Notes related to annotation processing 13.8 - 13.9 -# Print a client-generated note; assumed to be localized, no translation required 13.10 -compiler.note.proc.messager=\ 13.11 - {0} 13.12 - 13.13 compiler.note.unchecked.filename=\ 13.14 {0} uses unchecked or unsafe operations. 13.15 compiler.note.unchecked.plural=\ 13.16 @@ -584,6 +578,25 @@ 13.17 compiler.note.unchecked.plural.additional=\ 13.18 Some input files additionally use unchecked or unsafe operations. 13.19 13.20 +compiler.note.sunapi.filename=\ 13.21 + {0} uses Sun proprietary API that may be removed in a future release. 13.22 +compiler.note.sunapi.plural=\ 13.23 + Some input files use Sun proprietary API that may be removed in a future release. 13.24 +# The following string may appear after one of the above sunapi messages. 13.25 +compiler.note.sunapi.recompile=\ 13.26 + Recompile with -Xlint:sunapi for details. 13.27 + 13.28 +compiler.note.sunapi.filename.additional=\ 13.29 + {0} uses additional Sun proprietary API that may be removed in a future release. 13.30 +compiler.note.sunapi.plural.additional=\ 13.31 + Some input files additionally use Sun proprietary API that may be removed in a future release. 13.32 + 13.33 +# Notes related to annotation processing 13.34 + 13.35 +# Print a client-generated note; assumed to be localized, no translation required 13.36 +compiler.note.proc.messager=\ 13.37 + {0} 13.38 + 13.39 ##### 13.40 13.41 compiler.misc.count.error=\
14.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java Thu Aug 20 11:20:31 2009 -0700 14.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java Mon Aug 24 22:28:37 2009 -0700 14.3 @@ -78,6 +78,10 @@ 14.4 */ 14.5 public boolean emitWarnings; 14.6 14.7 + /** Switch: suppress note messages. 14.8 + */ 14.9 + public boolean suppressNotes; 14.10 + 14.11 /** Print stack trace on errors? 14.12 */ 14.13 public boolean dumpOnError; 14.14 @@ -121,6 +125,7 @@ 14.15 this.dumpOnError = options.get("-doe") != null; 14.16 this.promptOnError = options.get("-prompt") != null; 14.17 this.emitWarnings = options.get("-Xlint:none") == null; 14.18 + this.suppressNotes = options.get("suppressNotes") != null; 14.19 this.MaxErrors = getIntOption(options, "-Xmaxerrs", 100); 14.20 this.MaxWarnings = getIntOption(options, "-Xmaxwarns", 100); 14.21 14.22 @@ -324,7 +329,7 @@ 14.23 // Print out notes only when we are permitted to report warnings 14.24 // Notes are only generated at the end of a compilation, so should be small 14.25 // in number. 14.26 - if (emitWarnings || diagnostic.isMandatory()) { 14.27 + if ((emitWarnings || diagnostic.isMandatory()) && !suppressNotes) { 14.28 writeDiagnostic(diagnostic); 14.29 } 14.30 break;
15.1 --- a/src/share/classes/javax/tools/JavaCompiler.java Thu Aug 20 11:20:31 2009 -0700 15.2 +++ b/src/share/classes/javax/tools/JavaCompiler.java Mon Aug 24 22:28:37 2009 -0700 15.3 @@ -228,6 +228,12 @@ 15.4 * <p>If a file manager is provided, it must be able to handle all 15.5 * locations defined in {@link StandardLocation}. 15.6 * 15.7 + * <p>Note that annotation processing can process both the 15.8 + * compilation units of source code to be compiled, passed with 15.9 + * the {@code compilationUnits} parameter, as well as class 15.10 + * files, whose names are passed with the {@code classes} 15.11 + * parameter. 15.12 + * 15.13 * @param out a Writer for additional output from the compiler; 15.14 * use {@code System.err} if {@code null} 15.15 * @param fileManager a file manager; if {@code null} use the 15.16 @@ -236,8 +242,8 @@ 15.17 * null} use the compiler's default method for reporting 15.18 * diagnostics 15.19 * @param options compiler options, {@code null} means no options 15.20 - * @param classes class names (for annotation processing), {@code 15.21 - * null} means no class names 15.22 + * @param classes names of classes to be processed by annotation 15.23 + * processing, {@code null} means no class names 15.24 * @param compilationUnits the compilation units to compile, {@code 15.25 * null} means no compilation units 15.26 * @return an object representing the compilation
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/test/tools/javac/T6558476.java Mon Aug 24 22:28:37 2009 -0700 16.3 @@ -0,0 +1,101 @@ 16.4 +/* 16.5 + * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. 16.11 + * 16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 + * version 2 for more details (a copy is included in the LICENSE file that 16.16 + * accompanied this code). 16.17 + * 16.18 + * You should have received a copy of the GNU General Public License version 16.19 + * 2 along with this work; if not, write to the Free Software Foundation, 16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 + * 16.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 16.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 16.24 + * have any questions. 16.25 + */ 16.26 + 16.27 +/* 16.28 + * @test 16.29 + * @run main/othervm -Xmx512m -Xms512m T6558476 16.30 + */ 16.31 + 16.32 +import java.io.File; 16.33 +import java.io.FileInputStream; 16.34 +import java.io.FileOutputStream; 16.35 +import java.io.IOException; 16.36 +import java.util.Random; 16.37 + 16.38 +import com.sun.tools.javac.Main; 16.39 + 16.40 +public class T6558476 { 16.41 + private static File copyFileTo(File file, File directory) throws IOException { 16.42 + File newFile = new File(directory, file.getName()); 16.43 + FileInputStream fis = null; 16.44 + FileOutputStream fos = null; 16.45 + try { 16.46 + fis = new FileInputStream(file); 16.47 + fos = new FileOutputStream(newFile); 16.48 + byte buff[] = new byte[1024]; 16.49 + int val; 16.50 + while ((val = fis.read(buff)) > 0) 16.51 + fos.write(buff, 0, val); 16.52 + } finally { 16.53 + if (fis != null) 16.54 + fis.close(); 16.55 + if (fos != null) 16.56 + fos.close(); 16.57 + } 16.58 + return newFile; 16.59 + } 16.60 + 16.61 + private static String generateJavaClass(String className) { 16.62 + StringBuffer sb = new StringBuffer(); 16.63 + sb.append("import sun.net.spi.nameservice.dns.DNSNameService;\n"); 16.64 + sb.append("public class "); 16.65 + sb.append(className); 16.66 + sb.append(" {\n"); 16.67 + sb.append(" public void doStuff() {\n"); 16.68 + sb.append(" DNSNameService dns = null;\n"); 16.69 + sb.append(" }\n"); 16.70 + sb.append("}\n"); 16.71 + return sb.toString(); 16.72 + } 16.73 + 16.74 + public static void main(String[] args) throws IOException { 16.75 + File javaHomeDir = new File(System.getProperty("java.home")); 16.76 + File tmpDir = new File(System.getProperty("java.io.tmpdir")); 16.77 + File outputDir = new File(tmpDir, "outputDir" + new Random().nextInt(65536)); 16.78 + outputDir.mkdir(); 16.79 + outputDir.deleteOnExit(); 16.80 + 16.81 + File dnsjarfile = new File(javaHomeDir, "lib" + File.separator + "ext" + File.separator + "dnsns.jar"); 16.82 + File tmpJar = copyFileTo(dnsjarfile, outputDir); 16.83 + String className = "TheJavaFile"; 16.84 + File javaFile = new File(outputDir, className + ".java"); 16.85 + javaFile.deleteOnExit(); 16.86 + FileOutputStream fos = new FileOutputStream(javaFile); 16.87 + fos.write(generateJavaClass(className).getBytes()); 16.88 + fos.close(); 16.89 + 16.90 + int rc = Main.compile(new String[]{"-d", outputDir.getPath(), 16.91 + "-classpath", 16.92 + tmpJar.getPath(), 16.93 + javaFile.getAbsolutePath()}); 16.94 + if (rc != 0) { 16.95 + throw new Error("Couldn't compile the file (exit code=" + rc + ")"); 16.96 + } 16.97 + 16.98 + if (tmpJar.delete()) { 16.99 + System.out.println("jar file successfully deleted"); 16.100 + } else { 16.101 + throw new Error("Error deleting file \"" + tmpJar.getPath() + "\""); 16.102 + } 16.103 + } 16.104 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/test/tools/javac/T6873845.java Mon Aug 24 22:28:37 2009 -0700 17.3 @@ -0,0 +1,84 @@ 17.4 +import java.io.*; 17.5 +import java.util.*; 17.6 + 17.7 +import sun.misc.*; 17.8 + 17.9 +/* 17.10 + * @test /nodynamiccopyright/ 17.11 + * @bug 6873845 17.12 + * @summary refine access to symbol file 17.13 + */ 17.14 + 17.15 +public class T6873845 { 17.16 + public static void main(String... args) throws Exception { 17.17 + new T6873845().run(); 17.18 + } 17.19 + 17.20 + public void run() throws Exception { 17.21 + String out = compile(Arrays.asList("-XDrawDiagnostics", "-X")); 17.22 + if (out.contains("sunapi")) 17.23 + throw new Exception("unexpected output for -X"); 17.24 + 17.25 + String warn1 = "T6873845.java:72:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline; 17.26 + String warn2 = "T6873845.java:77:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline; 17.27 + String note1 = "- compiler.note.sunapi.filename: T6873845.java" + newline; 17.28 + String note2 = "- compiler.note.sunapi.recompile" + newline; 17.29 + 17.30 + test(opts(), 17.31 + warn1 + warn2 + "2 warnings" + newline); 17.32 + test(opts("-XDenableSunApiLintControl"), 17.33 + note1 + note2); 17.34 + test(opts("-XDenableSunApiLintControl", "-XDsuppressNotes"), 17.35 + ""); 17.36 + test(opts("-XDenableSunApiLintControl", "-Xlint:sunapi"), 17.37 + warn1 + "1 warning" + newline); 17.38 + test(opts("-XDenableSunApiLintControl", "-Xlint:all"), 17.39 + warn1 + "1 warning" + newline); 17.40 + test(opts("-XDenableSunApiLintControl", "-Xlint:all,-sunapi"), 17.41 + note1 + note2); 17.42 + } 17.43 + 17.44 + List<String> opts(String... opts) { 17.45 + return Arrays.asList(opts); 17.46 + } 17.47 + 17.48 + void test(List<String> opts, String expect) throws Exception { 17.49 + List<String> args = new ArrayList<String>(); 17.50 + args.addAll(opts); 17.51 + args.add("-d"); 17.52 + args.add(testClasses.getPath()); 17.53 + args.add(new File(testSrc, "T6873845.java").getPath()); 17.54 + compile(args); // to verify resource strings exist 17.55 + args.add(0, "-XDrawDiagnostics"); 17.56 + String out = compile(args); 17.57 + if (!out.equals(expect)) 17.58 + throw new Exception("unexpected output from compiler"); 17.59 + } 17.60 + 17.61 + String compile(List<String> args) throws Exception{ 17.62 + StringWriter sw = new StringWriter(); 17.63 + PrintWriter pw = new PrintWriter(sw); 17.64 + System.out.println("compile: " + args); 17.65 + int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), pw); 17.66 + pw.close(); 17.67 + String out = sw.toString(); 17.68 + System.out.println(out); 17.69 + if (rc != 0) 17.70 + throw new Exception("compilation failed unexpectedly"); 17.71 + return out; 17.72 + } 17.73 + 17.74 + void m1() { 17.75 + Unsafe.getUnsafe(); 17.76 + } 17.77 + 17.78 + @SuppressWarnings("sunapi") 17.79 + void m2() { 17.80 + Unsafe.getUnsafe(); 17.81 + } 17.82 + 17.83 + private File testSrc = new File(System.getProperty("test.src", ".")); 17.84 + private File testClasses = new File(System.getProperty("test.classes", ".")); 17.85 + private String newline = System.getProperty("line.separator"); 17.86 +} 17.87 +
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/test/tools/javac/T6873849.java Mon Aug 24 22:28:37 2009 -0700 18.3 @@ -0,0 +1,76 @@ 18.4 +/* 18.5 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. 18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 + * 18.8 + * This code is free software; you can redistribute it and/or modify it 18.9 + * under the terms of the GNU General Public License version 2 only, as 18.10 + * published by the Free Software Foundation. 18.11 + * 18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 + * version 2 for more details (a copy is included in the LICENSE file that 18.16 + * accompanied this code). 18.17 + * 18.18 + * You should have received a copy of the GNU General Public License version 18.19 + * 2 along with this work; if not, write to the Free Software Foundation, 18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 + * 18.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 18.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 18.24 + * have any questions. 18.25 + */ 18.26 + 18.27 +import java.io.File; 18.28 +import java.io.PrintWriter; 18.29 +import java.io.StringWriter; 18.30 +import java.util.ArrayList; 18.31 +import java.util.List; 18.32 + 18.33 +/* 18.34 + * @test 18.35 + * @bug 6873849 18.36 + * @summary suppress notes generated by javac 18.37 + */ 18.38 + 18.39 +public class T6873849 { 18.40 + public static void main(String... args) throws Exception { 18.41 + new T6873849().run(); 18.42 + } 18.43 + 18.44 + public void run() throws Exception { 18.45 + test(null, "- compiler.note.unchecked.filename: T6873849.java" + newline + 18.46 + "- compiler.note.unchecked.recompile" + newline); 18.47 + test("-XDsuppressNotes", ""); 18.48 + } 18.49 + 18.50 + void test(String opt, String expect) throws Exception { 18.51 + List<String> args = new ArrayList<String>(); 18.52 + if (opt != null) 18.53 + args.add(opt); 18.54 + args.add("-d"); 18.55 + args.add(testClasses.getPath()); 18.56 + args.add("-XDrawDiagnostics"); 18.57 + args.add(new File(testSrc, "T6873849.java").getPath()); 18.58 + StringWriter sw = new StringWriter(); 18.59 + PrintWriter pw = new PrintWriter(sw); 18.60 + System.err.println("compile: " + args); 18.61 + int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), pw); 18.62 + pw.close(); 18.63 + String out = sw.toString(); 18.64 + System.out.println(out); 18.65 + if (rc != 0) 18.66 + throw new Exception("compilation failed unexpectedly"); 18.67 + if (!out.equals(expect)) 18.68 + throw new Exception("unexpected output from compiler"); 18.69 + } 18.70 + 18.71 + void m(List t) { 18.72 + // force a note about unchecked usage 18.73 + t.add(new Object()); 18.74 + } 18.75 + 18.76 + private File testSrc = new File(System.getProperty("test.src", ".")); 18.77 + private File testClasses = new File(System.getProperty("test.classes", ".")); 18.78 + private String newline = System.getProperty("line.separator"); 18.79 +}
19.1 --- a/test/tools/javac/processing/model/testgetallmembers/Main.java Thu Aug 20 11:20:31 2009 -0700 19.2 +++ b/test/tools/javac/processing/model/testgetallmembers/Main.java Mon Aug 24 22:28:37 2009 -0700 19.3 @@ -95,7 +95,7 @@ 19.4 javac = null; 19.5 elements = null; 19.6 19.7 - javac = (JavacTask)tool.getTask(null, null, null, null, null, null); 19.8 + javac = (JavacTask)tool.getTask(null, fm, null, null, null, null); 19.9 elements = javac.getElements(); 19.10 19.11 for (String name : packages) {