Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0037965
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Z. Othersminorhave not tried2018-02-19 11:342018-02-23 11:22
ReportershuehnerView Statuspublic 
Assigned ToTriage Finance 
PrioritynormalResolutionfixedFixed in Version3.0PR18Q2
StatusclosedFix in branchFixed in SCM revision86709bedb772
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Todmiguelez
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0037965: JDK9: Fix new deprecation warnings related to: new Long, new Integer, new Boolean...

DescriptionJava 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.
Steps To ReproduceCompile with JDK9 and observe new compilation warnings.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks feature request 0037083 closedalostale support JDK 9 

-  Notes
(0102821)
hgbot (developer)
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 (developer)
2018-02-23 11:22

Code Review + Testing Ok

- Issue History
Date Modified Username Field Change
2018-02-19 11:34 shuehner New Issue
2018-02-19 11:34 shuehner Assigned To => Triage Finance
2018-02-19 11:34 shuehner Modules => Core
2018-02-19 11:34 shuehner Triggers an Emergency Pack => No
2018-02-19 11:34 shuehner Relationship added blocks 0037083
2018-02-23 11:21 hgbot Checkin
2018-02-23 11:21 hgbot Note Added: 0102821
2018-02-23 11:21 hgbot Status new => resolved
2018-02-23 11:21 hgbot Resolution open => fixed
2018-02-23 11:21 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/86709bedb772fb210f30b26c4e31dd36cfc54268 [^]
2018-02-23 11:22 dmiguelez Review Assigned To => dmiguelez
2018-02-23 11:22 dmiguelez Note Added: 0102823
2018-02-23 11:22 dmiguelez Status resolved => closed
2018-02-23 11:22 dmiguelez Fixed in Version => 3.0PR18Q2


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker