Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream.collect safety no longer incorrectly includes map collectors #2264

Merged
merged 2 commits into from
May 11, 2022

Conversation

carterkozak
Copy link
Contributor

Map collectors, unlike most others, doesn't collect the data from
the stream into an element, rather acts in two steps: A stream.map
for each key and value function, as well as a collect of the merged
results. Thus, we cannot make assumptions about the output safety
based on the inputs. In the future, this will be handled using
the same functionality as stream.map(func).

==COMMIT_MSG==
Stream.collect safety no longer incorrectly includes map collectors
==COMMIT_MSG==

Possible downsides?

Sometimes the map collector result may be unsafe (e.g. Function.identity and similar), however in many cases we can get safety based on type information in the result. Best to produce high confidence results, as opposed to allowing developers to assume some are noise.

Map collectors, unlike most others, doesn't collect the data from
the stream into an element, rather acts in two steps: A `stream.map`
for each key and value function, as well as a collect of the merged
results. Thus, we cannot make assumptions about the output safety
based on the inputs. In the future, this will be handled using
the same functionality as `stream.map(func)`.
@carterkozak carterkozak requested review from tpetracca and fawind May 10, 2022 21:48
@changelog-app
Copy link

changelog-app bot commented May 10, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Stream.collect safety no longer incorrectly includes map collectors

Check the box to generate changelog(s)

  • Generate changelog entry

@bulldozer-bot bulldozer-bot bot merged commit eeb239d into develop May 11, 2022
@bulldozer-bot bulldozer-bot bot deleted the ckozak/map_collector_safety branch May 11, 2022 08:49
@svc-autorelease
Copy link
Collaborator

Released 4.131.0

bulldozer-bot bot pushed a commit to palantir/witchcraft-api that referenced this pull request May 11, 2022
###### _excavator_ is a bot for automating changes across repositories.

Changes produced by the roomba/latest-baseline-oss check.

# Release Notes
## 4.131.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Fix | Stream.collect safety no longer incorrectly includes map collectors | palantir/gradle-baseline#2264 |



To enable or disable this check, please contact the maintainers of Excavator.
This was referenced May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants