Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037965Openbravo ERPZ. Otherspublic2018-02-19 11:342018-02-23 11:22
shuehner 
Triage Omni OMS 
normalminorhave not tried
closedfixed 
5
 
3.0PR18Q2 
dmiguelez
Core
No
0037965: JDK9: Fix new deprecation warnings related to: new Long, new Integer, new Boolean...
Java since long time had both:
- new Integer(String
- new Integer(int)

but also
- int Integer.parseInt
- Integer Integer.valueOf

With the latter being preferred (i.e. not constructing new instance for performance etc)

JDK9 now deprecated those constructors.

This issue fixes all cases in pi of the now deprecated usage by applying simple pattern depending on usage:
a.) use java autoboxing where it converts from primitve to object automatically
- bankStatementLine.setLineNo(new Long((counter + 1) * 10));
+ bankStatementLine.setLineNo((counter + 1) * 10L);
Note: 10 -> 10L to force use of type long and not int for resulting expression

b.) when object is needed from String
- node.setSequenceNumber(new Long(seqNo));
+ node.setSequenceNumber(Long.valueOf(seqNo));

c.) auto-boxing with long constant
- orderLine.setLineNo(new Long("10"));
+ orderLine.setLineNo(10L);

d.) int from String- int comprobacion1 = new Integer(CreateFileData.selectComprobacion1(this, strKey)).intValue();
+ int comprobacion1 = Integer.parseInt(CreateFileData.selectComprobacion1(this, strKey));

Note small special case:
- assertEquals(costAdjustmentLine.getLineNo(), new Long((j + 1) * 10));
+ assertEquals(costAdjustmentLine.getLineNo(), Long.valueOf((j + 1) * 10L));

Here simple auto-boxing did not compile cleanly
Had to go via explicit Long object.
Compile with JDK9 and observe new compilation warnings.
No tags attached.
blocks feature request 0037083 closed alostale support JDK 9 
Issue History
2018-02-19 11:34shuehnerNew Issue
2018-02-19 11:34shuehnerAssigned To => Triage Finance
2018-02-19 11:34shuehnerModules => Core
2018-02-19 11:34shuehnerTriggers an Emergency Pack => No
2018-02-19 11:34shuehnerRelationship addedblocks 0037083
2018-02-23 11:21hgbotCheckin
2018-02-23 11:21hgbotNote Added: 0102821
2018-02-23 11:21hgbotStatusnew => resolved
2018-02-23 11:21hgbotResolutionopen => fixed
2018-02-23 11:21hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/86709bedb772fb210f30b26c4e31dd36cfc54268 [^]
2018-02-23 11:22dmiguelezReview Assigned To => dmiguelez
2018-02-23 11:22dmiguelezNote Added: 0102823
2018-02-23 11:22dmiguelezStatusresolved => closed
2018-02-23 11:22dmiguelezFixed in Version => 3.0PR18Q2

Notes
(0102821)
hgbot   
2018-02-23 11:21   
Repository: erp/devel/pi
Changeset: 86709bedb772fb210f30b26c4e31dd36cfc54268
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Thu Feb 22 11:46:45 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/86709bedb772fb210f30b26c4e31dd36cfc54268 [^]

Fixed 37965. Fix new jdk9 deprecation warnings (new Long, new Integer,...)

Replace the now deprecated constructors by equivalent use of
- typed constant: i.e. 10 by 10L (typed long)
- autoboxing
- Long Long.valueOf, long Long.parseInt

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_BankStatementImport.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java
M modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.java
M src-test/src/org/openbravo/advpaymentmngt/test/TestUtility.java
M src-test/src/org/openbravo/test/costing/utils/TestCostingUtils.java
M src/org/openbravo/common/actionhandler/SetNewBPCurrency.java
M src/org/openbravo/erpCommon/ad_actionButton/CreateFile.java
M src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
M src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt.java
M src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
M src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java
M src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java
M src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java
M src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR.java
M src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR_legacy.java
M src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesJR.java
M src/org/openbravo/erpCommon/ad_reports/ReportMaterialDimensionalAnalysesJR.java
M src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoiceJR.java
M src/org/openbravo/erpCommon/ad_reports/ReportPurchaseDimensionalAnalysesJR.java
M src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR.java
M src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJR.java
M src/org/openbravo/erpCommon/businessUtility/COAUtility.java
M src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility.java
M src/org/openbravo/erpCommon/info/BusinessPartnerMultiple.java
M src/org/openbravo/erpCommon/info/ProductMultiple.java
M src/org/openbravo/erpCommon/info/ProjectMultiple.java
M src/org/openbravo/erpReports/ReportVatRegisterJR.java
---
(0102823)
dmiguelez   
2018-02-23 11:22   
Code Review + Testing Ok