mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract method: exclude unused type parameters mentioned in return type (IDEA-58456)
This commit is contained in:
+1
-1
@@ -299,7 +299,7 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
if (myOutputVariable != null) {
|
||||
elements = ArrayUtil.append(myElements, myOutputVariable, PsiElement.class);
|
||||
}
|
||||
if (myCodeFragmentMember != null) {
|
||||
if (myCodeFragmentMember != null && myReturnType == ((PsiMethod)myCodeFragmentMember).getReturnType()) {
|
||||
elements = ArrayUtil.append(myElements, ((PsiMethod)myCodeFragmentMember).getReturnTypeElement(), PsiElement.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
public <T> T method(Class<T> clazz) {
|
||||
<selection>System.out.println();</selection>
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
public <T> T method(Class<T> clazz) {
|
||||
newMethod();
|
||||
return null;
|
||||
}
|
||||
|
||||
private void newMethod() {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
@@ -372,6 +372,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUnusedGenerics() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testParamsUsedInLocalClass() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user