eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Ensure CaptureBinding.initializeBounds is called only once per binding

Open
#4,869 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

Fallout from https://github.com/eclipse-jdt/eclipse.jdt.core/pull/4862#issuecomment-3941063688:

> Inside `PTB.capture()` method `initializeBounds()` is invoked on only such elements `capturedArguments[i]` where `freshCaptures[i]` is true, which should "normally" imply that this capture binding has been created just now, i.e., never exposed to any outside code. [...]
>
> Theory thus suggests, that the capture isn't really fresh, i.e., `this.environment.createCapturedWildcard()` probably answered a pre-existing capture binding. This smells like inference computing the same capture more than once, i.e., inference performing several attempts with similar inputs.
>
> That theory also suggest, that it would be prudent to add an early exit to `CaptureBinding.initializeBounds()` to avoid repeated initialized in the first place (that would be an additional safety measure on top of the current fix).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.