use of org.jetbrains.uast.USuperExpression in project kotlin by JetBrains.
the class WrongCallDetector method visitMethod.
@Override
public void visitMethod(@NonNull JavaContext context, @Nullable UastVisitor visitor, @NonNull UCallExpression node, @NonNull UMethod calledMethod) {
// Call is only allowed if it is both only called on the super class (invoke special)
// as well as within the same overriding method (e.g. you can't call super.onLayout
// from the onMeasure method)
UExpression operand = node.getReceiver();
if (!(operand instanceof USuperExpression)) {
report(context, node, calledMethod);
return;
}
PsiMethod method = UastUtils.getParentOfType(node, UMethod.class, true);
if (method != null) {
String callName = node.getMethodName();
if (callName != null && !callName.equals(method.getName())) {
report(context, node, calledMethod);
}
}
}
Aggregations