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

Reconsider CapturingContext

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

Description

In #4251 I'm introducing a class `CapturingContext` that aims at solving the following architectural dilemma:
* All locations interested in supertypes of a PTB with wildcards need to apply capture (JLS 4.10.2.).
* Interested methods like isCompatibleWith() and findSupertypeOriginatingFrom() etc. do not have the necessary data (scope & source positions) for invoking capture()

A previous partial solution existed in `InferenceContext18.maybeCapture()` (since #3910). Prior to that PR we failed to properly apply JLS 4.10.2 for wildcard-parameterized types.

This issue here will allow us to discuss the problem in more leisure, asking questions like:
* If we keep this strategy: do we have better / more central locations that should invoke enter/leave? Or is it OK to lazily add more enter/leave calls when needed?
* Would we be better off with computing captures more eagerly (stored in the PTB) while necessary context may still be available (is it?) ?

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.