| 96 | | <condition property="isJava10"><matches string="${ant.java.version}" pattern="1[0-9]" /></condition> |
| 97 | | <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]" /></condition> |
| 98 | | <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]" /></condition> |
| 99 | | <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]" /></condition> |
| 100 | | <condition property="isJava14"><matches string="${ant.java.version}" pattern="1[4-9]" /></condition> |
| 101 | | <condition property="isJava16"><matches string="${ant.java.version}" pattern="1[6-9]" /></condition> |
| 102 | | <condition property="isJava18"><matches string="${ant.java.version}" pattern="1[8-9]" /></condition> |
| | 96 | <condition property="isJava10"><matches string="${ant.java.version}" pattern="(1|2)[0-9]" /></condition> |
| | 97 | <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]|[2-9][0-9]" /></condition> |
| | 98 | <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]|[2-9][0-9]" /></condition> |
| | 99 | <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]|[2-9][0-9]" /></condition> |
| | 100 | <condition property="isJava14"><matches string="${ant.java.version}" pattern="1[4-9]|[2-9][0-9]" /></condition> |
| | 101 | <condition property="isJava16"><matches string="${ant.java.version}" pattern="1[6-9]|[2-9][0-9]" /></condition> |
| | 102 | <condition property="isJava18"><matches string="${ant.java.version}" pattern="1[8-9]|[2-9][0-9]" /></condition> |
| | 103 | <condition property="isJava19"><matches string="${ant.java.version}" pattern="19|[2-9][0-9]" /></condition> |
| | 104 | <condition property="isJava20"><matches string="${ant.java.version}" pattern="[2-9][0-9]" /></condition> |
| | 105 | <condition property="isJava21"><matches string="${ant.java.version}" pattern="2[1-9]|[3-9][0-9]" /></condition> |
| | 210 | <macrodef name="call-javac-compile"> |
| | 211 | <attribute name="sourcepath" default=""/> |
| | 212 | <attribute name="srcdir" default="${src.dir}"/> |
| | 213 | <attribute name="fork" default="yes"/> |
| | 214 | <attribute name="excludes" default=""/> |
| | 215 | <attribute name="includes" default="**/*.java"/> |
| | 216 | <attribute name="destdir" default="${build.dir}"/> |
| | 217 | <attribute name="debug" default="on"/> |
| | 218 | <attribute name="includeantruntime" default="false"/> |
| | 219 | <attribute name="encoding" default="UTF-8"/> |
| | 220 | <attribute name="release" default="${java.lang.version}"/> |
| | 221 | <element name="cp-elements" optional="true"/> |
| | 222 | <sequential> |
| | 223 | <javac sourcepath="@{sourcepath}" srcdir="@{srcdir}" fork="@{fork}" |
| | 224 | includes="@{includes}" excludes="@{excludes}" destdir="@{destdir}" release="@{release}" |
| | 225 | debug="@{debug}" includeantruntime="@{includeantruntime}" encoding="@{encoding}"> |
| | 226 | <compilerarg value="-J-Xbootclasspath/p:${toString:errorprone_javac.classpath}" unless:set="isJava9"/> |
| | 227 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 228 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 229 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 230 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 231 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 232 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 233 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 234 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 235 | <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| | 236 | <compilerarg line="-XDcompilePolicy=simple"/> |
| | 237 | <compilerarg value="-processorpath"/> |
| | 238 | <compilerarg value="${toString:errorprone.classpath}:${toString:semanticdb.classpath}"/> |
| | 239 | <compilerarg value="-Xlint:cast"/> |
| | 240 | <compilerarg value="-Xlint:deprecation"/> |
| | 241 | <compilerarg value="-Xlint:dep-ann"/> |
| | 242 | <compilerarg value="-Xlint:divzero"/> |
| | 243 | <compilerarg value="-Xlint:empty"/> |
| | 244 | <compilerarg value="-Xlint:finally"/> |
| | 245 | <compilerarg value="-Xlint:overrides"/> |
| | 246 | <!--<compilerarg value="-Xlint:rawtypes"/>--> |
| | 247 | <compilerarg value="-Xlint:static"/> |
| | 248 | <compilerarg value="-Xlint:try"/> |
| | 249 | <compilerarg value="-Xlint:unchecked"/> |
| | 250 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 --> |
| | 251 | <compilerarg value="-XDignore.symbol.file"/> |
| | 252 | <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF -Xep:RestrictedApiChecker:OFF -Xep:InlineMeSuggester:OFF" unless:set="noErrorProne"/> |
| | 253 | <compilerarg line="-Xmaxwarns 1000"/> |
| | 254 | <compilerarg value="-Xplugin:semanticdb -sourceroot:@{srcdir} -targetroot:${build.dir}/semanticdb" if:set="lsif" /> |
| | 255 | <classpath> |
| | 256 | <path refid="runtime.path"/> |
| | 257 | <cp-elements/> |
| | 258 | </classpath> |
| | 259 | </javac> |
| | 260 | </sequential> |
| | 261 | </macrodef> |
| | 262 | <macrodef name="call-javac-compile-mrjar"> |
| | 263 | <!-- |
| | 264 | See https://openjdk.java.net/jeps/238 for the specification |
| | 265 | The big bits are that the version specific files should be in META-INF/versions/${javaVersion}/ |
| | 266 | using the same package scheme. And that the files in the version specific directories are *full* |
| | 267 | implementations of the class they are replacing. |
| | 268 | --> |
| | 269 | <attribute name="release"/> |
| | 270 | <sequential> |
| | 271 | <condition property="java@{release}DirExists"> |
| | 272 | <and> |
| | 273 | <isset property="isJava@{release}"/> |
| | 274 | <resourceexists> |
| | 275 | <file file="${src.dir}/main/java-@{release}"/> |
| | 276 | </resourceexists> |
| | 277 | </and> |
| | 278 | </condition> |
| | 279 | <echo message="Compiling Java @{release} files" if:true="${java@{release}DirExists}"/> |
| | 280 | <mkdir dir="${build.dir}/META-INF/versions/@{release}" if:true="${java@{release}DirExists}"/> |
| | 281 | <call-javac-compile srcdir="${src.dir}/main/java-@{release}" destdir="${build.dir}/META-INF/versions/@{release}" release="@{release}" if:true="${java@{release}DirExists}"> |
| | 282 | <cp-elements> |
| | 283 | <pathelement path="${build.dir}"/> |
| | 284 | </cp-elements> |
| | 285 | </call-javac-compile> |
| | 286 | </sequential> |
| | 287 | </macrodef> |
| 210 | | <javac sourcepath="" srcdir="${src.dir}" fork="yes" |
| 211 | | excludes="com/**,org/apache/commons/**,**/package-info.java" |
| 212 | | destdir="${build.dir}" release="${java.lang.version}" debug="on" includeantruntime="false" encoding="UTF-8"> |
| 213 | | <compilerarg value="-J-Xbootclasspath/p:${toString:errorprone_javac.classpath}" unless:set="isJava9"/> |
| 214 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 215 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 216 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 217 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 218 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 219 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 220 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 221 | | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 222 | | <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/> |
| 223 | | <compilerarg line="-XDcompilePolicy=simple"/> |
| 224 | | <compilerarg value="-processorpath"/> |
| 225 | | <compilerarg value="${toString:errorprone.classpath}:${toString:semanticdb.classpath}"/> |
| 226 | | <compilerarg value="-Xlint:cast"/> |
| 227 | | <compilerarg value="-Xlint:deprecation"/> |
| 228 | | <compilerarg value="-Xlint:dep-ann"/> |
| 229 | | <compilerarg value="-Xlint:divzero"/> |
| 230 | | <compilerarg value="-Xlint:empty"/> |
| 231 | | <compilerarg value="-Xlint:finally"/> |
| 232 | | <compilerarg value="-Xlint:overrides"/> |
| 233 | | <!--<compilerarg value="-Xlint:rawtypes"/>--> |
| 234 | | <compilerarg value="-Xlint:static"/> |
| 235 | | <compilerarg value="-Xlint:try"/> |
| 236 | | <compilerarg value="-Xlint:unchecked"/> |
| 237 | | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 --> |
| 238 | | <compilerarg value="-XDignore.symbol.file"/> |
| 239 | | <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF -Xep:RestrictedApiChecker:OFF -Xep:InlineMeSuggester:OFF" unless:set="noErrorProne"/> |
| 240 | | <compilerarg line="-Xmaxwarns 1000"/> |
| 241 | | <compilerarg value="-Xplugin:semanticdb -sourceroot:${src.dir} -targetroot:${build.dir}/semanticdb" if:set="lsif" /> |
| 242 | | <classpath> |
| 243 | | <path refid="runtime.path"/> |
| 244 | | </classpath> |
| 245 | | </javac> |
| | 293 | <call-javac-compile excludes="com/**,org/apache/commons/**,**/package-info.java,**/module-info.java,main/**" release="${java.lang.version}"/> |
| | 294 | <!-- Java 11 specific files (2018-09 LTS) --> |
| | 295 | <call-javac-compile-mrjar release="11"/> |
| | 296 | <!-- Java 17 specific files (2021-09 LTS) --> |
| | 297 | <call-javac-compile-mrjar release="17"/> |
| | 298 | <!-- Java 18 specific files --> |
| | 299 | <call-javac-compile-mrjar release="18"/> |
| | 300 | <!-- Java 19 specific files --> |
| | 301 | <call-javac-compile-mrjar release="19"/> |
| | 302 | <!-- Java 20 specific files --> |
| | 303 | <call-javac-compile-mrjar release="20"/> |
| | 304 | <!-- Java 21 specific files (2023-09 LTS) --> |
| | 305 | <call-javac-compile-mrjar release="21"/> |