You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Taher Alkhateeb <sl...@gmail.com> on 2015/06/05 14:11:47 UTC

Re: Java 8 and functional programming in trunk

Hi All, 

What is the proper process to move to JDK 8? I have a patch ready to move to JDK 8 and fix an issue which we describe below. Should we create a JIRA or request a vote or what exactly? 

While debugging I discovered a bug that was failing the tests when moving from JDK 7 to JDK 8 which has to do with the implementation of a HashMap. Essentially the HashMap in JDK 8 does not care for the insertion order while it does in JDK 7 (see below). A simple fix is to replace HashMap with LinkedHashMap. Now all the tests run in JDK 8. 

Taher Alkhateeb 

==== debug outcome ==== 
substitutionPatternMap.entrySet() under JDK 7 in the test testConvertOperatorSubstitutions (last assert test) 
{&&=@and, <==@lteq, ||=@or, >==@gteq, >=@gt, <=@lt} 

substitutionPatternMap.entrySet() under JDK 8 in the test testConvertOperatorSubstitutions (last assert test) 
{&&=@and, ||=@or, <==@lteq, <=@lt, >=@gt, >==@gteq} 

----- Original Message -----

From: "Taher Alkhateeb" <sl...@gmail.com> 
To: dev@ofbiz.apache.org 
Sent: Monday, 25 May, 2015 8:08:25 AM 
Subject: Re: Java 8 and functional programming in trunk 


Hello everyone, 

Okay, so it seems there is consensus on going ahead with Java 8. I tried testing this patch which I believe upgrades OFBiz to JDK 8. 

Running "./ant clean-all build load-demo run-tests" delivers a failure in "testConvertOperatorSubstitutions" (base tests). The error message is shown below . So the line giving the error is exactly this one in org.ofbiz.base.util.test.StringUtilTests 

assertEquals("all converions", "one && two || three > four >= five < six <= seven", StringUtil.convertOperatorSubstitutions("one @and two @or three @gt four @gteq five @lt six @lteq seven")); 

This is weird. I checked JDK 7 and JDK 8 implementations and I think they are identical in the matcher API. Yet when switching to JDK 8 the matcher evaluates on "@gt" of the "@qteq " pattern and so you end up with ">eq" instead of ">=" . This is without even applying the above patch. 

I hope I am not running on a wild goose chase and ignoring something simple or silly? Any Ideas? 

==== error log start ==== 
all converions expected:<...wo || three > four >[=] five < six <= seven> but was:<...wo || three > four >[eq] five < six <= seven> 

junit.framework.ComparisonFailure: all converions expected:<...wo || three > four >[=] five < six <= seven> but was:<...wo || three > four >[eq] five < six <= seven> 
at org.ofbiz.base.test.GenericTestCaseBase.assertEquals(GenericTestCaseBase.java:313) 
at org.ofbiz.base.util.test.StringUtilTests.testConvertOperatorSubstitutions(StringUtilTests.java:269) 
at org.ofbiz.testtools.TestRunContainer.start(TestRunContainer.java:146) 
at org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:237) 
at org.ofbiz.base.start.Start.startStartLoaders(Start.java:408) 
at org.ofbiz.base.start.Start.start(Start.java:434) 
at org.ofbiz.base.start.Start.main(Start.java:135) 
==== error log end ==== 

Taher Alkhateeb 


----- Original Message -----

From: "Ron Wheeler" <rw...@artifact-software.com> 
To: dev@ofbiz.apache.org 
Sent: Thursday, 7 May, 2015 8:12:20 PM 
Subject: Re: Java 8 and functional programming in trunk 

On 07/05/2015 12:37 PM, Christian Geisert wrote: 
> Well call it "Standards Office" or whatever, the guys who decide which 
> platforms are allowed to use in the company. 

Java 7 will be coming off the list in most companies if it has not 
already been done. 

> 
> Java 8 is available since just about a year.. 
> Just the mentioned Ubuntu 12.04 LTS (= Longtime Support, which means 
> support for 5 years) has no Java 8 in the official repositories. 
> Is there a Java 8 for AS/400 ;-) 

http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/ 

> Anyway, my point is that there should be good reasons to switch to Java 
> 8 only. 
> 
> Christian 
> 
> Am 07.05.2015 17:58, schrieb Ron Wheeler: 
>> On 07/05/2015 11:32 AM, Christian Geisert wrote: 
>>> Yes, we must support Java 8, but we absolutely have the choice to still 
>>> support Java 7 (i.e. no use of Java 8 only features yet) 
>>> 
>>> IMHO there should be good reasons to use these Java 8 features (not just 
>>> because it's cool..) 
>>> 
>>> It's not a big deal to update a developer machine to Java 8 (well, my 
>>> laptop still runs Kubuntu 12.04 ..) but it's another thing in (big) 
>>> companies (old operating systems, get approvals from security office 
>>> etc...) 
>> Security officer is going to be insisting on an upgrade to Java 8 
>> since Java 7 is no longer going to get security fixes. 
>> 
>> Have we heard of any OS that supports Java 7 but not Java 8? 
>> 
>> Ron 
>> 
>>> Christian 
>>> 
>>> Am 07.05.2015 15:40, schrieb Adam Heath: 
>>>> Not a reply to Jacques, but if an absolutely java-8-only feature is 
>>>> used, be sure to update the regex in ${ofbiz.home}/macros.xml, then 
>>>> the source/target values in common.xml in the same folder. 
>>>> 
>>>> ps: I'm fine with moving towards 1.8. It's not a choice that we can 
>>>> make, actually. 
>>>> 
>>>> On 05/07/2015 01:46 AM, Jacques Le Roux wrote: 
>>>>> Yes (lazy) consensus over vote ;) 
>>>>> 
>>>>> Jacques 
>>>>> 
>> 
> 


-- 
Ron Wheeler 
President 
Artifact Software Inc 
email: rwheeler@artifact-software.com 
skype: ronaldmwheeler 
phone: 866-970-2435, ext 102 




Re: Java 8 and functional programming in trunk

Posted by Taher Alkhateeb <sl...@gmail.com>.
Hi Adrian and everyone, 

I have created JIRA OFBIZ-6458 which contains all the patches needed to upgrade to JDK 8. I do not want to commit because infrastructure is not upgraded. Any guidance on what to do next is appreciated. 

Taher Alkhateeb 

----- Original Message -----

From: "Adrian Crum" <ad...@sandglass-software.com> 
To: dev@ofbiz.apache.org 
Sent: Friday, 5 June, 2015 6:48:50 PM 
Subject: Re: Java 8 and functional programming in trunk 

I would recommend committing each fix separately, then log the revision 
numbers in a single Jira issue. 

Adrian Crum 
Sandglass Software 
www.sandglass-software.com 

