disable change param type fix in case of overriding library method

(cherry picked from commit b00a060b18fc3de1f8e317b61a5fd87efdc8b565)
This commit is contained in:
anna
2012-11-23 21:13:48 +01:00
parent 9c1b5c7591
commit 9ec65aa657
2 changed files with 24 additions and 1 deletions
@@ -119,7 +119,21 @@ public class VariableTypeFromCallFix implements IntentionAction {
}
}
}
if (expression instanceof PsiReferenceExpression) {
registerParameterTypeChange(highlightInfo, method, expression, parameterType);
}
}
private static void registerParameterTypeChange(HighlightInfo highlightInfo,
PsiMethod method,
PsiExpression expression,
PsiType parameterType) {
if (expression instanceof PsiReferenceExpression) {
final PsiManager manager = method.getManager();
if (manager.isInProject(method)) {
final PsiMethod[] superMethods = method.findDeepestSuperMethods();
for (PsiMethod superMethod : superMethods) {
if (!manager.isInProject(superMethod)) return;
}
final PsiElement resolve = ((PsiReferenceExpression)expression).resolve();
if (resolve instanceof PsiVariable) {
HighlightUtil.registerChangeVariableTypeFixes((PsiVariable)resolve, parameterType, highlightInfo);
@@ -0,0 +1,9 @@
// "Change 'i' type to 'long'" "false"
class M extends Thread {
@Override
public boolean equals(Object obj) {
Thread.sleep(<caret>obj);
return super.equals(obj);
}
}