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

Cleaner logic to handle types of extends and implements clauses and fixed getTypeOfExtendsImplements #6862

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/manual/contributors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
Paul Vines,
Paulo Barros,
Philip Lai,
Piyush Jha,
Pratik Bhusal,
Prionti Nasir,
Priti Chattopadhyay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,24 +582,15 @@ public void processClassTree(ClassTree classTree) {

Tree ext = classTree.getExtendsClause();
if (ext != null) {
for (AnnotatedDeclaredType superType : classType.directSupertypes()) {
if (superType.getUnderlyingType().asElement().getKind().isClass()) {
validateType(ext, superType);
break;
}
}
AnnotatedTypeMirror superClass = atypeFactory.getTypeOfExtendsImplements(ext);
validateType(ext, superClass);
}

List<? extends Tree> impls = classTree.getImplementsClause();
if (impls != null) {
for (Tree im : impls) {
for (AnnotatedDeclaredType superType : classType.directSupertypes()) {
if (superType.getUnderlyingType().asElement().getKind().isInterface()
&& types.isSameType(superType.getUnderlyingType(), TreeUtils.typeOf(im))) {
validateType(im, superType);
break;
}
}
AnnotatedTypeMirror superInterface = atypeFactory.getTypeOfExtendsImplements(im);
validateType(im, superInterface);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,7 @@ public AnnotatedTypeMirror getTypeOfExtendsImplements(Tree clause) {
AnnotatedTypeMirror fromTypeTree = fromTypeTree(clause);
AnnotationMirrorSet bound = getTypeDeclarationBounds(fromTypeTree.getUnderlyingType());
fromTypeTree.addMissingAnnotations(bound);
addComputedTypeAnnotations(clause, fromTypeTree);
return fromTypeTree;
}

Expand Down