@@ -52,14 +52,23 @@ final class ExtensionModuleHelperForTests {
5252
5353 def ant = new AntBuilder ()
5454 def allowed = [
55- ' Picked up JAVA_TOOL_OPTIONS: .*' ,
56- ' Picked up _JAVA_OPTIONS: .*'
55+ ~ / Picked up JAVA_TOOL_OPTIONS: .*/ ,
56+ ~ / Picked up _JAVA_OPTIONS: .*/
5757 ]
58+ def jvmArgs = []
59+ if (Runtime . version(). feature() == 25 ) {
60+ // JEP 471/498: silence terminal-deprecation warnings for sun.misc.Unsafe
61+ // memory-access methods called from agents on the inherited classpath
62+ // (e.g. testlens's shaded protobuf UnsafeUtil::arrayBaseOffset).
63+ // remove when we can - this could mask errors we want to pick up
64+ jvmArgs << ' --sun-misc-unsafe-memory-access=allow'
65+ }
5866 try {
5967 ant. with {
6068 taskdef(name : ' groovyc' , classname : ' org.codehaus.groovy.ant.Groovyc' )
6169 groovyc(srcdir : baseDir. absolutePath, destdir : baseDir. absolutePath, includes : ' Temp.groovy' , fork : true )
6270 java(classname : ' Temp' , fork : ' true' , outputproperty : ' out' , errorproperty : ' err' ) {
71+ jvmArgs. each { jvmarg(value : it) }
6372 classpath {
6473 cp. each {
6574 pathelement location : it
@@ -71,8 +80,11 @@ final class ExtensionModuleHelperForTests {
7180 baseDir. deleteDir()
7281 String out = ant. project. properties. out
7382 String err = ant. project. properties. err
74- if (err && ! allowed. any{ err. trim(). matches(it) }) {
75- throw new RuntimeException (" $err \n Classpath: ${ cp.join('\n')} " )
83+ def stray = err?. readLines()?. findAll { line ->
84+ line. trim() && ! allowed. any { line ==~ it }
85+ } ?: []
86+ if (stray) {
87+ throw new RuntimeException (" ${ stray.join('\n')} \n Classpath: ${ cp.join('\n')} " )
7688 }
7789 if (out && (out. contains(' FAILURES' ) || ! out. contains(' OK' ))) {
7890 throw new RuntimeException (" $out \n Classpath: ${ cp.join('\n')} " )
0 commit comments