mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[extract method] IDEA-317499: infer type arguments for class usage parameters ('this')
GitOrigin-RevId: 7e1b558415ac7a7d381287e99bf54ce87eeef6cb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
26bae9e549
commit
23ff859664
+1
-1
@@ -228,7 +228,7 @@ object ExtractMethodPipeline {
|
||||
val name = member.name ?: return null
|
||||
val type = when (member) {
|
||||
is PsiField -> member.type
|
||||
is PsiClass -> PsiTypesUtil.getClassType(member)
|
||||
is PsiClass -> usages.firstOrNull()?.type ?: PsiTypesUtil.getClassType(member)
|
||||
else -> return null
|
||||
}
|
||||
return InputParameter(usages, StringUtil.decapitalize(name), type)
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Test<K> {
|
||||
public Test<K> test() {
|
||||
<selection>return this;</selection>
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
public class Test<K> {
|
||||
public Test<K> test() {
|
||||
return getkTest(this);
|
||||
}
|
||||
|
||||
private static <K> Test<K> getkTest(Test<K> test) {
|
||||
return test;
|
||||
}
|
||||
}
|
||||
+5
@@ -504,6 +504,11 @@ class ExtractMethodAndDuplicatesInplaceTest: LightJavaCodeInsightTestCase() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
fun testPassThisAsParameter(){
|
||||
JavaRefactoringSettings.getInstance().EXTRACT_STATIC_METHOD_AND_PASS_FIELDS = true
|
||||
doTest()
|
||||
}
|
||||
|
||||
fun testRefactoringListener(){
|
||||
templateTest {
|
||||
configureByFile("$BASE_PATH/${getTestName(false)}.java")
|
||||
|
||||
Reference in New Issue
Block a user