diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/safeDelete/KotlinSafeDeleteProcessor.java b/idea/src/org/jetbrains/jet/plugin/refactoring/safeDelete/KotlinSafeDeleteProcessor.java index d4000e22d98..b576116b40e 100644 --- a/idea/src/org/jetbrains/jet/plugin/refactoring/safeDelete/KotlinSafeDeleteProcessor.java +++ b/idea/src/org/jetbrains/jet/plugin/refactoring/safeDelete/KotlinSafeDeleteProcessor.java @@ -121,25 +121,13 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor { JetProperty property = (JetProperty) element; if (property.isLocal()) return findKotlinDeclarationUsages(property, allElementsToDelete, result); - return new NonCodeUsageSearchInfo( - delegateToJavaProcessorAndCombineConditions( - LightClassUtil.getLightClassPropertyMethods(property), - getCondition(Arrays.asList(allElementsToDelete)), - allElementsToDelete, - result - ), - element - ); + return delegateToJavaProcessor(property, allElementsToDelete, result); } if (element instanceof JetTypeParameter) { - Condition insideDeleted = delegateToJavaProcessorAndCombineConditions( - AsJavaPackage.toPsiTypeParameters((JetTypeParameter) element), - getCondition(Arrays.asList(allElementsToDelete)), - allElementsToDelete, - result - ); - findTypeParameterUsages((JetTypeParameter) element, result); - return new NonCodeUsageSearchInfo(insideDeleted, element); + JetTypeParameter typeParameter = (JetTypeParameter) element; + + findTypeParameterUsages(typeParameter, result); + return delegateToJavaProcessor(typeParameter, allElementsToDelete, result); } if (element instanceof JetParameter) { JetParameter jetParameter = (JetParameter) element; @@ -155,6 +143,22 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor { return getSearchInfo(element, allElementsToDelete); } + private NonCodeUsageSearchInfo delegateToJavaProcessor( + JetDeclaration jetDeclaration, + PsiElement[] allElementsToDelete, + List result + ) { + return new NonCodeUsageSearchInfo( + delegateToJavaProcessorAndCombineConditions( + AsJavaPackage.toLightElements(jetDeclaration), + getCondition(Arrays.asList(allElementsToDelete)), + allElementsToDelete, + result + ), + jetDeclaration + ); + } + private Condition delegateToJavaProcessorAndCombineConditions( Iterable elements, Condition insideDeleted,