This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 262189

Summary: Review mapreduce package
Product: java Reporter: Svata Dedic <sdedic>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal CC: jbosboom
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Svata Dedic 2016-05-23 15:18:44 UTC
During fixing of issue #257129, I've found several possible sources of bugs in mapreduce package:

1/ variables are identified with their Name only. This will not work for same-named variables locally declared in blocks.

2/ Trees are passed around, and Trees.getPath() is used to get the appropriate TreePath again; performance issue.

3/ (I fixed this one - it seems the original code unrolled the if-branch statement as top-level to do better linearization, but failed to work for nested blocks followed by other statements)

4/ support for findFirst() or findAny() could be added for common patterns (null / literal output variable.

5/ adding to an output collection should lead to collect() collector. terminal operation, but can be reordered if collection is not used afterwards.

... and the whole package should be reviewed / streamlined.
Comment 1 Svata Dedic 2016-05-23 15:21:23 UTC
6/ the IDE *could* use forEach instead of forEachOrdered, if
* an option is turned on for this
* the incoming Collection is not ordered AND 
* items are either not collected, or are collected in non-List collection

The IDE could offer rewrite to sequential or undefined processing (forEach <-> forEachOrdered add/remove BasicStream.sequential call etc)