Openbravo Issue Tracking System - Modules
View Issue Details
0044131ModulesExternal Integration Infrastructurepublic2020-05-21 11:242022-07-22 11:25
AugustoMauch 
Triage Platform Conn 
normalminorhave not tried
acknowledgedopen 
5
 
 
caristu
0044131: Remove unneeded generic method in ImportedBaseOBObjectFetcher, it results in unchecked warning
The current definition of the ImportedBaseOBObjectFetcher.fetch method is the following:

  public <T extends BaseOBObject> T fetch(SynchronizableBusinessObject item);

When implemented, an unchecked SuppressWarnings annotation needs to be added:

...
  @SuppressWarnings("unchecked")
  @Override
  public CharacteristicValue fetch(SynchronizableBusinessObject item) {
...

But, when compiling and showing the unchecked errors, a warning is still being logged:
CharacteristicValueBaseOBObjectFetcher.java:34: warning: [unchecked] fetch(SynchronizableBusinessObject) in CharacteristicValueBaseOBObjectFetcher implements <T>fetch(SynchronizableBusinessObject) in ImportedBaseOBObjectFetcher
    [javac] public CharacteristicValue fetch(SynchronizableBusinessObject item) {
    [javac] ^
    [javac] return type requires unchecked conversion from CharacteristicValue to T
    [javac] where T is a type-variable:
    [javac] T extends BaseOBObject declared in method <T>fetch(SynchronizableBusinessObject)

We can just make the fetch method not generic, since generics is not giving any extra value in that method.
In an environment where the org.openbravo.service.external.integration is installed:
- Create a class that extends the ImportedBaseOBObjectFetcher. A dummy one is enough, it is not going to be executed, we can focus on how it is compiled.
- Notice that you need to add a @SuppressWarnings("unchecked") annotation, otherwise there will be an eclipse warning.
- Apply the attached diff in the Openbravo root folder. It will show all the unchecked errors when compiling.
- Run compile.complete.deploy and check that the warning described in the description is logged
Replace this:

  public <T extends BaseOBObject> T fetch(SynchronizableBusinessObject item);

With:

  public BaseOBObject fetch(SynchronizableBusinessObject item);
No tags attached.
related to defect 0050368 closed ignacio_deandres Code improvements required in some classes in the business API 
? showUncheckedWarnings.dif (831) 2020-05-21 11:24
https://issues.openbravo.com/file_download.php?file_id=14513&type=bug
Issue History
2020-05-21 11:24AugustoMauchNew Issue
2020-05-21 11:24AugustoMauchAssigned To => AugustoMauch
2020-05-21 11:24AugustoMauchStatusnew => scheduled
2020-05-21 11:24AugustoMauchFile Added: showUncheckedWarnings.dif
2020-05-21 11:30hgbotCheckin
2020-05-21 11:30hgbotNote Added: 0120116
2020-05-21 11:30hgbotStatusscheduled => resolved
2020-05-21 11:30hgbotResolutionopen => fixed
2020-05-21 11:30hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.service.external.integration/rev/03f304a8c9c16788a4b5b1ad5128c30cb9c5c350 [^]
2020-05-21 11:30AugustoMauchReview Assigned To => caristu
2020-05-21 11:36hgbotCheckin
2020-05-21 11:36hgbotNote Added: 0120118
2020-05-21 11:54hgbotCheckin
2020-05-21 11:54hgbotNote Added: 0120120
2020-05-21 11:56hgbotCheckin
2020-05-21 11:56hgbotNote Added: 0120121
2020-05-21 16:16hgbotCheckin
2020-05-21 16:16hgbotNote Added: 0120140
2020-05-21 16:17hgbotCheckin
2020-05-21 16:17hgbotNote Added: 0120141
2020-05-21 16:20caristuStatusresolved => new
2020-05-21 16:20caristuResolutionfixed => open
2020-05-21 16:21caristuNote Added: 0120143
2022-07-22 11:25caristuAssigned ToAugustoMauch => Triage Platform Conn
2022-07-22 11:25caristuStatusnew => acknowledged
2022-10-10 15:46caristuRelationship addedrelated to 0050368

Notes
(0120116)
hgbot   
2020-05-21 11:30   
Repository: erp/pmods/org.openbravo.service.external.integration
Changeset: 03f304a8c9c16788a4b5b1ad5128c30cb9c5c350
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu May 21 11:29:53 2020 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.external.integration/rev/03f304a8c9c16788a4b5b1ad5128c30cb9c5c350 [^]

Fixes ISSUE-44131: Removes generics from method to prevent warning

The ImportedBaseOBObjectFetcher.fetch method has been update from:

  public <T extends BaseOBObject> T fetch(SynchronizableBusinessObject item);

to:

  public BaseOBObject fetch(SynchronizableBusinessObject item);

The original generic signature did not provide any extra value, and forced to add @SuppressWarnings annotation to its implementations.

---
M src/org/openbravo/service/external/integration/importer/ImportedBaseOBObjectFetcher.java
---
(0120118)
hgbot   
2020-05-21 11:36   
Repository: erp/pmods/org.openbravo.service.external.integration.tests
Changeset: 8227b2cb98608ac6146130f2b0866b9e82d7af18
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu May 21 11:35:56 2020 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.external.integration.tests/rev/8227b2cb98608ac6146130f2b0866b9e82d7af18 [^]

Related with ISSUE-44131: Removes SuppressWarning that is no longer needed

The ImportedBaseOBObjectFetcher.fetch method is no longer generic, so an unchecked warning was no longer being raised

---
M src-test/org/openbravo/service/external/integration/test/_import/CountryExtensionsImportFetcher.java
---
(0120120)
hgbot   
2020-05-21 11:54   
Repository: erp/pmods/org.openbravo.service.external.integration.tests
Changeset: 2cf180e9a942c8c71cbe3a54fb5e8b8aaedc4cb5
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu May 21 11:54:50 2020 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.external.integration.tests/rev/2cf180e9a942c8c71cbe3a54fb5e8b8aaedc4cb5 [^]

Related with ISSUE-44131: Adds missing license text

---
M src-test/org/openbravo/service/external/integration/test/_import/CountryExtensionsImportFetcher.java
---
(0120121)
hgbot   
2020-05-21 11:56   
Repository: erp/pmods/org.openbravo.service.external.integration
Changeset: a795e86baa8e83c8d0e899fbb1ca79b0997a8253
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu May 21 11:55:57 2020 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.external.integration/rev/a795e86baa8e83c8d0e899fbb1ca79b0997a8253 [^]

Related with ISSUE-44131: Updates license year

---
M src/org/openbravo/service/external/integration/importer/ImportedBaseOBObjectFetcher.java
---
(0120140)
hgbot   
2020-05-21 16:16   
Repository: erp/pmods/org.openbravo.service.external.integration
Changeset: 7b5ab539df892d4a37c8b5ef88d6da770bf7059b
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu May 21 16:15:36 2020 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.external.integration/rev/7b5ab539df892d4a37c8b5ef88d6da770bf7059b [^]

Related with ISSUE-44131: Backs out changeset 03f304a8c9c1, it is an API Change

The signature change of the fetch method is an API change that needs to be properly managed.

---
M src/org/openbravo/service/external/integration/importer/ImportedBaseOBObjectFetcher.java
---
(0120141)
hgbot   
2020-05-21 16:17   
Repository: erp/pmods/org.openbravo.service.external.integration.tests
Changeset: 55b0a4cb4fce67f148614c4e115f280bcdd016c8
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu May 21 16:17:24 2020 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.external.integration.tests/rev/55b0a4cb4fce67f148614c4e115f280bcdd016c8 [^]

Related with ISSUE-44131: Backs out changeset, signature change was reverted

The signature change of the fetch method has been reverted. It is an API change that
needs to be properly managed.

---
M src-test/org/openbravo/service/external/integration/test/_import/CountryExtensionsImportFetcher.java
---
(0120143)
caristu   
2020-05-21 16:21   
Reopened issue to handle it as an API change and review all the modules affected by the change