-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8357653: Inner classes of type parameters emitted as raw types in signatures #25451
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back abimpoudis! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
/csr needed |
@biboudis has indicated that a compatibility and specification (CSR) request is needed for this pull request. @biboudis please create a CSR request for issue JDK-8357653 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
/contributor add @mcimadamore |
@biboudis |
Webrevs
|
Looks good - I'm unsure whether we should unify the two routines as part of this fix, or if we wanna keep that for a separate PR (given that might be a potential extra risk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks sensible to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
In the following example,
G.Getter
is erroneously treated as a raw type by javac:The (now reverted) #25346 attempted to fix this by skipping type variables in the calculation of
allparams()
.While that seemed to fix the type checking error, it was a fragile solution in a number of ways.
allparams()
is passed to a method that calculates substitutions. This signals that the method adheres to invariants during substitutions where lists of type parameters are expected to be of the same length (for the from and to parts). Affecting directly theallparams_field
seems not the right approach.G
still appeared as if it originated from a raw type.assembleClassSig
independently examinesouter
to detect whether it is raw or not.test/langtools/tools/javac/generics/rare
): That method ischeckId
and specificallycheckIdInternal
. While in the general case the type of an identifier is the symbol's type,checkIdInternal
computes a new type in two occasions. In one of those occasions,checkIdInternal
is computing the type when the symbol's type is an inner class. Here, we can start normalizing (by skipping the type variables).Moreover, it has been observed that
asEnclosingSuper
is a generalization ofasOuterSuper
and additionally the former is used only incheckIdInternal
. As a result, this PR performs two simplifications:As a first simplification this PR replaces
asOuterSuper
withasEnclosingSuper
.As a second simplification this PR relies only on the owner's
enclClass()
based on the following subsequent observations:enclosingType()
call returns theouter_field
directly andType.noType
otherwise (in the case of an inner class it refers to the type of its enclosing instance class.)enclClass()
call returns the closest enclosing class and the behavior inasEnclosingSuper
containing a loop with the conditiont.hasTag(CLASS)
combined withasSuper(t, sym)
is believed to be the same.The test now includes bytecode tests additionally to the reflection-based reproducer and the original test case.
// edit: this PR does not perform this simplification and retains
asOuterSuper
.Progress
Issues
Reviewers
Contributors
<[email protected]>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25451/head:pull/25451
$ git checkout pull/25451
Update a local copy of the PR:
$ git checkout pull/25451
$ git pull https://git.openjdk.org/jdk.git pull/25451/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25451
View PR using the GUI difftool:
$ git pr show -t 25451
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25451.diff
Using Webrev
Link to Webrev Comment