mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-78870 Idea imports unnecessary class when I'm creating anonymous class
This commit is contained in:
@@ -179,15 +179,16 @@ public class JavaResolveUtil {
|
||||
final ResolveState state,
|
||||
final PsiElement place,
|
||||
PsiManager manager) {
|
||||
PsiPackage defaultPackage = JavaPsiFacade.getInstance(manager.getProject()).findPackage("");
|
||||
if (defaultPackage != null) {
|
||||
if (!defaultPackage.processDeclarations(processor, state, null, place)) return false;
|
||||
}
|
||||
|
||||
PsiPackage langPackage = JavaPsiFacade.getInstance(manager.getProject()).findPackage(CommonClassNames.DEFAULT_PACKAGE);
|
||||
if (langPackage != null) {
|
||||
if (!langPackage.processDeclarations(processor, state, null, place)) return false;
|
||||
}
|
||||
|
||||
PsiPackage defaultPackage = JavaPsiFacade.getInstance(manager.getProject()).findPackage("");
|
||||
if (defaultPackage != null) {
|
||||
if (!defaultPackage.processDeclarations(processor, state, null, place)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Runner {
|
||||
public static void main(String[] args) {
|
||||
List<Process> src;
|
||||
List<Process> dest = ListUtils.filter(src, new <caret>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Runner {
|
||||
public static void main(String[] args) {
|
||||
List<Process> src;
|
||||
List<Process> dest = ListUtils.filter(src, new Pred<Process>() {
|
||||
@Override
|
||||
public boolean predicate(Process elem) {
|
||||
<selection><caret>return false; //To change body of implemented methods use File | Settings | File Templates.</selection>
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+15
@@ -478,6 +478,21 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
checkResult()
|
||||
}
|
||||
|
||||
public void testAnonymousProcess() {
|
||||
myFixture.addClass 'package java.lang; public class Process {}'
|
||||
myFixture.addClass '''
|
||||
import java.util.*;
|
||||
public class Process {}
|
||||
interface Pred <A> { boolean predicate(A elem); }
|
||||
public class ListUtils {
|
||||
public static <A> List<A> filter(List<A> list, Pred<A> pred) {}
|
||||
}
|
||||
'''
|
||||
configure()
|
||||
type '\n'
|
||||
checkResult()
|
||||
}
|
||||
|
||||
public void testNoThisInComment() throws Throwable { doAntiTest() }
|
||||
|
||||
public void testLastExpressionInFor() throws Throwable { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user