mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
extract method: duplicates processing fixed (IDEA-105562)
This commit is contained in:
@@ -431,7 +431,7 @@ public final class Match {
|
||||
final PsiElement element = result.getElement();
|
||||
if (element instanceof PsiMember) {
|
||||
final PsiClass psiClass = ((PsiMember)element).getContainingClass();
|
||||
if (psiClass != null) {
|
||||
if (psiClass != null && psiClass.isPhysical()) {
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(parent.getProject());
|
||||
final PsiClassType expressionType = facade.getElementFactory().createType(psiClass, result.getSubstitutor());
|
||||
if (weakerType(psiMethod, returnType, expressionType)) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
String[] foos;
|
||||
|
||||
void test() {
|
||||
for (String foo : <selection>foos</selection>) {
|
||||
|
||||
}
|
||||
System.out.println(foos.length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Test {
|
||||
String[] foos;
|
||||
|
||||
void test() {
|
||||
for (String foo : newMethod()) {
|
||||
|
||||
}
|
||||
System.out.println(newMethod().length);
|
||||
}
|
||||
|
||||
private String[] newMethod() {
|
||||
return foos;
|
||||
}
|
||||
}
|
||||
@@ -579,6 +579,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
public void testArrayReturnType() throws Exception {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
private void doTestDisabledParam() throws PrepareFailedException {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
|
||||
settings.ELSE_ON_NEW_LINE = true;
|
||||
|
||||
Reference in New Issue
Block a user