Implement "Safe Delete" refactoring for value parameters

This commit is contained in:
Alexey Sedunov
2013-07-31 15:03:57 +04:00
parent 6ef8f04a01
commit 2704328160
117 changed files with 2731 additions and 8 deletions
@@ -419,7 +419,9 @@ public class GenerateTests {
testModel("idea/testData/safeDelete/deleteProperty/kotlinPropertyWithJava", "doPropertyTestWithJava"),
testModel("idea/testData/safeDelete/deleteProperty/javaPropertyWithKotlin", "doJavaPropertyTest"),
testModel("idea/testData/safeDelete/deleteTypeParameter/kotlinTypeParameter", "doTypeParameterTest"),
testModel("idea/testData/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava", "doTypeParameterTestWithJava")
testModel("idea/testData/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava", "doTypeParameterTestWithJava"),
testModel("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameter", "doValueParameterTest"),
testModel("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameterWithJava", "doValueParameterTestWithJava")
);
generateTest(
@@ -261,4 +261,5 @@ x.overrides.y.in.class.list={0} in {1} overrides functions in the following clas
unused.overriding.methods.title=Unused Overriding Members
there.are.unused.methods.that.override.methods.you.delete=There are unused members that override methods you delete.
choose.the.ones.you.want.to.be.deleted=Choose the ones you want to be deleted.
method.column=Member
method.column=Member
delete.param.in.method.hierarchy={0} is a part of method hierarchy. Do you want to delete multiple parameters?
@@ -26,7 +26,10 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.OverridingMethodsSearch;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.*;
import com.intellij.psi.util.MethodSignatureUtil;
import com.intellij.psi.util.PsiFormatUtil;
import com.intellij.psi.util.PsiFormatUtilBase;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.safeDelete.JavaSafeDeleteProcessor;
import com.intellij.refactoring.safeDelete.NonCodeUsageSearchInfo;
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteOverrideAnnotation;
@@ -34,12 +37,17 @@ import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteOverridingMethodU
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo;
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceSimpleDeleteUsageInfo;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.*;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.asJava.LightClassUtil;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.Modality;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
@@ -58,7 +66,8 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
|| element instanceof JetNamedFunction
|| element instanceof PsiMethod
|| element instanceof JetProperty
|| element instanceof JetTypeParameter;
|| element instanceof JetTypeParameter
|| element instanceof JetParameter;
}
@Override
@@ -113,6 +122,17 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
if (element instanceof JetTypeParameter) {
return findTypeParameterUsages((JetTypeParameter) element, allElementsToDelete, result);
}
if (element instanceof JetParameter) {
JetParameter jetParameter = (JetParameter) element;
PsiParameter psiParameter = getPsiParameter(jetParameter);
if (psiParameter != null) {
super.findUsages(psiParameter, allElementsToDelete, result);
}
return findParameterUsages(jetParameter, allElementsToDelete, result);
}
return getSearchInfo(element, allElementsToDelete);
}
@@ -314,6 +334,84 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
return getSearchInfo(property, allElementsToDelete);
}
protected static NonCodeUsageSearchInfo findParameterUsages(
final JetParameter parameter,
final PsiElement[] allElementsToDelete,
final List<UsageInfo> result
) {
NonCodeUsageSearchInfo searchInfo = getSearchInfo(parameter, allElementsToDelete);
final JetNamedFunction function = PsiTreeUtil.getParentOfType(parameter, JetNamedFunction.class);
if (function == null || parameter.getParent() != function.getValueParameterList()) return searchInfo;
final int parameterIndex = function.getValueParameters().indexOf(parameter);
ReferencesSearch.search(parameter, parameter.getUseScope()).forEach(new Processor<PsiReference>() {
@Override
public boolean process(PsiReference reference) {
PsiElement element = reference.getElement();
if (!isInside(element, allElementsToDelete)) {
result.add(new SafeDeleteReferenceSimpleDeleteUsageInfo(element, parameter, false));
}
return true;
}
});
ReferencesSearch.search(function).forEach(
new Processor<PsiReference>() {
@Override
public boolean process(PsiReference reference) {
processParameterUsageInCall(reference, function, parameterIndex, result, parameter);
return true;
}
}
);
return searchInfo;
}
static void processParameterUsageInCall(
PsiReference reference,
PsiElement originalDeclaration,
int parameterIndex,
List<UsageInfo> result,
PsiElement parameter
) {
PsiElement element = reference.getElement();
JetCallExpression callExpression =
PsiTreeUtil.getParentOfType(reference.getElement(), JetCallExpression.class, false);
if (callExpression == null) return;
JetExpression calleeExpression = callExpression.getCalleeExpression();
if (!(calleeExpression instanceof JetReferenceExpression
&& PsiTreeUtil.isAncestor(calleeExpression, element, false))) return;
BindingContext bindingContext =
AnalyzerFacadeWithCache.analyzeFileWithCache((JetFile) element.getContainingFile()).getBindingContext();
DeclarationDescriptor descriptor =
bindingContext.get(BindingContext.REFERENCE_TARGET, (JetReferenceExpression) calleeExpression);
if (descriptor == null) return;
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(bindingContext, descriptor);
if (originalDeclaration.equals(declaration)) {
List<? extends ValueArgument> args = callExpression.getValueArguments();
int argCount = args.size();
if (parameterIndex < argCount) {
result.add(
new SafeDeleteValueArgumentListUsageInfo((JetValueArgument) args.get(parameterIndex), parameter)
);
}
else {
List<JetExpression> lambdaArgs = callExpression.getFunctionLiteralArguments();
int lambdaIndex = parameterIndex - argCount;
if (lambdaIndex < lambdaArgs.size()) {
result.add(new SafeDeleteReferenceSimpleDeleteUsageInfo(lambdaArgs.get(lambdaIndex), parameter, true));
}
}
}
}
protected static NonCodeUsageSearchInfo findTypeParameterUsages(
final JetTypeParameter parameter,
final PsiElement[] allElementsToDelete,
@@ -635,6 +733,17 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
}
}
private static PsiParameter getPsiParameter(JetParameter parameter) {
JetNamedFunction function = PsiTreeUtil.getParentOfType(parameter, JetNamedFunction.class);
if (function == null || parameter.getParent() != function.getValueParameterList()) return null;
PsiMethod lightMethod = LightClassUtil.getLightClassMethod(function);
if (lightMethod == null) return null;
int parameterIndex = function.getValueParameters().indexOf(parameter);
return lightMethod.getParameterList().getParameters()[parameterIndex];
}
@Override
public void prepareForDeletion(PsiElement element) throws IncorrectOperationException {
if (element instanceof PsiMethod) {
@@ -664,6 +773,9 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
else if (element instanceof JetTypeParameter) {
deleteElementAndCleanParent(element);
}
else if (element instanceof JetParameter) {
JetPsiUtil.deleteElementWithDelimiters(element);
}
}
public static void deleteElementAndCleanParent(PsiElement element) {
@@ -728,7 +840,6 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
if (superMethods.isEmpty()) return Collections.singletonList(declaration);
List<String> superClasses = getClassDescriptions(bindingContext, superMethods);
return askUserForMethodsToSearch(declaration, callableDescriptor, superMethods, superClasses);
}
@@ -797,6 +908,11 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
public Collection<? extends PsiElement> getElementsToSearch(
PsiElement element, @Nullable Module module, Collection<PsiElement> allElementsToDelete
) {
if (element instanceof JetParameter) {
PsiParameter psiParameter = getPsiParameter((JetParameter) element);
if (psiParameter != null) return checkParametersInMethodHierarchy(psiParameter);
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
return Collections.singletonList(element);
}
@@ -804,9 +920,87 @@ public class KotlinSafeDeleteProcessor extends JavaSafeDeleteProcessor {
if (element instanceof JetNamedFunction || element instanceof JetProperty) {
return checkSuperMethods((JetDeclaration) element, allElementsToDelete);
}
return super.getElementsToSearch(element, module, allElementsToDelete);
}
private static Collection<? extends PsiElement> checkParametersInMethodHierarchy(PsiParameter parameter) {
PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
int parameterIndex = method.getParameterList().getParameterIndex(parameter);
Set<PsiElement> parametersToDelete = collectParametersToDelete(method, parameterIndex);
if (parametersToDelete.size() > 1) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return parametersToDelete;
}
String message =
JetBundle.message("delete.param.in.method.hierarchy", formatJavaOrLightMethod(method));
int exitCode = Messages.showOkCancelDialog(
parameter.getProject(), message, IdeBundle.message("title.warning"), Messages.getQuestionIcon()
);
if (exitCode == Messages.OK) {
return parametersToDelete;
}
else {
return null;
}
}
return parametersToDelete;
}
// TODO: generalize breadth-first search
private static Set<PsiElement> collectParametersToDelete(PsiMethod method, int parameterIndex) {
Deque<PsiMethod> queue = new ArrayDeque<PsiMethod>();
Set<PsiMethod> visited = new HashSet<PsiMethod>();
Set<PsiElement> parametersToDelete = new HashSet<PsiElement>();
queue.add(method);
while (!queue.isEmpty()) {
PsiMethod currentMethod = queue.poll();
visited.add(currentMethod);
addParameter(currentMethod, parametersToDelete, parameterIndex);
for (PsiMethod superMethod : currentMethod.findSuperMethods(true)) {
if (!visited.contains(superMethod)) {
queue.offer(superMethod);
}
}
for (PsiMethod overrider : OverridingMethodsSearch.search(currentMethod)) {
if (!visited.contains(overrider)) {
queue.offer(overrider);
}
}
}
return parametersToDelete;
}
private static String formatJavaOrLightMethod(PsiMethod method) {
if (method instanceof JetClsMethod) {
JetDeclaration declaration = ((JetClsMethod) method).getOrigin();
BindingContext bindingContext =
AnalyzerFacadeWithCache.analyzeFileWithCache((JetFile) declaration.getContainingFile()).getBindingContext();
DeclarationDescriptor descriptor =
bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
if (descriptor != null) return formatFunctionDescriptor(descriptor);
}
return formatPsiMethod(method, false, false);
}
private static void addParameter(PsiMethod method, Set<PsiElement> result, int parameterIndex) {
if (method instanceof JetClsMethod) {
JetDeclaration declaration = ((JetClsMethod) method).getOrigin();
if (declaration instanceof JetNamedFunction) {
result.add(((JetNamedFunction) declaration).getValueParameters().get(parameterIndex));
}
}
else {
result.add(method.getParameterList().getParameters()[parameterIndex]);
}
}
@Override
public Collection<PsiElement> getAdditionalElementsToDelete(
PsiElement element, Collection<PsiElement> allElementsToDelete, boolean askUser
@@ -0,0 +1,39 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.plugin.refactoring.safeDelete;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceSimpleDeleteUsageInfo;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetParameter;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.lang.psi.JetValueArgument;
public class SafeDeleteValueArgumentListUsageInfo extends SafeDeleteReferenceSimpleDeleteUsageInfo {
public SafeDeleteValueArgumentListUsageInfo(@NotNull JetValueArgument valueArgument, @NotNull PsiElement parameter) {
super(valueArgument, parameter, true);
}
@Override
public void deleteElement() throws IncorrectOperationException {
PsiElement element = getElement();
if (element != null) {
JetPsiUtil.deleteElementWithDelimiters(element);
}
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(<caret>a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(2)
}
fun bar(b: B) {
b.foo(4)
}
fun bar(c: C) {
c.foo(6)
}
fun bar(d: D) {
d.foo(8)
}
fun bar(z: Z) {
z.foo(10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(<caret>a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(2)
}
fun bar(b: B) {
b.foo(4)
}
fun bar(c: C) {
c.foo(6)
}
fun bar(d: D) {
d.foo(8)
}
fun bar(z: Z) {
z.foo(10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(2)
}
fun bar(b: B) {
b.foo(4)
}
fun bar(c: C) {
c.foo(6)
}
fun bar(d: D) {
d.foo(8)
}
fun bar(z: Z) {
z.foo(10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(2)
}
fun bar(b: B) {
b.foo(4)
}
fun bar(c: C) {
c.foo(6)
}
fun bar(d: D) {
d.foo(8)
}
fun bar(z: Z) {
z.foo(10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,49 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(2)
}
fun bar(b: B) {
b.foo(4)
}
fun bar(c: C) {
c.foo(6)
}
fun bar(d: D) {
d.foo(8)
}
fun bar(z: Z) {
z.foo(10)
}
}
@@ -0,0 +1,51 @@
trait Z {
open fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,51 @@
trait Z {
open fun foo(a: Int, b: Int) {
println(a)
}
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
println(a)
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,49 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(<caret>a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
println(a)
}
}
class U {
fun bar(a: A) {
a.foo(1, 2)
}
fun bar(b: B) {
b.foo(3, 4)
}
fun bar(c: C) {
c.foo(5, 6)
}
fun bar(d: D) {
d.foo(7, 8)
}
fun bar(z: Z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,11 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
println(a)
}
}
class B {
fun bar(a: A) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,11 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
println(b)
}
}
class B {
fun bar(a: A) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,11 @@
class A {
fun foo(b: String, c: Any) {
println(b)
}
}
class B {
fun bar(a: A) {
a.foo("1", "!")
}
}
@@ -0,0 +1,11 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
}
}
class B {
fun bar(a: A) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,11 @@
class A {
fun foo(b: String, c: Any) {
}
}
class B {
fun bar(a: A) {
a.foo("1", "!")
}
}
@@ -0,0 +1,11 @@
class A {
fun foo(a: Int, <caret>b: String, c: Any) {
}
}
class B {
fun bar(a: A) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,11 @@
class A {
fun foo(a: Int, c: Any) {
}
}
class B {
fun bar(a: A) {
a.foo(1, "!")
}
}
@@ -0,0 +1,11 @@
class A {
fun foo(a: Int, b: String, <caret>c: Any) {
}
}
class B {
fun bar(a: A) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,11 @@
class A {
fun foo(a: Int, b: String) {
}
}
class B {
fun bar(a: A) {
a.foo(1, "1")
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(<caret>a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(<caret>a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,29 @@
trait Z {
open fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
println(a)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo("1", "!")
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
println(b)
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(b: String, c: Any) {
println(b)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int b) {
}
}
class D extends B implements Z {
public void foo(int b) {
}
}
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(4)
}
void bar(C c) {
c.foo(6)
}
void bar(D d) {
d.foo(8)
}
void bar(Z z) {
z.foo(10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(<caret>a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(b: Int)
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int b) {
}
}
class D extends B implements Z {
public void foo(int b) {
}
}
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(4)
}
void bar(C c) {
c.foo(6)
}
void bar(D d) {
d.foo(8)
}
void bar(Z z) {
z.foo(10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(b: Int)
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int b) {
}
}
class D extends B implements Z {
public void foo(int b) {
}
}
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(4)
}
void bar(C c) {
c.foo(6)
}
void bar(D d) {
d.foo(8)
}
void bar(Z z) {
z.foo(10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(b: Int)
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
System.out.println(a);
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(<caret>a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
println(a)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.

Some files were not shown because too many files have changed in this diff Show More