On 6/5/2015 5:11 AM, Taher Alkhateeb wrote: 
> Hi All, 
> 
> What is the proper process to move to JDK 8? I have a patch ready to move to JDK 8 and fix an issue which we describe below. Should we create a JIRA or request a vote or what exactly? 
> 
> While debugging I discovered a bug that was failing the tests when moving from JDK 7 to JDK 8 which has to do with the implementation of a HashMap. Essentially the HashMap in JDK 8 does not care for the insertion order while it does in JDK 7 (see below). A simple fix is to replace HashMap with LinkedHashMap. Now all the tests run in JDK 8. 
> 
> Taher Alkhateeb 
> 
> ==== debug outcome ==== 
> substitutionPatternMap.entrySet() under JDK 7 in the test testConvertOperatorSubstitutions (last assert test) 
> {&&=@and, <==@lteq, ||=@or, >==@gteq, >=@gt, <=@lt} 
> 
> substitutionPatternMap.entrySet() under JDK 8 in the test testConvertOperatorSubstitutions (last assert test) 
> {&&=@and, ||=@or, <==@lteq, <=@lt, >=@gt, >==@gteq} 
> 
> ----- Original Message ----- 
> 
> From: "Taher Alkhateeb" <sl...@gmail.com> 
> To: dev@ofbiz.apache.org 
> Sent: Monday, 25 May, 2015 8:08:25 AM 
> Subject: Re: Java 8 and functional programming in trunk 
> 
> 
> Hello everyone, 
> 
> Okay, so it seems there is consensus on going ahead with Java 8. I tried testing this patch which I believe upgrades OFBiz to JDK 8. 
> 
> Running "./ant clean-all build load-demo run-tests" delivers a failure in "testConvertOperatorSubstitutions" (base tests). The error message is shown below . So the line giving the error is exactly this one in org.ofbiz.base.util.test.StringUtilTests 
> 
> assertEquals("all converions", "one && two || three > four >= five < six <= seven", StringUtil.convertOperatorSubstitutions("one @and two @or three @gt four @gteq five @lt six @lteq seven")); 
> 
> This is weird. I checked JDK 7 and JDK 8 implementations and I think they are identical in the matcher API. Yet when switching to JDK 8 the matcher evaluates on "@gt" of the "@qteq " pattern and so you end up with ">eq" instead of ">=" . This is without even applying the above patch. 
> 
> I hope I am not running on a wild goose chase and ignoring something simple or silly? Any Ideas? 
> 
> ==== error log start ==== 
> all converions expected:<...wo || three > four >[=] five < six <= seven> but was:<...wo || three > four >[eq] five < six <= seven> 
> 
> junit.framework.ComparisonFailure: all converions expected:<...wo || three > four >[=] five < six <= seven> but was:<...wo || three > four >[eq] five < six <= seven> 
> at org.ofbiz.base.test.GenericTestCaseBase.assertEquals(GenericTestCaseBase.java:313) 
> at org.ofbiz.base.util.test.StringUtilTests.testConvertOperatorSubstitutions(StringUtilTests.java:269) 
> at org.ofbiz.testtools.TestRunContainer.start(TestRunContainer.java:146) 
> at org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:237) 
> at org.ofbiz.base.start.Start.startStartLoaders(Start.java:408) 
> at org.ofbiz.base.start.Start.start(Start.java:434) 
> at org.ofbiz.base.start.Start.main(Start.java:135) 
> ==== error log end ==== 
> 
> Taher Alkhateeb 
> 
> 
> ----- Original Message ----- 
> 
> From: "Ron Wheeler" <rw...@artifact-software.com> 
> To: dev@ofbiz.apache.org 
> Sent: Thursday, 7 May, 2015 8:12:20 PM 
> Subject: Re: Java 8 and functional programming in trunk 
> 
> On 07/05/2015 12:37 PM, Christian Geisert wrote: 
>> Well call it "Standards Office" or whatever, the guys who decide which 
>> platforms are allowed to use in the company. 
> 
> Java 7 will be coming off the list in most companies if it has not 
> already been done. 
> 
>> 
>> Java 8 is available since just about a year.. 
>> Just the mentioned Ubuntu 12.04 LTS (= Longtime Support, which means 
>> support for 5 years) has no Java 8 in the official repositories. 
>> Is there a Java 8 for AS/400 ;-) 
> 
> http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/ 
> 
>> Anyway, my point is that there should be good reasons to switch to Java 
>> 8 only. 
>> 
>> Christian 
>> 
>> Am 07.05.2015 17:58, schrieb Ron Wheeler: 
>>> On 07/05/2015 11:32 AM, Christian Geisert wrote: 
>>>> Yes, we must support Java 8, but we absolutely have the choice to still 
>>>> support Java 7 (i.e. no use of Java 8 only features yet) 
>>>> 
>>>> IMHO there should be good reasons to use these Java 8 features (not just 
>>>> because it's cool..) 
>>>> 
>>>> It's not a big deal to update a developer machine to Java 8 (well, my 
>>>> laptop still runs Kubuntu 12.04 ..) but it's another thing in (big) 
>>>> companies (old operating systems, get approvals from security office 
>>>> etc...) 
>>> Security officer is going to be insisting on an upgrade to Java 8 
>>> since Java 7 is no longer going to get security fixes. 
>>> 
>>> Have we heard of any OS that supports Java 7 but not Java 8? 
>>> 
>>> Ron 
>>> 
>>>> Christian 
>>>> 
>>>> Am 07.05.2015 15:40, schrieb Adam Heath: 
>>>>> Not a reply to Jacques, but if an absolutely java-8-only feature is 
>>>>> used, be sure to update the regex in ${ofbiz.home}/macros.xml, then 
>>>>> the source/target values in common.xml in the same folder. 
>>>>> 
>>>>> ps: I'm fine with moving towards 1.8. It's not a choice that we can 
>>>>> make, actually. 
>>>>> 
>>>>> On 05/07/2015 01:46 AM, Jacques Le Roux wrote: 
>>>>>> Yes (lazy) consensus over vote ;) 
>>>>>> 
>>>>>> Jacques 
>>>>>> 
>>> 
>> 
> 
> 


Re: Java 8 and functional programming in trunk

