mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+35
-14
@@ -48,7 +48,6 @@ import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewDescriptor;
|
||||
import com.intellij.usageView.UsageViewUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import java.util.HashSet;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import gnu.trove.TIntArrayList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -56,6 +55,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -126,20 +126,23 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
myParameterInitializer = parameterInitializer;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected UsageViewDescriptor createUsageViewDescriptor(@NotNull UsageInfo[] usages) {
|
||||
return new IntroduceParameterViewDescriptor(myMethodToSearchFor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiType getForcedType() {
|
||||
return myForcedType;
|
||||
}
|
||||
|
||||
public void setForcedType(PsiType forcedType) {
|
||||
private void setForcedType(PsiType forcedType) {
|
||||
myForcedType = forcedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getReplaceFieldsWithGetters() {
|
||||
return myReplaceFieldsWithGetters;
|
||||
}
|
||||
@@ -148,6 +151,7 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
myReplaceFieldsWithGetters = replaceFieldsWithGetters;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected UsageInfo[] findUsages() {
|
||||
ArrayList<UsageInfo> result = new ArrayList<>();
|
||||
@@ -227,6 +231,7 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
|
||||
UsageInfo[] usagesIn = refUsages.get();
|
||||
MultiMap<PsiElement, String> conflicts = new MultiMap<>();
|
||||
@@ -247,8 +252,9 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
myParameterInitializer.accept(anySupers);
|
||||
if (anySupers.isResult()) {
|
||||
for (UsageInfo usageInfo : usagesIn) {
|
||||
if (!(usageInfo.getElement() instanceof PsiMethod) && !(usageInfo instanceof InternalUsageInfo)) {
|
||||
if (!PsiTreeUtil.isAncestor(myMethodToReplaceIn.getContainingClass(), usageInfo.getElement(), false)) {
|
||||
PsiElement element = usageInfo.getElement();
|
||||
if (!(element instanceof PsiMethod) && !(usageInfo instanceof InternalUsageInfo)) {
|
||||
if (!PsiTreeUtil.isAncestor(myMethodToReplaceIn.getContainingClass(), element, false)) {
|
||||
String message = RefactoringBundle.message("parameter.initializer.contains.0.but.not.all.calls.to.method.are.in.its.class",
|
||||
CommonRefactoringUtil.htmlEmphasize(PsiKeyword.SUPER));
|
||||
conflicts.putValue(myParameterInitializer, message);
|
||||
@@ -371,6 +377,7 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
return afterData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void performRefactoring(@NotNull UsageInfo[] usages) {
|
||||
try {
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(myManager.getProject()).getElementFactory();
|
||||
@@ -472,7 +479,8 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
MethodDuplicatesHandler.invokeOnScope(myProject, Collections.singleton(myMethodToReplaceIn),
|
||||
new AnalysisScope(myMethodToReplaceIn.getContainingFile()), true);
|
||||
};
|
||||
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(runnable), "Search method duplicates...", true, myProject);
|
||||
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(runnable),
|
||||
"Search Method Duplicates...", true, myProject);
|
||||
}
|
||||
|
||||
private PsiMethod generateDelegate(final PsiMethod methodToReplaceIn) throws IncorrectOperationException {
|
||||
@@ -511,20 +519,24 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
final PsiType initializerType;
|
||||
if (forcedType == null) {
|
||||
if (parameterInitializer == null) {
|
||||
if (localVariable != null) {
|
||||
initializerType = localVariable.getType();
|
||||
} else {
|
||||
LOG.assertTrue(false);
|
||||
if (localVariable == null) {
|
||||
LOG.error("all null");
|
||||
initializerType = null;
|
||||
}
|
||||
} else {
|
||||
if (localVariable == null) {
|
||||
initializerType = RefactoringUtil.getTypeByExpressionWithExpectedType(parameterInitializer);
|
||||
} else {
|
||||
else {
|
||||
initializerType = localVariable.getType();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
else {
|
||||
if (localVariable == null) {
|
||||
initializerType = RefactoringUtil.getTypeByExpressionWithExpectedType(parameterInitializer);
|
||||
}
|
||||
else {
|
||||
initializerType = localVariable.getType();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
initializerType = forcedType;
|
||||
}
|
||||
return initializerType;
|
||||
@@ -593,6 +605,7 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String getCommandName() {
|
||||
return RefactoringBundle.message("introduce.parameter.command", DescriptiveNameUtil.getDescriptiveName(myMethodToReplaceIn));
|
||||
@@ -615,37 +628,45 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
return anchorParameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiMethod getMethodToReplaceIn() {
|
||||
return myMethodToReplaceIn;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiMethod getMethodToSearchFor() {
|
||||
return myMethodToSearchFor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaExpressionWrapper getParameterInitializer() {
|
||||
return myInitializerWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getParameterName() {
|
||||
return myParameterName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeclareFinal() {
|
||||
return myDeclareFinal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGenerateDelegate() {
|
||||
return myGenerateDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TIntArrayList getParametersToRemove() {
|
||||
return myParametersToRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
|
||||
+128
-112
@@ -25,33 +25,36 @@ import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testFromCompletion() {
|
||||
myFixture.configureByText("a.java", "public class Foo {\n" +
|
||||
" private final String text;\n" +
|
||||
"\n" +
|
||||
" public Foo(String text) {\n" +
|
||||
"// this.text = text;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" public Foo(int i) {\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" public static void main(String[] args) {\n" +
|
||||
" final Foo foo = new Foo(\"\");\n" +
|
||||
" foo.to<caret>\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" @Override\n" +
|
||||
" public String toString() {\n" +
|
||||
" return \"text\";\n" +
|
||||
" }\n" +
|
||||
" public void totttt(){}" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "public class Foo {\n" +
|
||||
" private final String text;\n" +
|
||||
"\n" +
|
||||
" public Foo(String text) {\n" +
|
||||
"// this.text = text;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" public Foo(int i) {\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" public static void main(String[] args) {\n" +
|
||||
" final Foo foo = new Foo(\"\");\n" +
|
||||
" foo.to<caret>\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" @Override\n" +
|
||||
" public String toString() {\n" +
|
||||
" return \"text\";\n" +
|
||||
" }\n" +
|
||||
" public void totttt(){}" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
myFixture.completeBasic();
|
||||
|
||||
PsiElement element =
|
||||
@@ -67,21 +70,23 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testFromEditor() {
|
||||
myFixture.configureByText("a.java", "public class Foo {\n" +
|
||||
" private final String text;\n" +
|
||||
"\n" +
|
||||
" public Foo(String text) {\n" +
|
||||
"// this.text = text;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" public Foo(int i) {\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" @Override\n" +
|
||||
" public String to<caret>String() {\n" +
|
||||
" return \"text\";\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "public class Foo {\n" +
|
||||
" private final String text;\n" +
|
||||
"\n" +
|
||||
" public Foo(String text) {\n" +
|
||||
"// this.text = text;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" public Foo(int i) {\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" @Override\n" +
|
||||
" public String to<caret>String() {\n" +
|
||||
" return \"text\";\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PsiElement element =
|
||||
TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
@@ -109,28 +114,30 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testInnerClasses() {
|
||||
myFixture.configureByText("a.java", "abstract class AF<caret>oo{\n" +
|
||||
" abstract boolean aaa();\n" +
|
||||
" static class AFoo1 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo3 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo2 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" \n" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "abstract class AF<caret>oo{\n" +
|
||||
" abstract boolean aaa();\n" +
|
||||
" static class AFoo1 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo3 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo2 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" \n" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PsiClass psiClass =
|
||||
(PsiClass)TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
@@ -155,14 +162,16 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testFunctionalInterface() {
|
||||
myFixture.configureByText("a.java", "interface AF<caret>oo{\n" +
|
||||
" boolean aaa();\n" +
|
||||
"}\n" +
|
||||
"class AFooImpl {\n" +
|
||||
" {\n" +
|
||||
" AFoo a = () -> {return false;};\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "interface AF<caret>oo{\n" +
|
||||
" boolean aaa();\n" +
|
||||
"}\n" +
|
||||
"class AFooImpl {\n" +
|
||||
" {\n" +
|
||||
" AFoo a = () -> {return false;};\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PsiClass psiClass =
|
||||
(PsiClass)TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
@@ -176,10 +185,12 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testInterfaceConstants() {
|
||||
myFixture.configureByText("a.java", "interface AF<caret>oo{\n" +
|
||||
" AFoo IMPL = new AFoo(){};\n" +
|
||||
" boolean aaa();\n" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "interface AF<caret>oo{\n" +
|
||||
" AFoo IMPL = new AFoo(){};\n" +
|
||||
" boolean aaa();\n" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PsiClass psiClass =
|
||||
(PsiClass)TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
@@ -193,14 +204,16 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testInterfaceMethodOfFunctionalInterface() {
|
||||
myFixture.configureByText("a.java", "interface AFoo{\n" +
|
||||
" boolean a<caret>aa();\n" +
|
||||
"}\n" +
|
||||
"class AFooImpl {\n" +
|
||||
" {\n" +
|
||||
" AFoo a = () -> {return false;};\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "interface AFoo{\n" +
|
||||
" boolean a<caret>aa();\n" +
|
||||
"}\n" +
|
||||
"class AFooImpl {\n" +
|
||||
" {\n" +
|
||||
" AFoo a = () -> {return false;};\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PsiMethod psiMethod =
|
||||
(PsiMethod)TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
@@ -220,15 +233,17 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testDefaultMethodOfFunctionalInterface() {
|
||||
myFixture.configureByText("a.java", "interface AFoo{\n" +
|
||||
" default boolean a<caret>aa(){}\n" +
|
||||
" boolean bbb();" +
|
||||
"}\n" +
|
||||
"class AFooImpl {\n" +
|
||||
" {\n" +
|
||||
" AFoo a = () -> {return false;};\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "interface AFoo{\n" +
|
||||
" default boolean a<caret>aa(){}\n" +
|
||||
" boolean bbb();" +
|
||||
"}\n" +
|
||||
"class AFooImpl {\n" +
|
||||
" {\n" +
|
||||
" AFoo a = () -> {return false;};\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PsiMethod psiMethod =
|
||||
(PsiMethod)TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
@@ -242,28 +257,30 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testMethodsInInnerClasses() {
|
||||
myFixture.configureByText("a.java", "abstract class AFoo{\n" +
|
||||
" abstract boolean a<caret>aa();\n" +
|
||||
" static class AFoo1 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo3 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo2 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" \n" +
|
||||
"}");
|
||||
@Language("JAVA")
|
||||
String text = "abstract class AFoo{\n" +
|
||||
" abstract boolean a<caret>aa();\n" +
|
||||
" static class AFoo1 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo3 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" static class AFoo2 extends AFoo {\n" +
|
||||
" @Override\n" +
|
||||
" boolean aaa() {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" \n" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PsiMethod psiMethod =
|
||||
(PsiMethod)TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
@@ -274,14 +291,13 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
all.addAll(methods);
|
||||
|
||||
//make sure they are in predefined order
|
||||
Collections.sort(all, (o1, o2) -> o1.getContainingClass().getQualifiedName()
|
||||
.compareTo(o2.getContainingClass().getQualifiedName()));
|
||||
Collections.sort(all, Comparator.comparing(o -> o.getContainingClass().getQualifiedName()));
|
||||
final ImplementationViewComponent component =
|
||||
new ImplementationViewComponent(all.toArray(PsiElement.EMPTY_ARRAY), 0);
|
||||
assertContent(component, new String[]{"a.java (AFoo)", "a.java (AFoo1 in AFoo)", "a.java (AFoo2 in AFoo)", "a.java (AFoo3 in AFoo)"});
|
||||
}
|
||||
|
||||
public static void assertContent(ImplementationViewComponent component, String[] expects) {
|
||||
private static void assertContent(ImplementationViewComponent component, String[] expects) {
|
||||
try {
|
||||
final String[] visibleFiles = component.getVisibleFiles();
|
||||
Assert.assertArrayEquals(Arrays.toString(visibleFiles), expects, visibleFiles);
|
||||
|
||||
+3
-2
@@ -26,6 +26,7 @@ import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.messages.MessageBusFactory;
|
||||
@@ -59,7 +60,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
|
||||
private int myInstantiatedComponentCount = -1;
|
||||
private boolean myComponentsCreated;
|
||||
|
||||
private final List<BaseComponent> myBaseComponents = new ArrayList<>();
|
||||
private final List<BaseComponent> myBaseComponents = new SmartList<>();
|
||||
|
||||
private final ComponentManager myParentComponentManager;
|
||||
private final Condition myDisposedCondition = o -> isDisposed();
|
||||
@@ -280,13 +281,13 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
|
||||
|
||||
@NotNull
|
||||
private List<ComponentConfig> getComponentConfigs(final ProgressIndicator indicator) {
|
||||
ArrayList<ComponentConfig> componentConfigs = new ArrayList<>();
|
||||
boolean isDefaultProject = this instanceof Project && ((Project)this).isDefault();
|
||||
boolean headless = ApplicationManager.getApplication().isHeadlessEnvironment();
|
||||
StartupProgress startupProgress = null;
|
||||
if (indicator != null) {
|
||||
startupProgress = (message, progress) -> indicator.setFraction(progress);
|
||||
}
|
||||
ArrayList<ComponentConfig> componentConfigs = new ArrayList<>();
|
||||
for (IdeaPluginDescriptor plugin : PluginManagerCore.getPlugins(startupProgress)) {
|
||||
if (PluginManagerCore.shouldSkipPlugin(plugin)) {
|
||||
continue;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DefaultPicoContainer implements AreaPicoContainer {
|
||||
return componentAdapters.getImmutableSet();
|
||||
}
|
||||
|
||||
private void appendNonAssignableAdaptersOfType(@NotNull Class componentType, @NotNull List<ComponentAdapter> result) {
|
||||
private void appendNonAssignableAdaptersOfType(@NotNull Class componentType, @NotNull List<? super ComponentAdapter> result) {
|
||||
List<ComponentAdapter> comp = new ArrayList<>();
|
||||
for (final ComponentAdapter componentAdapter : nonAssignableComponentAdapters.get()) {
|
||||
if (ReflectionUtil.isAssignable(componentType, componentAdapter.getComponentImplementation())) {
|
||||
@@ -185,6 +185,7 @@ public class DefaultPicoContainer implements AreaPicoContainer {
|
||||
return result;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface LazyComponentAdapter {
|
||||
boolean isComponentInstantiated();
|
||||
}
|
||||
@@ -201,9 +202,7 @@ public class DefaultPicoContainer implements AreaPicoContainer {
|
||||
//noinspection unchecked
|
||||
return (T)getLocalInstance(adapter);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -265,7 +264,7 @@ public class DefaultPicoContainer implements AreaPicoContainer {
|
||||
public ComponentAdapter unregisterComponentByInstance(@NotNull Object componentInstance) {
|
||||
for (ComponentAdapter adapter : getComponentAdapters()) {
|
||||
Object o = getInstance(adapter);
|
||||
if (o != null && o.equals(componentInstance)) {
|
||||
if (componentInstance.equals(o)) {
|
||||
return unregisterComponent(adapter.getComponentKey());
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
@@ -29,15 +28,15 @@ public class UnnecessarySuperQualifierInspectionTest extends LightInspectionTest
|
||||
}
|
||||
|
||||
public void testIgnoreClarificationSuperQualifier() {
|
||||
UnnecessarySuperQualifierInspection inspection = (UnnecessarySuperQualifierInspection)getInspection();
|
||||
UnnecessarySuperQualifierInspection inspection = getInspection();
|
||||
inspection.ignoreClarification = true;
|
||||
myFixture.enableInspections(inspection);
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
protected UnnecessarySuperQualifierInspection getInspection() {
|
||||
return new UnnecessarySuperQualifierInspection();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user