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 - Review mapreduce package
Summary: Review mapreduce package
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2016-05-23 15:18 UTC by Svata Dedic
Modified: 2016-05-25 01:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
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)