You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Russel Winder <ru...@winder.org.uk> on 2018/03/07 17:15:06 UTC

Groovy 2.4.14 on JDK8 and JDK9

Would I be right thinking that 

groovy.xml.DOMBuilder.parse(reader).documentElement.toString

running using 2.4.14 behaves weirdly on JDK9 compared to JDK8?

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

Re: Groovy 2.4.14 on JDK8 and JDK9

Posted by Russel Winder <ru...@winder.org.uk>.
On Fri, 2018-03-09 at 17:15 +1000, Paul King wrote:
> Sorry for being a bit late in replying. I tried Mr Haki's examples
> here and
> had no problems (I was using Oracle JDKs 9.0.4 and 1.8.0_161 and a
> recent
> OpenJDK 10):
> http://mrhaki.blogspot.com.au/2009/12/groovy-goodness-getting-groovy-
> with-dom.html
> 
> Can you elaborate?

Without really thinking, I was running the Gant tests. I had two fails.
I fixed them despite thinking WTF regarding the DOM pretty printing.
However on then realising I was running on Azul-9, I then ran on Azul-8 
and the new tests failed, the original tests passed. So Groovy 2.4.14
running on Azul-8 behaves differently to Groovy 2.4.14 on Azul-9.


These are the fails of Gant master/HEAD using "gradle
gant_groovy2.4:test on Azul-8, they work fine an Azul-9.


gant.targets.tests.Maven_Test > testCompileTargetInDirectoryOtherThanTheCurrentBuildDirectory FAILED
    junit.framework.AssertionFailedError at Maven_Test.groovy:62

org.codehaus.gant.tests.XMLProcessing_Test > testMikeNooneyXMLExampleToEnsureNoProblemWithXMLJars FAILED
    junit.framework.ComparisonFailure at XMLProcessing_Test.groovy:56


The problem in
testCompileTargetInDirectoryOtherThanTheCurrentBuildDirectory is not
actually a problem since it is just a breaking change JDK8 → JDK9. I am
in the middle of making the test compliant. However the problem in
testMikeNooneyXMLExampleToEnsureNoProblemWithXMLJars seems somewhat
bizarre.  I would like the Azul-9 behaviour to be an aberration, since
the fix for the DOM pretty printing is bizarre. I really want to roll
back on that change.

So the issue in
testCompileTargetInDirectoryOtherThanTheCurrentBuildDirectory is:

	// final versionNumber = System.getProperty('java.version').split('\\.')[0]  // Azul-9
	final versionNumber = System.getProperty('java.version').split('\\.')[1]  // Azul-8

the change is the numbering in the property, not an error.

However in testMikeNooneyXMLExampleToEnsureNoProblemWithXMLJars:

	//assertEquals(resultString(targetName, 'root element:<?xml version="1.0" encoding="UTF-8"?>' + xmlScript.replaceAll('\n    ', '\n      \n  ').replace('</Document>', '  \n</Document>\n')), output) // Azul-9
	assertEquals(resultString(targetName, 'root element:<?xml version="1.0" encoding="UTF-8"?>' + xmlScript + '\n'), output) // Azul-8

Now this is just weird, the DOM pretty print output of the same Groovy
code on Azul-9 is so wrong compared to the same Groovy code on Azul-8.

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

Re: Groovy 2.4.14 on JDK8 and JDK9

Posted by Paul King <pa...@asert.com.au>.
Sorry for being a bit late in replying. I tried Mr Haki's examples here and
had no problems (I was using Oracle JDKs 9.0.4 and 1.8.0_161 and a recent
OpenJDK 10):
http://mrhaki.blogspot.com.au/2009/12/groovy-goodness-getting-groovy-with-dom.html

Can you elaborate?

Cheers, Paul.


On Thu, Mar 8, 2018 at 3:15 AM, Russel Winder <ru...@winder.org.uk> wrote:

> Would I be right thinking that
>
> groovy.xml.DOMBuilder.parse(reader).documentElement.toString
>
> running using 2.4.14 behaves weirdly on JDK9 compared to JDK8?
>
> --
> Russel.
> ===========================================
> Dr Russel Winder      t: +44 20 7585 2200
> 41 Buckmaster Road    m: +44 7770 465 077
> London SW11 1EN, UK   w: www.russel.org.uk
>