Posted by Adrian Crum <ad...@sandglass-software.com>.
I would recommend committing each fix separately, then log the revision 
numbers in a single Jira issue.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 6/5/2015 5:11 AM, Taher Alkhateeb wrote:
> Hi All,
>
> What is the proper process to move to JDK 8? I have a patch ready to move to JDK 8 and fix an issue which we describe below. Should we create a JIRA or request a vote or what exactly?
>
> While debugging I discovered a bug that was failing the tests when moving from JDK 7 to JDK 8 which has to do with the implementation of a HashMap. Essentially the HashMap in JDK 8 does not care for the insertion order while it does in JDK 7 (see below). A simple fix is to replace HashMap with LinkedHashMap. Now all the tests run in JDK 8.
>
> Taher Alkhateeb
>
> ==== debug outcome ====
> substitutionPatternMap.entrySet() under JDK 7 in the test testConvertOperatorSubstitutions (last assert test)
> {&&=@and, <==@lteq, ||=@or, >==@gteq, >=@gt, <=@lt}
>
> substitutionPatternMap.entrySet() under JDK 8 in the test testConvertOperatorSubstitutions (last assert test)
> {&&=@and, ||=@or, <==@lteq, <=@lt, >=@gt, >==@gteq}
>
> ----- Original Message -----
>
> From: "Taher Alkhateeb" <sl...@gmail.com>
> To: dev@ofbiz.apache.org
> Sent: Monday, 25 May, 2015 8:08:25 AM
> Subject: Re: Java 8 and functional programming in trunk
>
>
> Hello everyone,
>
> Okay, so it seems there is consensus on going ahead with Java 8. I tried testing this patch which I believe upgrades OFBiz to JDK 8.
>
> Running "./ant clean-all build load-demo run-tests" delivers a failure in "testConvertOperatorSubstitutions" (base tests). The error message is shown below . So the line giving the error is exactly this one in org.ofbiz.base.util.test.StringUtilTests
>
> assertEquals("all converions", "one && two || three > four >= five < six <= seven", StringUtil.convertOperatorSubstitutions("one @and two @or three @gt four @gteq five @lt six @lteq seven"));
>
> This is weird. I checked JDK 7 and JDK 8 implementations and I think they are identical in the matcher API. Yet when switching to JDK 8 the matcher evaluates on "@gt" of the "@qteq " pattern and so you end up with ">eq" instead of ">=" . This is without even applying the above patch.
>
> I hope I am not running on a wild goose chase and ignoring something simple or silly? Any Ideas?
>
> ==== error log start ====
> all converions expected:<...wo || three > four >[=] five < six <= seven> but was:<...wo || three > four >[eq] five < six <= seven>
>
> junit.framework.ComparisonFailure: all converions expected:<...wo || three > four >[=] five < six <= seven> but was:<...wo || three > four >[eq] five < six <= seven>
> at org.ofbiz.base.test.GenericTestCaseBase.assertEquals(GenericTestCaseBase.java:313)
> at org.ofbiz.base.util.test.StringUtilTests.testConvertOperatorSubstitutions(StringUtilTests.java:269)
> at org.ofbiz.testtools.TestRunContainer.start(TestRunContainer.java:146)
> at org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:237)
> at org.ofbiz.base.start.Start.startStartLoaders(Start.java:408)
> at org.ofbiz.base.start.Start.start(Start.java:434)
> at org.ofbiz.base.start.Start.main(Start.java:135)
> ==== error log end ====
>
> Taher Alkhateeb
>
>
> ----- Original Message -----
>
> From: "Ron Wheeler" <rw...@artifact-software.com>
> To: dev@ofbiz.apache.org
> Sent: Thursday, 7 May, 2015 8:12:20 PM
> Subject: Re: Java 8 and functional programming in trunk
>
> On 07/05/2015 12:37 PM, Christian Geisert wrote:
>> Well call it "Standards Office" or whatever, the guys who decide which
>> platforms are allowed to use in the company.
>
> Java 7 will be coming off the list in most companies if it has not
> already been done.
>
>>
>> Java 8 is available since just about a year..
>> Just the mentioned Ubuntu 12.04 LTS (= Longtime Support, which means
>> support for 5 years) has no Java 8 in the official repositories.
>> Is there a Java 8 for AS/400 ;-)
>
> http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/
>
>> Anyway, my point is that there should be good reasons to switch to Java
>> 8 only.
>>
>> Christian
>>
>> Am 07.05.2015 17:58, schrieb Ron Wheeler:
>>> On 07/05/2015 11:32 AM, Christian Geisert wrote:
>>>> Yes, we must support Java 8, but we absolutely have the choice to still
>>>> support Java 7 (i.e. no use of Java 8 only features yet)
>>>>
>>>> IMHO there should be good reasons to use these Java 8 features (not just
>>>> because it's cool..)
>>>>
>>>> It's not a big deal to update a developer machine to Java 8 (well, my
>>>> laptop still runs Kubuntu 12.04 ..) but it's another thing in (big)
>>>> companies (old operating systems, get approvals from security office
>>>> etc...)
>>> Security officer is going to be insisting on an upgrade to Java 8
>>> since Java 7 is no longer going to get security fixes.
>>>
>>> Have we heard of any OS that supports Java 7 but not Java 8?
>>>
>>> Ron
>>>
>>>> Christian
>>>>
>>>> Am 07.05.2015 15:40, schrieb Adam Heath:
>>>>> Not a reply to Jacques, but if an absolutely java-8-only feature is
>>>>> used, be sure to update the regex in ${ofbiz.home}/macros.xml, then
>>>>> the source/target values in common.xml in the same folder.
>>>>>
>>>>> ps: I'm fine with moving towards 1.8. It's not a choice that we can
>>>>> make, actually.
>>>>>
>>>>> On 05/07/2015 01:46 AM, Jacques Le Roux wrote:
>>>>>> Yes (lazy) consensus over vote ;)
>>>>>>
>>>>>> Jacques
>>>>>>
>>>
>>
>
>