Skip to content

Commit

Permalink
Fix for #924: check original method if AIC cannot be found in gen method
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Jul 15, 2019
1 parent d2555b6 commit ffa0b1e
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,24 @@ private IType findAnonType(ClassNode type) {
return (IType) child;
}
}
// check for method with AIC in default argument expression
if (enclosingElement instanceof IMethod) {
MethodNode meth = findMethodNode((IMethod) enclosingElement);
if (meth != null && meth.getOriginal() != meth) {
for (IJavaElement elem : occurrenceCounts.keySet()) {
if (elem instanceof IMethod &&
elem != enclosingElement &&
elem.getElementName().equals(meth.getName())) {
for (IJavaElement child : ((IMember) elem).getChildren()) {
if (child instanceof IType && ((IType) child).isAnonymous() &&
((IType) child).getOccurrenceCount() == occurrenceCount) {
return (IType) child;
}
}
}
}
}
}
} catch (JavaModelException e) {
log(e, "Error visiting children of %s", type.getName());
}
Expand Down

0 comments on commit ffa0b1e

Please sign in to comment.