Create from usage: Renamed all references of 'method' to 'function'.

This commit is contained in:
Jack Zhou
2013-05-01 17:58:25 -04:00
parent d2ce58e912
commit ec15d5fee4
52 changed files with 114 additions and 112 deletions
@@ -0,0 +1 @@
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
@@ -2,8 +2,8 @@
<body>
<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">This is a built-in template used for filling the body of a Kotlin method
each time it is generated by the program, e.g. when using the <b>Create Method from Usage</b> intention action.<br>
<td colspan="3"><font face="verdana" size="-1">This is a built-in template used for filling the body of a Kotlin function
each time it is generated by the program, e.g. when using the <b>Create Function from Usage</b> intention action.<br>
The template is editable. Along with Kotlin expressions and comments, you can also use the predefined variables
that will be then expanded into the corresponding values.</font>
</td>
@@ -16,22 +16,22 @@
<tr>
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${RETURN_TYPE}</i></b></font></nobr></td>
<td width="10">&nbsp;</td>
<td valign="top"><font face="verdana" size="-1">a return type of a created method</font></td>
<td valign="top"><font face="verdana" size="-1">a return type of a created function</font></td>
</tr>
<tr>
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${METHOD_NAME}</i></b></font></nobr></td>
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${FUNCTION_NAME}</i></b></font></nobr></td>
<td width="10">&nbsp;</td>
<td valign="top"><font face="verdana" size="-1">name of the created method</font></td>
<td valign="top"><font face="verdana" size="-1">name of the created function</font></td>
</tr>
<tr>
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${CLASS_NAME}</i></b></font></nobr></td>
<td width="10">&nbsp;</td>
<td valign="top"><font face="verdana" size="-1">qualified name of the class where method is created</font></td>
<td valign="top"><font face="verdana" size="-1">qualified name of the class where function is created</font></td>
</tr>
<tr>
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${SIMPLE_CLASS_NAME}</i></b></font></nobr></td>
<td width="10">&nbsp;</td>
<td valign="top"><font face="verdana" size="-1">non-qualified name of the class where method is implemented</font></td>
<td valign="top"><font face="verdana" size="-1">non-qualified name of the class where function is implemented</font></td>
</tr>
</table>
</body>
@@ -1 +0,0 @@
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
@@ -144,7 +144,7 @@ map.platform.class.to.kotlin.multiple=Change all usages of ''{0}'' in this file
map.platform.class.to.kotlin.advertisement=Choose an appropriate Kotlin class
map.platform.class.to.kotlin.family=Change to Kotlin class
create.from.usage.family=Create from usage
create.method.from.usage=Create method ''{0}'' from usage
create.function.from.usage=Create function ''{0}'' from usage
choose.target.class.or.trait.title=Choose target class or trait
surround.with=Surround with
surround.with.string.template="${expr}"
@@ -36,7 +36,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.PopupChooserBuilder;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -78,9 +77,10 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
private static final String TYPE_PARAMETER_LIST_VARIABLE_NAME = "typeParameterList";
private static final String TEMPLATE_FROM_USAGE_METHOD_BODY = "New Kotlin Method Body.kt";
private static final String TEMPLATE_FROM_USAGE_FUNCTION_BODY = "New Kotlin Function Body.kt";
private static final String ATTRIBUTE_FUNCTION_NAME = "FUNCTION_NAME";
private static final Pattern COMPONENT_FUNCTION_PATTERN = Pattern.compile("^component(\\d+)$");
/**
@@ -272,7 +272,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
}
/**
* Encapsulates information about a method parameter that is going to be created.
* Encapsulates information about a function parameter that is going to be created.
*/
private static class Parameter {
private final String preferredName;
@@ -522,7 +522,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
}
}
private final String methodName;
private final String functionName;
private final TypeOrExpressionThereof ownerType;
private final TypeOrExpressionThereof returnType;
private final List<Parameter> parameters;
@@ -539,10 +539,12 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
private TypeCandidate selectedReceiverType;
private Map<TypeParameterDescriptor, String> typeParameterNameMap;
public CreateMethodFromUsageFix(@NotNull PsiElement element, @NotNull TypeOrExpressionThereof ownerType, @NotNull String methodName,
@NotNull TypeOrExpressionThereof returnType, @NotNull List<Parameter> parameters) {
public CreateFunctionFromUsageFix(
@NotNull PsiElement element, @NotNull TypeOrExpressionThereof ownerType, @NotNull String functionName,
@NotNull TypeOrExpressionThereof returnType, @NotNull List<Parameter> parameters
) {
super(element);
this.methodName = methodName;
this.functionName = functionName;
this.ownerType = ownerType;
this.returnType = returnType;
this.parameters = parameters;
@@ -551,7 +553,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
@NotNull
@Override
public String getText() {
return JetBundle.message("create.method.from.usage", methodName);
return JetBundle.message("create.function.from.usage", functionName);
}
@Override
@@ -685,14 +687,14 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
String returnTypeString = isUnit ? "" : ": Any";
if (isExtension) { // create as extension function
String ownerTypeString = selectedReceiverType.getRenderedType();
String methodText = String.format("fun %s.%s(%s)%s { }", ownerTypeString, methodName, parametersString, returnTypeString);
func = JetPsiFactory.createFunction(project, methodText);
String functionText = String.format("fun %s.%s(%s)%s { }", ownerTypeString, functionName, parametersString, returnTypeString);
func = JetPsiFactory.createFunction(project, functionText);
containingFile = currentFile;
containingFileEditor = currentFileEditor;
func = (JetNamedFunction) currentFile.add(func);
} else { // create as method
String methodText = String.format("fun %s(%s)%s { }", methodName, parametersString, returnTypeString);
func = JetPsiFactory.createFunction(project, methodText);
} else { // create as regular function
String functionText = String.format("fun %s(%s)%s { }", functionName, parametersString, returnTypeString);
func = JetPsiFactory.createFunction(project, functionText);
PsiFile classContainingFile = ownerClass.getContainingFile();
assert classContainingFile instanceof JetFile;
containingFile = (JetFile) classContainingFile;
@@ -862,7 +864,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
}
private void setupFunctionBody(@NotNull Project project, @NotNull JetNamedFunction func) {
FileTemplate fileTemplate = FileTemplateManager.getInstance().getCodeTemplate(TEMPLATE_FROM_USAGE_METHOD_BODY);
FileTemplate fileTemplate = FileTemplateManager.getInstance().getCodeTemplate(TEMPLATE_FROM_USAGE_FUNCTION_BODY);
Properties properties = new Properties();
if (isUnit) {
properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, "Unit");
@@ -873,7 +875,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
}
properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, DescriptorUtils.getFQName(ownerClassDescriptor).getFqName());
properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, ownerClassDescriptor.getName().getName());
properties.setProperty(FileTemplate.ATTRIBUTE_METHOD_NAME, methodName);
properties.setProperty(ATTRIBUTE_FUNCTION_NAME, functionName);
@NonNls String bodyText;
try {
@@ -1204,7 +1206,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
}
@NotNull
public static JetIntentionActionFactory createCreateGetMethodFromUsageFactory() {
public static JetIntentionActionFactory createCreateGetFunctionFromUsageFactory() {
return new JetIntentionActionFactory() {
@Nullable
@Override
@@ -1223,13 +1225,13 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
}
TypeOrExpressionThereof returnType = new TypeOrExpressionThereof(accessExpr, Variance.OUT_VARIANCE);
return new CreateMethodFromUsageFix(accessExpr, arrayType, "get", returnType, parameters);
return new CreateFunctionFromUsageFix(accessExpr, arrayType, "get", returnType, parameters);
}
};
}
@NotNull
public static JetIntentionActionFactory createCreateSetMethodFromUsageFactory() {
public static JetIntentionActionFactory createCreateSetFunctionFromUsageFactory() {
return new JetIntentionActionFactory() {
@Nullable
@Override
@@ -1255,13 +1257,13 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
parameters.add(new Parameter("value", valType));
TypeOrExpressionThereof returnType = new TypeOrExpressionThereof(KotlinBuiltIns.getInstance().getUnitType(), Variance.OUT_VARIANCE);
return new CreateMethodFromUsageFix(accessExpr, arrayType, "set", returnType, parameters);
return new CreateFunctionFromUsageFix(accessExpr, arrayType, "set", returnType, parameters);
}
};
}
@NotNull
public static JetIntentionActionFactory createCreateHasNextMethodFromUsageFactory() {
public static JetIntentionActionFactory createCreateHasNextFunctionFromUsageFactory() {
return new JetIntentionActionFactory() {
@Nullable
@Override
@@ -1276,13 +1278,13 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
JetForExpression forExpr = QuickFixUtil.getParentElementOfType(diagnostic, JetForExpression.class);
if (forExpr == null) return null;
TypeOrExpressionThereof returnType = new TypeOrExpressionThereof(KotlinBuiltIns.getInstance().getBooleanType(), Variance.OUT_VARIANCE);
return new CreateMethodFromUsageFix(forExpr, ownerType, "hasNext", returnType, new ArrayList<Parameter>());
return new CreateFunctionFromUsageFix(forExpr, ownerType, "hasNext", returnType, new ArrayList<Parameter>());
}
};
}
@NotNull
public static JetIntentionActionFactory createCreateNextMethodFromUsageFactory() {
public static JetIntentionActionFactory createCreateNextFunctionFromUsageFactory() {
return new JetIntentionActionFactory() {
@Nullable
@Override
@@ -1298,13 +1300,13 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
JetExpression variableExpr = forExpr.getLoopParameter();
if (variableExpr == null) return null;
TypeOrExpressionThereof returnType = new TypeOrExpressionThereof(variableExpr, Variance.OUT_VARIANCE);
return new CreateMethodFromUsageFix(forExpr, ownerType, "next", returnType, new ArrayList<Parameter>());
return new CreateFunctionFromUsageFix(forExpr, ownerType, "next", returnType, new ArrayList<Parameter>());
}
};
}
@NotNull
public static JetIntentionActionFactory createCreateIteratorMethodFromUsageFactory() {
public static JetIntentionActionFactory createCreateIteratorFunctionFromUsageFactory() {
return new JetIntentionActionFactory() {
@Nullable
@Override
@@ -1331,13 +1333,13 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
returnJetType = new JetTypeImpl(returnJetType.getAnnotations(), returnJetType.getConstructor(), returnJetType.isNullable(),
returnJetTypeArguments, returnJetType.getMemberScope());
TypeOrExpressionThereof returnType = new TypeOrExpressionThereof(returnJetType, Variance.OUT_VARIANCE);
return new CreateMethodFromUsageFix(forExpr, iterableType, "iterator", returnType, new ArrayList<Parameter>());
return new CreateFunctionFromUsageFix(forExpr, iterableType, "iterator", returnType, new ArrayList<Parameter>());
}
};
}
@NotNull
public static JetIntentionActionFactory createCreateComponentMethodFromUsageFactory() {
public static JetIntentionActionFactory createCreateComponentFunctionFromUsageFactory() {
return new JetIntentionActionFactory() {
@Nullable
@Override
@@ -1362,7 +1364,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageFixBase {
if (rhs == null) return null;
TypeOrExpressionThereof ownerType = new TypeOrExpressionThereof(rhs);
return new CreateMethodFromUsageFix(multiDeclaration, ownerType, name.getIdentifier(), returnType, new ArrayList<Parameter>());
return new CreateFunctionFromUsageFix(multiDeclaration, ownerType, name.getIdentifier(), returnType, new ArrayList<Parameter>());
}
};
}
@@ -240,15 +240,15 @@ public class QuickFixes {
factories.put(MANY_CLASSES_IN_SUPERTYPE_LIST, RemoveSupertypeFix.createFactory());
factories.put(NO_GET_METHOD, CreateMethodFromUsageFix.createCreateGetMethodFromUsageFactory());
factories.put(NO_SET_METHOD, CreateMethodFromUsageFix.createCreateSetMethodFromUsageFactory());
JetIntentionActionFactory createHasNextFromUsageFactory = CreateMethodFromUsageFix.createCreateHasNextMethodFromUsageFactory();
factories.put(NO_GET_METHOD, CreateFunctionFromUsageFix.createCreateGetFunctionFromUsageFactory());
factories.put(NO_SET_METHOD, CreateFunctionFromUsageFix.createCreateSetFunctionFromUsageFactory());
JetIntentionActionFactory createHasNextFromUsageFactory = CreateFunctionFromUsageFix.createCreateHasNextFunctionFromUsageFactory();
factories.put(HAS_NEXT_MISSING, createHasNextFromUsageFactory);
factories.put(HAS_NEXT_FUNCTION_NONE_APPLICABLE, createHasNextFromUsageFactory);
JetIntentionActionFactory createNextFromUsageFactory = CreateMethodFromUsageFix.createCreateNextMethodFromUsageFactory();
JetIntentionActionFactory createNextFromUsageFactory = CreateFunctionFromUsageFix.createCreateNextFunctionFromUsageFactory();
factories.put(NEXT_MISSING, createNextFromUsageFactory);
factories.put(NEXT_NONE_APPLICABLE, createNextFromUsageFactory);
factories.put(ITERATOR_MISSING, CreateMethodFromUsageFix.createCreateIteratorMethodFromUsageFactory());
factories.put(COMPONENT_FUNCTION_MISSING, CreateMethodFromUsageFix.createCreateComponentMethodFromUsageFactory());
factories.put(ITERATOR_MISSING, CreateFunctionFromUsageFix.createCreateIteratorFunctionFromUsageFactory());
factories.put(COMPONENT_FUNCTION_MISSING, CreateFunctionFromUsageFix.createCreateComponentFunctionFromUsageFactory());
}
}
@@ -1,9 +1,9 @@
// "Create method 'component3' from usage" "true"
// "Create function 'component3' from usage" "true"
class Foo<T> {
fun component1(): Int { return 0 }
fun component2(): Int { return 0 }
fun component3(): Any {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun foo() {
@@ -1,9 +1,9 @@
// "Create method 'component3' from usage" "true"
// "Create function 'component3' from usage" "true"
class Foo<T> {
fun component1(): Int { return 0 }
fun component2(): Int { return 0 }
fun component3(): String {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun foo() {
@@ -1,4 +1,4 @@
// "Create method 'component3' from usage" "true"
// "Create function 'component3' from usage" "true"
class Foo<T> {
fun component1(): Int { return 0 }
fun component2(): Int { return 0 }
@@ -1,4 +1,4 @@
// "Create method 'component3' from usage" "true"
// "Create function 'component3' from usage" "true"
class Foo<T> {
fun component1(): Int { return 0 }
fun component2(): Int { return 0 }
@@ -1,9 +1,9 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun x (y: Foo<Iterable<T>>) {
val z: Iterable<T> = y[""]
}
fun get(s: String): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,9 +1,9 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
val z: Iterable<T> = y["", w]
}
fun get(s: String, w: T): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,7 +1,7 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun get(s: String, w: T): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
@@ -1,7 +1,7 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun get(s: String, w: T): Any {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -8,6 +8,6 @@ class Foo<T> {
bar(z)
}
fun <V> get(s: String, w: ArrayList<V>): String {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,7 +1,7 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
fun x (y: Any) {
val z: Any = y[""]
}
fun Any.get(s: String): Any {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -1,9 +1,9 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun <S> x (y: Foo<Iterable<S>>) {
val z: Iterable<S> = y[""]
}
fun get(s: String): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,9 +1,9 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T, S: Iterable<T>> {
fun <U> x (y: Foo<U, Iterable<U>>) {
val z: U = y[""]
}
fun get(s: String): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,9 +1,9 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
val z: Iterable<T> = y["", w]
}
fun <V> get(s: String, w: Iterable<V>): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -7,5 +7,5 @@ class Foo<T> {
}
}
fun <E, V> ArrayList<E>.get(s: String, w: ArrayList<V>): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -6,6 +6,6 @@ class Foo<T> {
val z: Iterable<T> = y["", w]
}
fun <V> get(s: String, w: ArrayList<V>): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -6,6 +6,6 @@ class Foo<T> {
val z: Iterable<T> = y["", w]
}
fun get(s: String, w: T): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<S> {
@@ -6,6 +6,6 @@ class Foo<S> {
val z: Iterable<T> = y["", w]
}
fun get(s: String, w: S): S {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun x (y: Foo<Iterable<T>>) {
val z: Iterable<T> = y<caret>[""]
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
val z: Iterable<T> = y<caret>["", w]
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T>
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
val z: Iterable<T> = y<caret>["", w]
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T>
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
val z = y<caret>["", w]
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
fun x (y: Any) {
val z: Any = y<caret>[""]
}
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun <S> x (y: Foo<Iterable<S>>) {
val z: Iterable<S> = y<caret>[""]
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T, S: Iterable<T>> {
fun <U> x (y: Foo<U, Iterable<U>>) {
val z: U = y<caret>[""]
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
val z: Iterable<T> = y<caret>["", w]
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
class Foo<T> {
fun <T, V> x (y: java.util.ArrayList<T>, w: java.util.ArrayList<V>) {
val z: java.util.ArrayList<T>? = if (y<caret>["", w]) null else null
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -1,4 +1,4 @@
// "Create method 'get' from usage" "true"
// "Create function 'get' from usage" "true"
import java.util.ArrayList
class Foo<S> {
@@ -1,10 +1,10 @@
// "Create method 'hasNext' from usage" "true"
// "Create function 'hasNext' from usage" "true"
class FooIterator<T> {
fun next(): Int {
throw Exception("not implemented")
}
fun hasNext(): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class Foo<T> {
@@ -1,10 +1,10 @@
// "Create method 'hasNext' from usage" "true"
// "Create function 'hasNext' from usage" "true"
class FooIterator<T> {
fun next(): T {
throw Exception("not implemented")
}
fun hasNext(): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class Foo<T> {
@@ -1,4 +1,4 @@
// "Create method 'hasNext' from usage" "true"
// "Create function 'hasNext' from usage" "true"
class FooIterator<T> {
fun next(): Int {
throw Exception("not implemented")
@@ -1,4 +1,4 @@
// "Create method 'hasNext' from usage" "true"
// "Create function 'hasNext' from usage" "true"
class FooIterator<T> {
fun next(): T {
throw Exception("not implemented")
@@ -1,7 +1,7 @@
// "Create method 'iterator' from usage" "true"
// "Create function 'iterator' from usage" "true"
class Foo<T> {
fun iterator(): Iterator<T> {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun foo() {
@@ -1,7 +1,7 @@
// "Create method 'iterator' from usage" "true"
// "Create function 'iterator' from usage" "true"
class Foo<T> {
fun iterator(): Iterator<String> {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun foo() {
@@ -1,4 +1,4 @@
// "Create method 'iterator' from usage" "true"
// "Create function 'iterator' from usage" "true"
class Foo<T>
fun foo() {
for (i: Int in Foo<caret><Int>()) { }
@@ -1,4 +1,4 @@
// "Create method 'iterator' from usage" "true"
// "Create function 'iterator' from usage" "true"
class Foo<T>
fun foo() {
for (i in Foo<caret><Int>()) {
@@ -1,8 +1,8 @@
// "Create method 'next' from usage" "true"
// "Create function 'next' from usage" "true"
class FooIterator<T> {
fun hasNext(): Boolean { return false }
fun next(): Int {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class Foo<T> {
@@ -1,8 +1,8 @@
// "Create method 'next' from usage" "true"
// "Create function 'next' from usage" "true"
class FooIterator<T> {
fun hasNext(): Boolean { return false }
fun next(): T {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class Foo<T> {
@@ -1,4 +1,4 @@
// "Create method 'next' from usage" "true"
// "Create function 'next' from usage" "true"
class FooIterator<T> {
fun hasNext(): Boolean { return false }
}
@@ -1,4 +1,4 @@
// "Create method 'next' from usage" "true"
// "Create function 'next' from usage" "true"
class FooIterator<T> {
fun hasNext(): Boolean { return false }
}
@@ -1,9 +1,9 @@
// "Create method 'set' from usage" "true"
// "Create function 'set' from usage" "true"
class Foo<T> {
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
y["", w] = w
}
fun set(s: String, w: T, value: T) {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,4 +1,4 @@
// "Create method 'set' from usage" "true"
// "Create function 'set' from usage" "true"
import java.util.ArrayList
class Foo<T> {
@@ -7,5 +7,5 @@ class Foo<T> {
}
}
fun <T> Any.set(s: String, w: ArrayList<T>, value: ArrayList<T>) {
throw UnsupportedOperationException("not implemented") //To change body of created methods use File | Settings | File Templates.
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -1,4 +1,4 @@
// "Create method 'set' from usage" "true"
// "Create function 'set' from usage" "true"
class Foo<T> {
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
y<caret>["", w] = w
@@ -1,4 +1,4 @@
// "Create method 'set' from usage" "true"
// "Create function 'set' from usage" "true"
class Foo<T> {
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
y<caret>["", w] = w