Repository navigation
#1382 completeClassHierarchy and completeEnclosingClass for all classes before other completions - #1744
Open
StefanGraeber wants to merge 1 commit into
Open
#1382 completeClassHierarchy and completeEnclosingClass for all classes before other completions#1744StefanGraeber wants to merge 1 commit into
StefanGraeber wants to merge 1 commit into
Conversation
…es before other completions
When parsing type annotations on types which anner INNER_TYPEs of other classes, it is required to know the enclosing class for a correct resolution.
Since type annotation parsing will happen as early as `completeTypeParameters` and inner classes can be referenced as bounds for type parameters of the outer class, all inner classes must know their onclosing class.
The same problem arises for any other usage of the inner class in the outer, e.g.
```
class Outer {
private Outer.@TypeUseAnnotation Inner someField;
class Inner {}
}
```
requires in `completeMembers` for type annotation resolution that the `Outer.Inner` knows its enclosing class.
Since it is not possible to reference classes declared inside a code unit, this resolution step may be incomplete when resolving type annotations.
The same list is iterated twice to avoid a behavior change.
The frist list changes the return value of `classes.getAllWithOuterClassesSortedBeforeInnerClasses()` to include more classes.
Calling that method twice causes the tests `creates_new_stub_type_variables_for_type_variables_of_enclosing_classes_that_are_out_of_context` in `ClassFileImporterGenericClassesTest` and `ClassFileImporterGenericMethodSignaturesTest` to fail
Signed-off-by: Stefan Gräber <stefan.graeber@tngtech.com>
schulzjo-tng
approved these changes
Oct 9, 2026
schulzjo-tng
left a comment
Contributor
There was a problem hiding this comment.
Please fix the typos in the PR description before merging, since those can go into the merge commit. Rest looks good 👍
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When parsing type annotations on types which anner INNER_TYPEs of other classes, it is required to know the enclosing class for a correct resolution. Since type annotation parsing will happen as early as
completeTypeParametersand inner classes can be referenced as bounds for type parameters of the outer class, all inner classes must know their onclosing class. The same problem arises for any other usage of the inner class in the outer, e.g.requires in
completeMembersfor type annotation resolution that theOuter.Innerknows its enclosing class. Since it is not possible to reference classes declared inside a code unit, this resolution step may be incomplete when resolving type annotations.The same list is iterated twice to avoid a behavior change. The frist list changes the return value of
classes.getAllWithOuterClassesSortedBeforeInnerClasses()to include more classes. Calling that method twice causes the testscreates_new_stub_type_variables_for_type_variables_of_enclosing_classes_that_are_out_of_contextinClassFileImporterGenericClassesTestandClassFileImporterGenericMethodSignaturesTestto fail