diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DebuggerDfaRunner.java b/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DebuggerDfaRunner.java index 580eedcbba56..b6c448663ac0 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DebuggerDfaRunner.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DebuggerDfaRunner.java @@ -30,7 +30,7 @@ class DebuggerDfaRunner extends DataFlowRunner { }; private static final Set COLLECTIONS_WITH_SIZE_FIELD = ContainerUtil.immutableSet(CommonClassNames.JAVA_UTIL_ARRAY_LIST, - "java.util.LinkedList", + CommonClassNames.JAVA_UTIL_LINKED_LIST, CommonClassNames.JAVA_UTIL_HASH_MAP, "java.util.TreeMap"); private final @NotNull PsiCodeBlock myBody; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java index d2f270851ebf..0bf2cb84cc08 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.dataFlow; import com.intellij.codeInspection.dataFlow.StandardMethodContract.ValueConstraint; @@ -55,7 +41,7 @@ public class HardcodedContracts { ); private static final CallMatcher QUEUE_POLL = anyOf( - instanceCall("java.util.Queue", "poll").parameterCount(0), + instanceCall(JAVA_UTIL_QUEUE, "poll").parameterCount(0), instanceCall("java.util.Deque", "pollFirst", "pollLast").parameterCount(0) ); @@ -109,9 +95,9 @@ public class HardcodedContracts { .register(instanceCall(JAVA_UTIL_LIST, "get", "remove").parameterTypes("int"), ContractProvider.of(specialFieldRangeContract(0, RelationType.LT, SpecialField.COLLECTION_SIZE))) .register(anyOf( - instanceCall("java.util.SortedSet", "first", "last").parameterCount(0), + instanceCall(JAVA_UTIL_SORTED_SET, "first", "last").parameterCount(0), instanceCall("java.util.Deque", "getFirst", "getLast").parameterCount(0), - instanceCall("java.util.Queue", "element").parameterCount(0)), + instanceCall(JAVA_UTIL_QUEUE, "element").parameterCount(0)), ContractProvider.of(singleConditionContract( ContractValue.qualifier().specialField(SpecialField.COLLECTION_SIZE), RelationType.EQ, ContractValue.zero(), fail()))) @@ -122,7 +108,7 @@ public class HardcodedContracts { .register(staticCall("org.mockito.ArgumentMatchers", "argThat").parameterCount(1), ContractProvider.of(StandardMethodContract.fromText("_->_"))) .register(anyOf( - instanceCall("java.util.Queue", "peek", "poll").parameterCount(0), + instanceCall(JAVA_UTIL_QUEUE, "peek", "poll").parameterCount(0), instanceCall("java.util.Deque", "peekFirst", "peekLast", "pollFirst", "pollLast").parameterCount(0)), (call, paramCount) -> Arrays.asList(singleConditionContract( ContractValue.qualifier().specialField(SpecialField.COLLECTION_SIZE), RelationType.EQ, diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/CollectionsUtilityMethodsProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/CollectionsUtilityMethodsProvider.java index 537e89df1bbe..789b565c555e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/CollectionsUtilityMethodsProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/CollectionsUtilityMethodsProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.AutoCompletionPolicy; @@ -68,7 +54,7 @@ class CollectionsUtilityMethodsProvider { addCollectionMethod(JAVA_UTIL_LIST, "unmodifiableList", collectionsClass); addCollectionMethod(JAVA_UTIL_SET, "unmodifiableSet", collectionsClass); addCollectionMethod(JAVA_UTIL_MAP, "unmodifiableMap", collectionsClass); - addCollectionMethod("java.util.SortedSet", "unmodifiableSortedSet", collectionsClass); + addCollectionMethod(JAVA_UTIL_SORTED_SET, "unmodifiableSortedSet", collectionsClass); addCollectionMethod("java.util.SortedMap", "unmodifiableSortedMap", collectionsClass); } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/WrapWithUnmodifiableAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/WrapWithUnmodifiableAction.java index 4448b45f04a6..2f94ad691c27 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/WrapWithUnmodifiableAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/WrapWithUnmodifiableAction.java @@ -29,7 +29,6 @@ import static com.intellij.util.ObjectUtils.tryCast; * @author Pavel.Dolgov */ public class WrapWithUnmodifiableAction extends BaseIntentionAction { - private static final String JAVA_UTIL_SORTED_SET = "java.util.SortedSet"; private static final String JAVA_UTIL_SORTED_MAP = "java.util.SortedMap"; @Override diff --git a/java/java-impl/src/com/intellij/codeInspection/streamMigration/CollectMigration.java b/java/java-impl/src/com/intellij/codeInspection/streamMigration/CollectMigration.java index 59f72f1aae67..ac4cf94b3f4c 100644 --- a/java/java-impl/src/com/intellij/codeInspection/streamMigration/CollectMigration.java +++ b/java/java-impl/src/com/intellij/codeInspection/streamMigration/CollectMigration.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.streamMigration; import com.intellij.codeInsight.Nullability; @@ -41,9 +41,9 @@ class CollectMigration extends BaseStreamApiMigration { static final Map INTERMEDIATE_STEPS = EntryStream.of( CommonClassNames.JAVA_UTIL_ARRAY_LIST, "", - "java.util.LinkedList", "", + CommonClassNames.JAVA_UTIL_LINKED_LIST, "", CommonClassNames.JAVA_UTIL_HASH_SET, ".distinct()", - "java.util.LinkedHashSet", ".distinct()", + CommonClassNames.JAVA_UTIL_LINKED_HASH_SET, ".distinct()", "java.util.TreeSet", ".distinct().sorted()" ).toMap(); @@ -897,7 +897,7 @@ class CollectMigration extends BaseStreamApiMigration { static class UnmodifiableTerminal extends RecreateTerminal { private static final Map TYPE_TO_UNMODIFIABLE_WRAPPER = EntryStream.of( CommonClassNames.JAVA_UTIL_ARRAY_LIST, "toUnmodifiableList", - "java.util.LinkedList", "toUnmodifiableList", + CommonClassNames.JAVA_UTIL_LINKED_LIST, "toUnmodifiableList", CommonClassNames.JAVA_UTIL_HASH_SET, "toUnmodifiableSet", CommonClassNames.JAVA_UTIL_HASH_MAP, "toUnmodifiableMap" ).toMap(); diff --git a/platform/core-api/src/com/intellij/psi/CommonClassNames.java b/platform/core-api/src/com/intellij/psi/CommonClassNames.java index 68781a2f7a7b..f7c5b5f2688e 100644 --- a/platform/core-api/src/com/intellij/psi/CommonClassNames.java +++ b/platform/core-api/src/com/intellij/psi/CommonClassNames.java @@ -47,8 +47,13 @@ public interface CommonClassNames { String JAVA_UTIL_CONCURRENT_HASH_MAP = "java.util.concurrent.ConcurrentHashMap"; String JAVA_UTIL_LIST = "java.util.List"; String JAVA_UTIL_ARRAY_LIST = "java.util.ArrayList"; + String JAVA_UTIL_LINKED_LIST = "java.util.LinkedList"; String JAVA_UTIL_SET = "java.util.Set"; String JAVA_UTIL_HASH_SET = "java.util.HashSet"; + String JAVA_UTIL_LINKED_HASH_SET = "java.util.LinkedHashSet"; + String JAVA_UTIL_SORTED_SET = "java.util.SortedSet"; + String JAVA_UTIL_QUEUE = "java.util.Queue"; + String JAVA_UTIL_STACK = "java.util.Stack"; String JAVA_UTIL_PROPERTIES = "java.util.Properties"; String JAVA_UTIL_PROPERTY_RESOURCE_BUNDLE = "java.util.PropertyResourceBundle"; String JAVA_UTIL_DATE = "java.util.Date"; diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/SetReplaceableByEnumSetInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/SetReplaceableByEnumSetInspection.java index 327269d9f92c..d64f9d185ef3 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/SetReplaceableByEnumSetInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/SetReplaceableByEnumSetInspection.java @@ -74,7 +74,7 @@ public class SetReplaceableByEnumSetInspection extends BaseInspection { @Override protected List getUnreplaceableCollectionNames() { return Arrays.asList("java.util.concurrent.CopyOnWriteArraySet", "java.util.concurrent.ConcurrentSkipListSet", - "java.util.LinkedHashSet"); + CommonClassNames.JAVA_UTIL_LINKED_HASH_SET); } @NotNull diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/CollectionUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/CollectionUtils.java index 280421adf846..de27e09368a8 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/CollectionUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/CollectionUtils.java @@ -74,16 +74,16 @@ public class CollectionUtils { "java.util.Hashtable", "java.util.IdentityHashMap", "java.util.LinkedHashMap", - "java.util.LinkedHashSet", - "java.util.LinkedList", + CommonClassNames.JAVA_UTIL_LINKED_HASH_SET, + CommonClassNames.JAVA_UTIL_LINKED_LIST, CommonClassNames.JAVA_UTIL_LIST, CommonClassNames.JAVA_UTIL_MAP, "java.util.PriorityQueue", - "java.util.Queue", + CommonClassNames.JAVA_UTIL_QUEUE, CommonClassNames.JAVA_UTIL_SET, "java.util.SortedMap", - "java.util.SortedSet", - "java.util.Stack", + CommonClassNames.JAVA_UTIL_SORTED_SET, + CommonClassNames.JAVA_UTIL_STACK, "java.util.TreeMap", "java.util.TreeSet", "java.util.Vector", @@ -144,9 +144,9 @@ public class CollectionUtils { s_interfaceForCollection.put("java.util.Hashtable", CommonClassNames.JAVA_UTIL_MAP); s_interfaceForCollection.put("java.util.IdentityHashMap", CommonClassNames.JAVA_UTIL_MAP); s_interfaceForCollection.put("java.util.LinkedHashMap", CommonClassNames.JAVA_UTIL_MAP); - s_interfaceForCollection.put("java.util.LinkedHashSet", CommonClassNames.JAVA_UTIL_SET); - s_interfaceForCollection.put("java.util.LinkedList", CommonClassNames.JAVA_UTIL_LIST); - s_interfaceForCollection.put("java.util.PriorityQueue", "java.util.Queue"); + s_interfaceForCollection.put(CommonClassNames.JAVA_UTIL_LINKED_HASH_SET, CommonClassNames.JAVA_UTIL_SET); + s_interfaceForCollection.put(CommonClassNames.JAVA_UTIL_LINKED_LIST, CommonClassNames.JAVA_UTIL_LIST); + s_interfaceForCollection.put("java.util.PriorityQueue", CommonClassNames.JAVA_UTIL_QUEUE); s_interfaceForCollection.put("java.util.TreeMap", CommonClassNames.JAVA_UTIL_MAP); s_interfaceForCollection.put("java.util.TreeSet", CommonClassNames.JAVA_UTIL_SET); s_interfaceForCollection.put("java.util.Vector", CommonClassNames.JAVA_UTIL_LIST); diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspection.java index 2898a9797086..afd71b47c299 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspection.java @@ -63,7 +63,7 @@ public class MismatchedCollectionQueryUpdateInspection CollectionUtils.DERIVED_COLLECTION, CallMatcher.instanceCall(CommonClassNames.JAVA_UTIL_LIST, "subList"), CallMatcher.instanceCall("java.util.SortedMap", "headMap", "tailMap", "subMap"), - CallMatcher.instanceCall("java.util.SortedSet", "headSet", "tailSet", "subSet")); + CallMatcher.instanceCall(CommonClassNames.JAVA_UTIL_SORTED_SET, "headSet", "tailSet", "subSet")); private static final CallMatcher COLLECTION_SAFE_ARGUMENT_METHODS = CallMatcher.anyOf( CallMatcher.instanceCall(CommonClassNames.JAVA_UTIL_COLLECTION, "addAll", "removeAll", "containsAll", "remove"), diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/ReturnOfCollectionFieldFix.java b/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/ReturnOfCollectionFieldFix.java index cb3aac74ba6c..d9cc392c48b7 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/ReturnOfCollectionFieldFix.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/ReturnOfCollectionFieldFix.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.siyeh.ig.encapsulation; import com.intellij.codeInspection.CommonQuickFixBundle; @@ -40,8 +40,8 @@ class ReturnOfCollectionFieldFix extends InspectionGadgetsFix { } else if (TypeUtils.expressionHasTypeOrSubtype(referenceExpression, CommonClassNames.JAVA_UTIL_COLLECTION)) { if (TypeUtils.expressionHasTypeOrSubtype(referenceExpression, CommonClassNames.JAVA_UTIL_SET)) { - if (TypeUtils.expressionHasTypeOrSubtype(referenceExpression, "java.util.SortedSet")) { - return new ReturnOfCollectionFieldFix("java.util.Collections.unmodifiableSortedSet(" + text + ')', "java.util.SortedSet"); + if (TypeUtils.expressionHasTypeOrSubtype(referenceExpression, CommonClassNames.JAVA_UTIL_SORTED_SET)) { + return new ReturnOfCollectionFieldFix("java.util.Collections.unmodifiableSortedSet(" + text + ')', CommonClassNames.JAVA_UTIL_SORTED_SET); } return new ReturnOfCollectionFieldFix("java.util.Collections.unmodifiableSet(" + text + ')', CommonClassNames.JAVA_UTIL_SET); } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/MethodCallInLoopConditionInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/MethodCallInLoopConditionInspection.java index 7996edf551f5..a7f45fe59585 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/MethodCallInLoopConditionInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/MethodCallInLoopConditionInspection.java @@ -118,7 +118,7 @@ public class MethodCallInLoopConditionInspection extends BaseInspection { MethodCallUtils.isCallToMethod(expression, "java.util.ListIterator", PsiType.BOOLEAN, "hasPrevious") || MethodCallUtils.isCallToMethod(expression, "java.sql.ResultSet", PsiType.BOOLEAN, "next") || MethodCallUtils.isCallToMethod(expression, "java.util.Enumeration", PsiType.BOOLEAN, "hasMoreElements") || - MethodCallUtils.isCallToMethod(expression, "java.util.Queue", null, "poll") || + MethodCallUtils.isCallToMethod(expression, CommonClassNames.JAVA_UTIL_QUEUE, null, "poll") || MethodCallUtils.isCallToMethod(expression, "java.lang.ref.ReferenceQueue", null, "poll"); } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CollectionsListSettings.java b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CollectionsListSettings.java index 1dea194c6c90..b75d793f4ee5 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CollectionsListSettings.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CollectionsListSettings.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.siyeh.ig.performance; import com.intellij.codeInsight.daemon.QuickFixBundle; @@ -48,7 +34,7 @@ public abstract class CollectionsListSettings { set.add("java.util.HashSet"); set.add("java.util.IdentityHashMap"); set.add("java.util.LinkedHashMap"); - set.add("java.util.LinkedHashSet"); + set.add(CommonClassNames.JAVA_UTIL_LINKED_HASH_SET); set.add("java.util.PriorityQueue"); set.add("java.util.Vector"); set.add("java.util.WeakHashMap"); diff --git a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorTest.java b/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorTest.java index e0d13491f1cc..993bc402ccdb 100644 --- a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorTest.java +++ b/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorTest.java @@ -3,6 +3,7 @@ package org.jetbrains.idea.devkit.util; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.CommonClassNames; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; @@ -62,7 +63,7 @@ public class ExtensionLocatorTest extends LightJavaCodeInsightFixtureTestCase { myFixture.copyFileToProject("SomeClass.java"); PsiClass arrayListPsiClass = myFixture.findClass("java.util.ArrayList"); - PsiClass linkedListPsiClass = myFixture.findClass("java.util.LinkedList"); + PsiClass linkedListPsiClass = myFixture.findClass(CommonClassNames.JAVA_UTIL_LINKED_LIST); PsiClass myList1PsiClass = myFixture.findClass("SomeClass.MyList1"); PsiClass myList2PsiClass = myFixture.findClass("SomeClass.MyList2"); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/CollectionUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/CollectionUtil.java index c20f61a79302..b77cfdb6de9d 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/CollectionUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/CollectionUtil.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions; import com.intellij.openapi.project.Project; @@ -24,20 +10,20 @@ import org.jetbrains.annotations.Nullable; public class CollectionUtil { @Nullable public static PsiClassType createSimilarCollection(@Nullable PsiType collection, Project project, PsiType... itemType) { - if (InheritanceUtil.isInheritor(collection, "java.util.SortedSet")) { - return createCollection(project, "java.util.SortedSet", itemType); + if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_SORTED_SET)) { + return createCollection(project, CommonClassNames.JAVA_UTIL_SORTED_SET, itemType); } - if (InheritanceUtil.isInheritor(collection, "java.util.LinkedHashSet")) { - return createCollection(project, "java.util.LinkedHashSet", itemType); + if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_LINKED_HASH_SET)) { + return createCollection(project, CommonClassNames.JAVA_UTIL_LINKED_HASH_SET, itemType); } if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_SET)) { return createCollection(project, "java.util.HashSet", itemType); } - if (InheritanceUtil.isInheritor(collection, "java.util.LinkedList")) { - return createCollection(project, "java.util.LInkedList", itemType); + if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_LINKED_LIST)) { + return createCollection(project, CommonClassNames.JAVA_UTIL_LINKED_LIST, itemType); } - if (InheritanceUtil.isInheritor(collection, "java.util.Stack")) { - return createCollection(project, "java.util.Stack", itemType); + if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_STACK)) { + return createCollection(project, CommonClassNames.JAVA_UTIL_STACK, itemType); } if (InheritanceUtil.isInheritor(collection, "java.util.Vector")) { return createCollection(project, "java.util.Vector", itemType); @@ -45,8 +31,8 @@ public class CollectionUtil { if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_LIST)) { return createCollection(project, "java.util.ArrayList", itemType); } - if (InheritanceUtil.isInheritor(collection, "java.util.Queue")) { - return createCollection(project, "java.util.LinkedList", itemType); + if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_QUEUE)) { + return createCollection(project, CommonClassNames.JAVA_UTIL_LINKED_LIST, itemType); } return createCollection(project, "java.util.ArrayList", itemType); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginConfigurationDomExtender.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginConfigurationDomExtender.java index 497da19b1dbd..19a8c6774628 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginConfigurationDomExtender.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginConfigurationDomExtender.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.dom; import com.intellij.openapi.util.Key; @@ -51,7 +37,7 @@ public class MavenPluginConfigurationDomExtender extends DomExtender COLLECTIONS_TYPE_NAMES = ContainerUtil.immutableSet("java.util.Collection", CommonClassNames.JAVA_UTIL_SET, CommonClassNames.JAVA_UTIL_LIST, "java.util.ArrayList", "java.util.HashSet", - "java.util.LinkedList"); + CommonClassNames.JAVA_UTIL_LINKED_LIST); @Override public void registerExtensions(@NotNull MavenDomConfiguration config, @NotNull DomExtensionsRegistrar r) {