diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfoExternalizer.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfoExternalizer.java index ffaa5d227fcd..a807bd59f126 100644 --- a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfoExternalizer.java +++ b/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfoExternalizer.java @@ -57,7 +57,7 @@ public class MemberInfoExternalizer { else if (tag == FIELD_INFO_TAG) { return new FieldInfo(in); } - LOG.assertTrue(false, "Unknown member info"); + LOG.error("Unknown member info"); return null; } @@ -69,7 +69,7 @@ public class MemberInfoExternalizer { else if (tag == MEMBER_REFERENCE_INFO_TAG) { return new MemberReferenceInfo(in); } - LOG.assertTrue(false, "Unknown declaration info tag: " + tag); + LOG.error("Unknown declaration info tag: " + tag); return null; } @@ -108,7 +108,7 @@ public class MemberInfoExternalizer { else if (tag == ENUM_CONSTANT_VALUE_TAG) { return new EnumConstantValue(in); } - LOG.assertTrue(false, "Unknown constant value type " + tag); + LOG.error("Unknown constant value type " + tag); return null; } @@ -120,7 +120,7 @@ public class MemberInfoExternalizer { out.writeByte(FIELD_INFO_TAG); } else { - LOG.assertTrue(false, "Unknown member info"); + LOG.error("Unknown member info"); } info.save(out); } diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/MethodInfo.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/MethodInfo.java index 1aa0cda20e28..c18d9ae801d7 100644 --- a/java/compiler/impl/src/com/intellij/compiler/classParsing/MethodInfo.java +++ b/java/compiler/impl/src/com/intellij/compiler/classParsing/MethodInfo.java @@ -161,7 +161,7 @@ public class MethodInfo extends MemberInfo { String descriptor = symbolTable.getSymbol(getDescriptor()); int endIndex = descriptor.indexOf(')'); if (endIndex <= 0) { - LOG.assertTrue(false, "Corrupted method descriptor: "+descriptor); + LOG.error("Corrupted method descriptor: " + descriptor); } myParameterDescriptors = parseParameterDescriptors(descriptor.substring(1, endIndex)); } diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/OneProjectItemCompileScope.java b/java/compiler/impl/src/com/intellij/compiler/impl/OneProjectItemCompileScope.java index c815ecde5e45..d85b28af44e8 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/OneProjectItemCompileScope.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/OneProjectItemCompileScope.java @@ -71,7 +71,7 @@ public class OneProjectItemCompileScope extends UserDataHolderBase implements Co public Module[] getAffectedModules() { final Module module = ModuleUtil.findModuleForFile(myFile, myProject); if (module == null) { - LOG.assertTrue(false, "Module is null for file " + myFile.getPresentableUrl()); + LOG.error("Module is null for file " + myFile.getPresentableUrl()); return Module.EMPTY_ARRAY; } return new Module[] {module}; diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java b/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java index 1514175abc88..e2ce0fa640d7 100644 --- a/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java +++ b/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java @@ -47,7 +47,7 @@ public class CacheUtils { String descriptor = symbolTable.getSymbol(methodDeclarationId.getDescriptor()); int endIndex = descriptor.indexOf(')'); if (endIndex <= 0) { - LOG.assertTrue(false, "Corrupted method descriptor: "+descriptor); + LOG.error("Corrupted method descriptor: " + descriptor); } return parseSignature(descriptor.substring(1, endIndex)); } diff --git a/java/compiler/impl/src/com/intellij/compiler/make/Dependency.java b/java/compiler/impl/src/com/intellij/compiler/make/Dependency.java index 3eb5aed1eeb0..cf50003bc0e4 100644 --- a/java/compiler/impl/src/com/intellij/compiler/make/Dependency.java +++ b/java/compiler/impl/src/com/intellij/compiler/make/Dependency.java @@ -97,7 +97,7 @@ public class Dependency { String descriptorStr = symbolTable.getSymbol(descriptor); int endIndex = descriptorStr.indexOf(')'); if (endIndex <= 0) { - LOG.assertTrue(false, "Corrupted method descriptor: "+ descriptorStr); + LOG.error("Corrupted method descriptor: " + descriptorStr); } myParameterDescriptors = parseParameterDescriptors(descriptorStr.substring(1, endIndex)); } diff --git a/java/compiler/impl/src/com/intellij/compiler/make/DependencyCacheNavigator.java b/java/compiler/impl/src/com/intellij/compiler/make/DependencyCacheNavigator.java index 29c595abf304..a93caa2aeb54 100644 --- a/java/compiler/impl/src/com/intellij/compiler/make/DependencyCacheNavigator.java +++ b/java/compiler/impl/src/com/intellij/compiler/make/DependencyCacheNavigator.java @@ -39,7 +39,7 @@ public class DependencyCacheNavigator { int superQName = myCache.getSuperQualifiedName(classQName); if (classQName == superQName) { - LOG.assertTrue(false, "Superclass qualified name is the same as class' name: " + classQName); + LOG.error("Superclass qualified name is the same as class' name: " + classQName); return; } @@ -70,7 +70,7 @@ public class DependencyCacheNavigator { public void walkSubClasses(int fromClassQName, ClassInfoProcessor processor) throws CacheCorruptedException { for (int subQName : myCache.getSubclasses(fromClassQName)) { if (fromClassQName == subQName) { - LOG.assertTrue(false, "Subclass qualified name is the same as class' name: " + fromClassQName); + LOG.error("Subclass qualified name is the same as class' name: " + fromClassQName); return; } if (subQName != Cache.UNKNOWN) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index c05df216afbf..e9cd41bdbc0f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -245,7 +245,7 @@ public abstract class DebugProcessImpl implements DebugProcess { @SuppressWarnings({"HardCodedStringLiteral"}) protected void commitVM(VirtualMachine vm) { if (!isInInitialState()) { - LOG.assertTrue(false, "State is invalid " + myState.get()); + LOG.error("State is invalid " + myState.get()); } DebuggerManagerThreadImpl.assertIsManagerThread(); myPositionManager = createPositionManager(); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java b/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java index f5e40da93aea..6faffeba0813 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java @@ -95,7 +95,7 @@ public class JVMNameUtil { buffer.append(getPrimitiveSignature(psiType.getCanonicalText())); } else { - LOG.assertTrue(false, "unknown type " + type.getCanonicalText()); + LOG.error("unknown type " + type.getCanonicalText()); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java index 8b8813ebe377..1c0134e06326 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java @@ -215,12 +215,12 @@ public class PositionManagerImpl implements PositionManager { if(PsiUtil.isLocalOrAnonymousClass(psiClass)) { final PsiClass parentNonLocal = JVMNameUtil.getTopLevelParentClass(psiClass); if(parentNonLocal == null) { - LOG.assertTrue(false, "Local or anonymous class has no non-local parent"); + LOG.error("Local or anonymous class has no non-local parent"); return Collections.emptyList(); } final String parentClassName = JVMNameUtil.getNonAnonymousClassName(parentNonLocal); if(parentClassName == null) { - LOG.assertTrue(false, "The name of a parent of a local (anonymous) class is null"); + LOG.error("The name of a parent of a local (anonymous) class is null"); return Collections.emptyList(); } final List outers = myDebugProcess.getVirtualMachineProxy().classesByName(parentClassName); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java index 6acf537430c9..6d5c2b3ae382 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java @@ -120,7 +120,7 @@ public class SuspendManagerImpl implements SuspendManager { if (thread != null) { // check that thread is suspended at the moment try { if (!thread.isSuspended()) { - LOG.assertTrue(false, "Context thread must be suspended"); + LOG.error("Context thread must be suspended"); } } catch (ObjectCollectedException ignored) {} diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java index 5fb1e8b2823a..6572d44e2570 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java @@ -86,7 +86,7 @@ public class CodeFragmentEvaluator extends BlockStatementEvaluator{ return vm.mirrorOf((String)value); } else { - LOG.assertTrue(false, "unknown default initializer type " + value.getClass().getName()); + LOG.error("unknown default initializer type " + value.getClass().getName()); return null; } } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java b/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java index b041959ed403..6848a3f3450b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java @@ -129,7 +129,7 @@ public abstract class InvokeThread { } if(getCurrentRequest() != current) { - LOG.assertTrue(false, "Expected " + current + " instead of " + getCurrentRequest()); + LOG.error("Expected " + current + " instead of " + getCurrentRequest()); } processEvent(myEvents.get()); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeExpression.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeExpression.java index bb89a974ac0e..f744512122e8 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeExpression.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeExpression.java @@ -266,7 +266,7 @@ public class DebuggerTreeNodeExpression { return ((ValueDescriptorImpl)node.getDescriptor()).getTreeEvaluation(node, context); } else { - LOG.assertTrue(false, node.getDescriptor() != null ? node.getDescriptor().getClass().getName() : "null"); + LOG.error(node.getDescriptor() != null ? node.getDescriptor().getClass().getName() : "null"); return null; } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java index 575f1260d37e..9596b397b222 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java @@ -138,7 +138,7 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory { final DescriptorData descriptorData; if (objRef == null ) { if (!field.isStatic()) { - LOG.assertTrue(false, "Object reference is null for non-static field: " + field); + LOG.error("Object reference is null for non-static field: " + field); } descriptorData = new StaticFieldData(field); } diff --git a/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java b/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java index d165861a020c..88c56e8ca770 100644 --- a/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java +++ b/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java @@ -102,10 +102,8 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider 0) { for (Module module : modules) { if (module == null) { - LOG.assertTrue( - false, - "RunConfiguration should not return null modules. Configuration=" + runConfiguration.getName() + "; class=" + runConfiguration.getClass().getName() - ); + LOG.error("RunConfiguration should not return null modules. Configuration=" + runConfiguration.getName() + "; class=" + + runConfiguration.getClass().getName()); } } scope = compilerManager.createModulesCompileScope(modules, true); diff --git a/java/execution/impl/src/com/intellij/execution/junit2/configuration/CommonJavaParameters.java b/java/execution/impl/src/com/intellij/execution/junit2/configuration/CommonJavaParameters.java index 8d411dbd9bd9..f32438d59ee4 100644 --- a/java/execution/impl/src/com/intellij/execution/junit2/configuration/CommonJavaParameters.java +++ b/java/execution/impl/src/com/intellij/execution/junit2/configuration/CommonJavaParameters.java @@ -32,6 +32,7 @@ import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.RawCommandLineEditor; +import com.intellij.util.ArrayUtil; import javax.swing.*; import java.awt.*; @@ -152,7 +153,7 @@ public class CommonJavaParameters extends JPanel { final List macros = new ArrayList(PathMacros.getInstance().getUserMacroNames()); macros.add("MODULE_DIR"); - final JList list = new JList(macros.toArray(new String[macros.size()])); + final JList list = new JList(ArrayUtil.toStringArray(macros)); final JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(new Runnable() { public void run() { final Object value = list.getSelectedValue(); diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ClasspathPanel.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ClasspathPanel.java index 3e57d38f4728..9d04aa700dbd 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ClasspathPanel.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ClasspathPanel.java @@ -18,8 +18,6 @@ package com.intellij.openapi.roots.ui.configuration; import com.intellij.ide.DataManager; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.module.Module; @@ -530,7 +528,7 @@ public class ClasspathPanel extends JPanel { } } } - LOG.assertTrue(false, "Unknown library " + item); + LOG.error("Unknown library " + item); return null; } @@ -549,7 +547,7 @@ public class ClasspathPanel extends JPanel { } } } - LOG.assertTrue(false, "Unknown library " + item); + LOG.error("Unknown library " + item); return null; } @@ -886,7 +884,7 @@ public class ClasspathPanel extends JPanel { if (columnIndex == ITEM_COLUMN) { return item; } - LOG.assertTrue(false, "Incorrect column index: " + columnIndex); + LOG.error("Incorrect column index: " + columnIndex); return null; } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryChooserElement.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryChooserElement.java index 54386314ffa9..99c2c8efebd6 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryChooserElement.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryChooserElement.java @@ -56,7 +56,7 @@ public class LibraryChooserElement { myLibrary = library; myOrderEntry = orderEntry; if (myLibrary == null && myOrderEntry == null) { - LOG.assertTrue(false, "Both library and order entry are null"); + LOG.error("Both library and order entry are null"); myName = ProjectBundle.message("module.libraries.unknown.item"); } else { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/LayoutTreeComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/LayoutTreeComponent.java index 3b7c3a3ad4d9..db8f14791cb1 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/LayoutTreeComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/LayoutTreeComponent.java @@ -44,6 +44,7 @@ import com.intellij.ui.treeStructure.SimpleNode; import com.intellij.ui.treeStructure.SimpleTreeBuilder; import com.intellij.ui.treeStructure.SimpleTreeStructure; import com.intellij.ui.treeStructure.WeightBasedComparator; +import com.intellij.util.ArrayUtil; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.tree.TreeUtil; import org.jetbrains.annotations.NonNls; @@ -288,7 +289,7 @@ public class LayoutTreeComponent implements DnDTarget, Disposable { myBuilder.addSubtreeToUpdate(treeNode, new Runnable() { public void run() { List> nodes = myTree.findNodes(toSelect); - myBuilder.select(nodes.toArray(new Object[nodes.size()]), null); + myBuilder.select(ArrayUtil.toObjectArray(nodes), null); } }); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/PackagingElementNode.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/PackagingElementNode.java index 349016a15a2e..7e1e8e653623 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/PackagingElementNode.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/PackagingElementNode.java @@ -27,6 +27,7 @@ import com.intellij.packaging.elements.PackagingElement; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.ui.SimpleTextAttributes; import com.intellij.ui.treeStructure.SimpleNode; +import com.intellij.util.ArrayUtil; import com.intellij.util.SmartList; import com.intellij.util.StringBuilderSpinAllocator; import org.jetbrains.annotations.NotNull; @@ -81,7 +82,7 @@ public class PackagingElementNode> extends Artifac @Override public Object[] getEqualityObjects() { - return myPackagingElements.toArray(new Object[myPackagingElements.size()]); + return ArrayUtil.toObjectArray(myPackagingElements); } @Override diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java index 6c6c209a4d78..d6d33237a64a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java @@ -222,12 +222,11 @@ public class JavaCompletionContributor extends CompletionContributor { final Object[] variants = reference.getVariants(); if (variants == null) { - LOG.assertTrue(false, "Reference=" + reference); + LOG.error("Reference=" + reference); } for (Object completion : variants) { if (completion == null) { - LOG.assertTrue(false, "Position=" + insertedElement + "\n;Reference=" + reference + "\n;variants=" + Arrays.toString( - variants)); + LOG.error("Position=" + insertedElement + "\n;Reference=" + reference + "\n;variants=" + Arrays.toString(variants)); } if (completion instanceof LookupElement) { result.addElement((LookupElement)completion); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java index dabe31bccb74..3f70ed37a9e4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java @@ -26,6 +26,7 @@ import com.intellij.openapi.project.DumbService; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.*; +import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.Nullable; @@ -238,7 +239,7 @@ public class CopyPasteReferenceProcessor implements CopyPastePostProcessor { } if (array.isEmpty()) return; - Object[] selectedObjects = array.toArray(new Object[array.size()]); + Object[] selectedObjects = ArrayUtil.toObjectArray(array); Arrays.sort( selectedObjects, new Comparator() { diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java index bdea5103dccd..a2455da108b2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java @@ -516,15 +516,8 @@ public class JavaFoldingBuilder extends FoldingBuilderEx implements DumbAware { final String baseClassName = quick ? anonymousClass.getBaseClassReference().getReferenceName() : anonymousClass.getBaseClassType().resolve().getName(); if (lastLineEnd >= seq.length() || firstLineStart >= seq.length() || firstLineStart < 0) { - LOG.assertTrue(false, "llE=" + - lastLineEnd + - "; fLS=" + - firstLineStart + - "; len=" + - seq.length() + - "rE=" + - rangeEnd + - "; class=" + baseClassName); + LOG.error("llE=" + lastLineEnd + "; fLS=" + firstLineStart + "; len=" + seq.length() + "rE=" + rangeEnd + "; class=" + + baseClassName); } final String params = StringUtil.join(method.getParameterList().getParameters(), new Function() { diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/JavaImplementationTextSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/hint/JavaImplementationTextSelectioner.java index 8e5800d295c6..8028a96d4a08 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hint/JavaImplementationTextSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/hint/JavaImplementationTextSelectioner.java @@ -46,7 +46,7 @@ public class JavaImplementationTextSelectioner implements ImplementationTextSele return element.getTextRange().getStartOffset(); } else { - LOG.assertTrue(false, "Element should not be null: " + parent.getText()); + LOG.error("Element should not be null: " + parent.getText()); return parent.getTextRange().getStartOffset(); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/lookup/LookupItemUtil.java b/java/java-impl/src/com/intellij/codeInsight/lookup/LookupItemUtil.java index 4e53c23a2c6d..aca3dff1c9d9 100644 --- a/java/java-impl/src/com/intellij/codeInsight/lookup/LookupItemUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/lookup/LookupItemUtil.java @@ -137,7 +137,7 @@ public class LookupItemUtil{ } if (s == null) { - LOG.assertTrue(false, "Null string for object: " + object + " of class " + (object != null ?object.getClass():null)); + LOG.error("Null string for object: " + object + " of class " + (object != null ? object.getClass() : null)); } if (object instanceof LookupValueWithTail) { item.setAttribute(LookupItem.TAIL_TEXT_ATTR, " " + ((LookupValueWithTail)object).getTailText()); diff --git a/java/java-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java index 6a99cc098da4..5144c7793908 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java @@ -354,7 +354,7 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme public JavaResolveResult[] multiResolve(final boolean incompleteCode) { final PsiManagerEx manager = getManager(); if (manager == null) { - LOG.assertTrue(false, "getManager() == null!"); + LOG.error("getManager() == null!"); return JavaResolveResult.EMPTY_ARRAY; } @@ -400,7 +400,7 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme return JavaResolveResult.EMPTY_ARRAY; } else { - LOG.assertTrue(false, "Invalid java reference!"); + LOG.error("Invalid java reference!"); return JavaResolveResult.EMPTY_ARRAY; } diff --git a/java/java-impl/src/com/intellij/psi/impl/source/parsing/JavadocParsing.java b/java/java-impl/src/com/intellij/psi/impl/source/parsing/JavadocParsing.java index d5439d0dce6f..42dfd622a4bf 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/parsing/JavadocParsing.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/parsing/JavadocParsing.java @@ -331,7 +331,7 @@ public class JavadocParsing extends Parsing { LeafElement tokenElement = myParsing.createTokenElement(lexer); IElementType type = lexer.getTokenType(); if (!TOKEN_FILTER.contains(type)) { - LOG.assertTrue(false, "Missed token should be space or asterisks:" + tokenElement); + LOG.error("Missed token should be space or asterisks:" + tokenElement); throw new RuntimeException(); } if (last != null) { diff --git a/java/java-impl/src/com/intellij/psi/impl/source/tree/JavaChangeUtilSupport.java b/java/java-impl/src/com/intellij/psi/impl/source/tree/JavaChangeUtilSupport.java index 1bc212c954c8..14b44609ccc5 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/tree/JavaChangeUtilSupport.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/tree/JavaChangeUtilSupport.java @@ -436,7 +436,7 @@ public class JavaChangeUtilSupport implements TreeGenerator, TreeCopyHandler { } } else { - LOG.assertTrue(false, "Wrong element type: " + original.getElementType()); + LOG.error("Wrong element type: " + original.getElementType()); } } diff --git a/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java index 8cb2b20f6a6f..deea549bc0d1 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java @@ -284,7 +284,7 @@ public class PsiReferenceExpressionImpl extends ExpressionPsiElement implements public JavaResolveResult[] multiResolve(boolean incompleteCode) { final PsiManagerEx manager = getManager(); if (manager == null) { - LOG.assertTrue(false, "getManager() == null!"); + LOG.error("getManager() == null!"); return null; } ResolveResult[] results = manager.getResolveCache().resolveWithCaching(this, OurGenericsResolver.INSTANCE, true, incompleteCode); @@ -619,7 +619,7 @@ public class PsiReferenceExpressionImpl extends ExpressionPsiElement implements if (nameChild == null) { final TreeElement dot = (TreeElement)findChildByRole(ChildRole.DOT); if (dot == null) { - LOG.assertTrue(false, this); + LOG.error(toString()); } return new TextRange(dot.getStartOffsetInParent() + dot.getTextLength(), getTextLength()); } diff --git a/java/java-impl/src/com/intellij/psi/impl/source/tree/java/ReplaceExpressionUtil.java b/java/java-impl/src/com/intellij/psi/impl/source/tree/java/ReplaceExpressionUtil.java index b18e8b8f0e1a..f016798a5f6b 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/tree/java/ReplaceExpressionUtil.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/tree/java/ReplaceExpressionUtil.java @@ -154,7 +154,7 @@ public class ReplaceExpressionUtil implements Constants { return 14; } else { - LOG.assertTrue(false, "Unknown element type:"+i); + LOG.error("Unknown element type:" + i); return -1; } } diff --git a/java/java-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java b/java/java-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java index bae8d6c2d350..22c5be988e64 100644 --- a/java/java-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java +++ b/java/java-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java @@ -233,7 +233,7 @@ public class PsiScopesUtil { } } else{ - LOG.assertTrue(false, "Unknown name element " + referenceNameElement + " in reference " + ref.getText() + "(" + ref + ")"); + LOG.error("Unknown name element " + referenceNameElement + " in reference " + ref.getText() + "(" + ref + ")"); } } else if (referenceNameElement instanceof PsiIdentifier){ @@ -243,7 +243,7 @@ public class PsiScopesUtil { resolveAndWalk(processor, ref, null); } else{ - LOG.assertTrue(false, "Unknown name element " + referenceNameElement + " in reference " + ref.getText() + "(" + ref + ")"); + LOG.error("Unknown name element " + referenceNameElement + " in reference " + ref.getText() + "(" + ref + ")"); } } else{ diff --git a/java/java-impl/src/com/intellij/refactoring/IntroduceHandlerBase.java b/java/java-impl/src/com/intellij/refactoring/IntroduceHandlerBase.java index 3216086a31ca..bccfa30c379f 100644 --- a/java/java-impl/src/com/intellij/refactoring/IntroduceHandlerBase.java +++ b/java/java-impl/src/com/intellij/refactoring/IntroduceHandlerBase.java @@ -54,7 +54,7 @@ public abstract class IntroduceHandlerBase { invokeImpl(project, (PsiLocalVariable)tempExpr, editor); } else { - LOG.assertTrue(false, "elements[0] should be PsiExpression or PsiLocalVariable"); + LOG.error("elements[0] should be PsiExpression or PsiLocalVariable"); } } diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDialog.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDialog.java index 6e8f0acb09b1..510c5e1892c4 100644 --- a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDialog.java @@ -238,7 +238,7 @@ public class ChangeSignatureDialog extends RefactoringDialog { final PsiElementFactory factory = JavaPsiFacade.getInstance(myMethod.getProject()).getElementFactory(); final PsiTypeElement typeElement = myMethod.getReturnTypeElement(); if (typeElement == null) { - LOG.assertTrue(false, myMethod.getClass().getName()); + LOG.error(myMethod.getClass().getName()); return panel; } myReturnTypeCodeFragment = factory.createTypeCodeFragment(typeElement.getText(), myMethod.getParameterList(), true, true); diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodCallUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodCallUsageInfo.java index eacc2e9fbc59..616ec7f5c32e 100644 --- a/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodCallUsageInfo.java +++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodCallUsageInfo.java @@ -52,7 +52,7 @@ public class MethodCallUsageInfo extends UsageInfo { else if (parent instanceof PsiAnonymousClass) { return ((PsiNewExpression)parent.getParent()).resolveConstructor(); } - LOG.assertTrue(false, "Unknown reference"); + LOG.error("Unknown reference"); return null; } diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ControlFlowWrapper.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ControlFlowWrapper.java index ffe10f406a71..23bd6406fdf5 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ControlFlowWrapper.java +++ b/java/java-impl/src/com/intellij/refactoring/extractMethod/ControlFlowWrapper.java @@ -281,7 +281,7 @@ public class ControlFlowWrapper { if (myFlowStart <= startOffset && endOffset <= myFlowEnd) continue; } else { - LOG.assertTrue(false, exitStatement); + LOG.error(String.valueOf(exitStatement)); continue; } diff --git a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java index 8b8414794e19..23a2b12cc3bc 100644 --- a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java +++ b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java @@ -165,7 +165,7 @@ public class JavaNameSuggestionProvider implements NameSuggestionProvider { result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(name))); } result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(name.toLowerCase()))); - return result.toArray(new String[result.size()]); + return ArrayUtil.toStringArray(result); } } diff --git a/java/java-impl/src/com/intellij/refactoring/rename/naming/PsiNamedElementAutomaticRenamer.java b/java/java-impl/src/com/intellij/refactoring/rename/naming/PsiNamedElementAutomaticRenamer.java index dd0e4c62973d..b5c4e74566c4 100644 --- a/java/java-impl/src/com/intellij/refactoring/rename/naming/PsiNamedElementAutomaticRenamer.java +++ b/java/java-impl/src/com/intellij/refactoring/rename/naming/PsiNamedElementAutomaticRenamer.java @@ -45,13 +45,8 @@ public abstract class PsiNamedElementAutomaticRenamer String canonicalName = nameToCanonicalName(elementName, element); final String newCanonicalName = suggester.suggestName(canonicalName); if (newCanonicalName.length() == 0) { - LOG.assertTrue(false, - "oldName = " + getOldName() + - ", newName = " + getNewName() + - ", name = " + elementName + - ", canonicalName = " + canonicalName + - ", newCanonicalName = " + newCanonicalName - ); + LOG.error("oldName = " + getOldName() + ", newName = " + getNewName() + ", name = " + elementName + ", canonicalName = " + + canonicalName + ", newCanonicalName = " + newCanonicalName); } return canonicalNameToName(newCanonicalName, element); } diff --git a/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassInstanceScanner.java b/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassInstanceScanner.java index 99f8f33fcfaf..cc72b6682993 100644 --- a/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassInstanceScanner.java +++ b/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassInstanceScanner.java @@ -186,7 +186,7 @@ public class ClassInstanceScanner extends DelegatingClassReferenceVisitor { visitor.visitReadUsage(expression, null, referencedElement); } else { - LOG.assertTrue(false, "Unknown variation of class instance usage"); + LOG.error("Unknown variation of class instance usage"); } } diff --git a/platform/lang-api/src/com/intellij/execution/runners/ProgramRunnerUtil.java b/platform/lang-api/src/com/intellij/execution/runners/ProgramRunnerUtil.java index 2fe12089b83a..1362af5b7213 100644 --- a/platform/lang-api/src/com/intellij/execution/runners/ProgramRunnerUtil.java +++ b/platform/lang-api/src/com/intellij/execution/runners/ProgramRunnerUtil.java @@ -44,7 +44,7 @@ public class ProgramRunnerUtil { String message = ExecutionBundle.message("error.running.configuration.with.error.error.message", runProfile != null? runProfile.getName() : "Run profile", e.getMessage()); if (ApplicationManager.getApplication().isUnitTestMode()) { - LOG.assertTrue(false, message); + LOG.error(message); } else { if (message.contains("87") && e instanceof ProcessNotCreatedException) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index 0892b7696ce9..efd1e6381a12 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -396,7 +396,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { if (fileCopy == null) { PsiElement elementAfterCommit = findElementAt(hostFile, hostStartOffset); if (wasInjected) { - LOG.assertTrue(false, "No injected fragmnent found at offset " + hostStartOffset + " in the patched file copy, found: " + elementAfterCommit); + LOG.error("No injected fragmnent found at offset " + hostStartOffset + " in the patched file copy, found: " + elementAfterCommit); } fileCopy = elementAfterCommit == null ? oldFileCopy : elementAfterCommit.getContainingFile(); } @@ -420,11 +420,8 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { final String allDoc = hostFile.getViewProvider().getDocument().getText(); String docText = allDoc.substring(Math.max(0, context.getStartOffset() - 10), Math.min(allDoc.length(), context.getStartOffset() + 10)); - LOG.assertTrue(false, "offset " + newContext.getStartOffset() + " at:\n" + - "text=\"" + injectedFile.getText() + "\"\n" + - "instance=" + injectedFile + "\n" + - "patcher=" + patcher + "\n" + - "docText=" + docText); + LOG.error("offset " + newContext.getStartOffset() + " at:\n" + "text=\"" + injectedFile.getText() + "\"\n" + "instance=" + + injectedFile + "\n" + "patcher=" + patcher + "\n" + "docText=" + docText); } EditorFactory.getInstance().releaseEditor(editor); return Pair.create(newContext, element); @@ -433,7 +430,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { } PsiElement element = findElementAt(fileCopy, context.getStartOffset()); if (element == null) { - LOG.assertTrue(false, "offset " + context.getStartOffset() + " at:\ntext=\"" + fileCopy.getText() + "\"\ninstance=" + fileCopy); + LOG.error("offset " + context.getStartOffset() + " at:\ntext=\"" + fileCopy.getText() + "\"\ninstance=" + fileCopy); } return Pair.create(context, element); } @@ -463,7 +460,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { Project project = context.project; Editor editor = context.editor; if (!ApplicationManager.getApplication().isUnitTestMode() && context.editor.getComponent().getRootPane() == null) { - LOG.assertTrue(false, "null root pane"); + LOG.error("null root pane"); } for (final CompletionContributor contributor : CompletionContributor.forParameters(parameters)) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java index 7f234341b844..58257600360f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java @@ -248,7 +248,7 @@ public class CompletionData { s = ((PresentableLookupValue)object).getPresentation(); } else { - LOG.assertTrue(false, "Null string for object: " + object + " of class " + (object != null ?object.getClass():null)); + LOG.error("Null string for object: " + object + " of class " + (object != null ? object.getClass() : null)); } LookupItem item = new LookupItem(object, s); @@ -311,7 +311,7 @@ public class CompletionData { for (Object completion : completions) { if (completion == null) { - LOG.assertTrue(false, "Position=" + position + "\n;Reference=" + reference + "\n;variants=" + Arrays.toString(completions)); + LOG.error("Position=" + position + "\n;Reference=" + reference + "\n;variants=" + Arrays.toString(completions)); } if (completion instanceof PsiElement) { final PsiElement psiElement = (PsiElement)completion; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java index a667dd956f43..8f1cd78588a9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java @@ -181,7 +181,7 @@ public class DocumentFoldingInfo implements JDOMExternalizable, CodeFoldingState PsiElement restoredElement = FoldingPolicy.restoreBySignature(psiElement.getContainingFile(), signature); if (!psiElement.equals(restoredElement)){ restoredElement = FoldingPolicy.restoreBySignature(psiElement.getContainingFile(), signature); - LOG.assertTrue(false, "element:" + psiElement + ", signature:" + signature + ", file:" + psiElement.getContainingFile()); + LOG.error("element:" + psiElement + ", signature:" + signature + ", file:" + psiElement.getContainingFile()); } Element e = new Element(ELEMENT_TAG); diff --git a/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java b/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java index b8d550e237db..51b3594a0fda 100644 --- a/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java +++ b/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java @@ -243,7 +243,7 @@ public abstract class PsiElementBase extends ElementBase implements NavigatableP protected T findNotNullChildByClass(Class aClass) { final T child = findChildByClass(aClass); if (child == null) { - LOG.assertTrue(false, getText() + "\n parent=" + getParent().getText()); + LOG.error(getText() + "\n parent=" + getParent().getText()); } return child; } diff --git a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java index 69d744506b30..a286f77354af 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java +++ b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java @@ -59,6 +59,7 @@ import com.intellij.usages.impl.NullUsage; import com.intellij.usages.impl.UsageNode; import com.intellij.usages.impl.UsageViewImpl; import com.intellij.usages.rules.UsageFilteringRuleProvider; +import com.intellij.util.ArrayUtil; import com.intellij.util.Icons; import com.intellij.util.Processor; import com.intellij.util.messages.MessageBusConnection; @@ -364,7 +365,7 @@ public class ShowUsagesAction extends AnAction { } protected Object[] getAllElements() { - return data.toArray(new Object[data.size()]); + return ArrayUtil.toObjectArray(data); } protected String getElementText(Object element) { diff --git a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesTreeStructure.java b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesTreeStructure.java index 191f66396613..6a9a22165cef 100644 --- a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesTreeStructure.java +++ b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesTreeStructure.java @@ -100,7 +100,7 @@ public class FavoritesTreeStructure extends ProjectTreeStructure { if (result.isEmpty()) { result.add(getEmptyScreen()); } - return result.toArray(new Object[result.size()]); + return ArrayUtil.toObjectArray(result); } catch (Exception e) { } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java index adf7c33ace82..e2341a1be15a 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java @@ -223,7 +223,7 @@ public class ProjectViewDirectoryHelper { } } else { - LOG.assertTrue(false, "Either PsiFile or PsiDirectory expected as a child of " + child.getParent() + ", but was " + child); + LOG.error("Either PsiFile or PsiDirectory expected as a child of " + child.getParent() + ", but was " + child); } } } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java index eccbbbf3ce53..f7260d85a6c6 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java @@ -218,7 +218,7 @@ public class ContentEntryImpl extends RootModelComponentBase implements ContentE final String rootUrl = getUrl(); try { if (!FileUtil.isAncestor(new File(rootUrl), new File(url), false)) { - LOG.assertTrue(false, "The file " + url + " is not under content entry root " + rootUrl); + LOG.error("The file " + url + " is not under content entry root " + rootUrl); } } catch (IOException e) { diff --git a/platform/lang-impl/src/com/intellij/psi/formatter/FormattingDocumentModelImpl.java b/platform/lang-impl/src/com/intellij/psi/formatter/FormattingDocumentModelImpl.java index 9276f2b051f4..84d0cf06351e 100644 --- a/platform/lang-impl/src/com/intellij/psi/formatter/FormattingDocumentModelImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/formatter/FormattingDocumentModelImpl.java @@ -42,10 +42,11 @@ public class FormattingDocumentModelImpl implements FormattingDocumentModel{ Document document = getDocumentToBeUsedFor(file); if (document != null) { if (PsiDocumentManager.getInstance(file.getProject()).isUncommited(document)) { - LOG.assertTrue(false, "Document is uncommited"); + LOG.error("Document is uncommited"); } if (!document.getText().equals(file.getText())) { - LOG.assertTrue(false, "Document and psi file texts should be equal : \nDocument text:\n" + document.getText() + "\nFile text:\n" + file.getText()); + LOG.error( + "Document and psi file texts should be equal : \nDocument text:\n" + document.getText() + "\nFile text:\n" + file.getText()); } return new FormattingDocumentModelImpl(document, file); } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java index 9153e01dc4d1..b7dd5cc7ddbf 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java @@ -312,7 +312,7 @@ public class FileManagerImpl implements FileManager { ApplicationManager.getApplication().assertReadAccessAllowed(); if (!vFile.isValid()) { - LOG.assertTrue(false, "Invalid file: " + vFile); + LOG.error("Invalid file: " + vFile); return null; } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java index fe97f81cca29..d8fd4fa99440 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java @@ -103,7 +103,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper { return todoPattern; } } - LOG.assertTrue(false, "Could not find matching TODO pattern for index pattern " + pattern.getPatternString()); + LOG.error("Could not find matching TODO pattern for index pattern " + pattern.getPatternString()); return null; } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java index ce5583246b2d..3e1a0f9da35d 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java @@ -126,7 +126,7 @@ public class SmartPointerManagerImpl extends SmartPointerManager { @NotNull public SmartPsiElementPointer createSmartPsiElementPointer(E element) { if (!element.isValid()) { - LOG.assertTrue(false, "Invalid element:" + element); + LOG.error("Invalid element:" + element); } PsiFile file = element.getContainingFile(); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java index 987edc4db892..155c9951d2c8 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java @@ -149,10 +149,10 @@ public class CodeStyleManagerImpl extends CodeStyleManager { final PsiElement start = findElementInTreeWithFormatterEnabled(file, startOffset); final PsiElement end = findElementInTreeWithFormatterEnabled(file, endOffset); if (start != null && !start.isValid()) { - LOG.assertTrue(false, "start=" + start + "; file=" + file); + LOG.error("start=" + start + "; file=" + file); } if (end != null && !end.isValid()) { - LOG.assertTrue(false, "end=" + start + "; end=" + file); + LOG.error("end=" + start + "; end=" + file); } boolean formatFromStart = startOffset == 0; diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java index 93342a6f8877..2a21662b0a99 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java @@ -266,7 +266,7 @@ public class FileReferenceSet { private PsiFile getContainingFile() { PsiFile file = myElement.getContainingFile(); if (file == null) { - LOG.assertTrue(false, "Invalid element: " + myElement); + LOG.error("Invalid element: " + myElement); } return file.getOriginalFile(); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java index cc2113e6182d..f99a11945d1d 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java @@ -85,7 +85,7 @@ public class SharedImplUtil { if (tree instanceof FileElement) return ((FileElement)tree).getCharTable(); tree = tree.getTreeParent(); } - LOG.assertTrue(false, "Invalid root element"); + LOG.error("Invalid root element"); return null; } diff --git a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java index 1e9b71dbcc3a..cb243e0c26b0 100644 --- a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java +++ b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java @@ -156,11 +156,11 @@ public class TemplateDataElementType extends IFileElementType implements ITempla final CharSequence buffer = lexer.getBufferSequence(); final int tokenStart = lexer.getTokenStart(); if (tokenStart < 0 || tokenStart > buffer.length()) { - LOG.assertTrue(false, "Invalid start: " + tokenStart + "; " + lexer); + LOG.error("Invalid start: " + tokenStart + "; " + lexer); } final int tokenEnd = lexer.getTokenEnd(); if (tokenEnd < 0 || tokenEnd > buffer.length()) { - LOG.assertTrue(false, "Invalid end: " + tokenEnd + "; " + lexer); + LOG.error("Invalid end: " + tokenEnd + "; " + lexer); } return new OuterLanguageElementImpl(outerElementType, table.intern(buffer, tokenStart, tokenEnd)); diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameHandlerRegistry.java b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameHandlerRegistry.java index 9d3994f7bcad..65a64ab876c1 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameHandlerRegistry.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameHandlerRegistry.java @@ -26,6 +26,7 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.refactoring.RefactoringBundle; import com.intellij.refactoring.lang.TitledHandler; import com.intellij.refactoring.util.RadioUpDownListener; +import com.intellij.util.ArrayUtil; import com.intellij.util.containers.HashSet; import org.jetbrains.annotations.Nullable; @@ -80,7 +81,7 @@ public class RenameHandlerRegistry { } if (availableHandlers.size() == 1) return availableHandlers.values().iterator().next(); if (availableHandlers.size() > 1) { - final String[] strings = availableHandlers.keySet().toArray(new String[availableHandlers.keySet().size()]); + final String[] strings = ArrayUtil.toStringArray(availableHandlers.keySet()); final HandlersChooser chooser = new HandlersChooser(PlatformDataKeys.PROJECT.getData(dataContext), strings); chooser.show(); if (chooser.isOK()) { diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/AutomaticRenamer.java b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/AutomaticRenamer.java index 7f1519cd2e7e..655afe2866c6 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/AutomaticRenamer.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/AutomaticRenamer.java @@ -99,13 +99,8 @@ public abstract class AutomaticRenamer { String canonicalName = nameToCanonicalName(name, element); final String newCanonicalName = suggester.suggestName(canonicalName); if (newCanonicalName.length() == 0) { - LOG.assertTrue(false, - "oldClassName = " + oldClassName + - ", newClassName = " + newClassName + - ", name = " + name + - ", canonicalName = " + canonicalName + - ", newCanonicalName = " + newCanonicalName - ); + LOG.error("oldClassName = " + oldClassName + ", newClassName = " + newClassName + ", name = " + name + ", canonicalName = " + + canonicalName + ", newCanonicalName = " + newCanonicalName); } String newName = canonicalNameToName(newCanonicalName, element); if (!newName.equals(name)) { diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java index 0abd6dd647e2..591c57481614 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java @@ -184,8 +184,8 @@ public class NameSuggester { final int propertyWordFirst = matches.get(first); if (first >= myOldClassName.length || last >= myOldClassName.length) { - LOG.assertTrue(false, "old class name = " + myOldClassNameAsGiven + ", new class name = " + myNewClassNameAsGiven + - ", propertyWords = " + Arrays.asList(propertyWords).toString()); + LOG.error("old class name = " + myOldClassNameAsGiven + ", new class name = " + myNewClassNameAsGiven + ", propertyWords = " + + Arrays.asList(propertyWords).toString()); } final String replacement = suggestReplacement(propertyWords[propertyWordFirst], newString); diff --git a/platform/platform-api/src/com/intellij/execution/process/ProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/ProcessHandler.java index 9c8e83fffee4..e7cb96652371 100644 --- a/platform/platform-api/src/com/intellij/execution/process/ProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/ProcessHandler.java @@ -58,7 +58,7 @@ public abstract class ProcessHandler extends UserDataHolderBase { myEventMulticaster.startNotified(new ProcessEvent(this)); } else { - LOG.assertTrue(false, "startNotify called already"); + LOG.error("startNotify called already"); } } diff --git a/platform/platform-api/src/com/intellij/ide/plugins/PluginManager.java b/platform/platform-api/src/com/intellij/ide/plugins/PluginManager.java index 4ba1aef918a9..ea08b49757b8 100644 --- a/platform/platform-api/src/com/intellij/ide/plugins/PluginManager.java +++ b/platform/platform-api/src/com/intellij/ide/plugins/PluginManager.java @@ -470,7 +470,7 @@ public class PluginManager { final ClassLoader loader = pluginDescriptor.getPluginClassLoader(); if (loader == null) { - getLogger().assertTrue(false, "Plugin class loader should be initialized for plugin " + id); + getLogger().error("Plugin class loader should be initialized for plugin " + id); } classLoaders.add(loader); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeBuilderUtil.java b/platform/platform-api/src/com/intellij/ide/util/treeView/TreeBuilderUtil.java index 89624b54605a..9493ea3539c9 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeBuilderUtil.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/TreeBuilderUtil.java @@ -53,7 +53,7 @@ public class TreeBuilderUtil { final Object userObject = childNode.getUserObject(); if (tree.isPathSelected(path)) { if (!(userObject instanceof NodeDescriptor)) { - LOG.assertTrue(false, "Node: " + childNode + "; userObject: " + userObject + " of class " + userObject.getClass()); + LOG.error("Node: " + childNode + "; userObject: " + userObject + " of class " + userObject.getClass()); } selectionPaths.add(storeElementsOnly ? ((NodeDescriptor)userObject).getElement() : path); } diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java index eb9b280b865e..1f9112f016de 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java @@ -68,7 +68,7 @@ public class CompositeAppearance implements ModifiableCellAppearance { for (Iterator iterator = mySections.iterator(); iterator.hasNext();) { TextSection textSection = iterator.next(); if (textSection == null) { - LOG.assertTrue(false, "index: " + index + " size: " + mySections.size()); + LOG.error("index: " + index + " size: " + mySections.size()); iterator.remove(); } } diff --git a/platform/platform-api/src/com/intellij/ui/ListUtil.java b/platform/platform-api/src/com/intellij/ui/ListUtil.java index dc3c86baac34..66a380463143 100644 --- a/platform/platform-api/src/com/intellij/ui/ListUtil.java +++ b/platform/platform-api/src/com/intellij/ui/ListUtil.java @@ -268,7 +268,7 @@ public class ListUtil { if (model instanceof FilteringListModel) return FILTERED_MODEL; if (model == null) LOG.assertTrue(false); - else LOG.assertTrue(false, "Unknown model class: " + model.getClass().getName()); + else LOG.error("Unknown model class: " + model.getClass().getName()); return null; } diff --git a/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java b/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java index 59a0643d45ee..f58b24c6e381 100644 --- a/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java +++ b/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java @@ -101,8 +101,7 @@ public abstract class BaseTableView extends Table { final int modelIndex = column.getModelIndex(); storage.put(orderPropertyName(i), String.valueOf(modelIndex)); if (storedColumns[modelIndex]) { - LOG.assertTrue(false, - "columnCount: " + columnCount + " current: " + i + " modelINdex: " + modelIndex); + LOG.error("columnCount: " + columnCount + " current: " + i + " modelINdex: " + modelIndex); } storedColumns[modelIndex] = true; } @@ -160,7 +159,7 @@ public abstract class BaseTableView extends Table { for (int i = 0; i < model.getColumnCount(); i++) if (model.getColumn(i).getModelIndex() == index) return i; - LOG.assertTrue(false, "Total: " + model.getColumnCount() + " index: "+ index); + LOG.error("Total: " + model.getColumnCount() + " index: " + index); return index; } } diff --git a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java index 4ad3015d48fe..6f66e323ef01 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java @@ -234,7 +234,7 @@ public class IdeEventQueue extends EventQueue { synchronized (myLock) { final boolean wasRemoved = myIdleListeners.remove(runnable); if (!wasRemoved) { - LOG.assertTrue(false, "unknown runnable: " + runnable); + LOG.error("unknown runnable: " + runnable); } final MyFireIdleRequest request = myListener2Request.remove(runnable); LOG.assertTrue(request != null); @@ -260,7 +260,7 @@ public class IdeEventQueue extends EventQueue { synchronized (myLock) { final boolean wasRemoved = myActivityListeners.remove(runnable); if (!wasRemoved) { - LOG.assertTrue(false, "unknown runnable: " + runnable); + LOG.error("unknown runnable: " + runnable); } } } diff --git a/platform/platform-impl/src/com/intellij/ide/impl/DataManagerImpl.java b/platform/platform-impl/src/com/intellij/ide/impl/DataManagerImpl.java index 775f44ab6b83..649f6708c328 100644 --- a/platform/platform-impl/src/com/intellij/ide/impl/DataManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/ide/impl/DataManagerImpl.java @@ -290,8 +290,8 @@ public class DataManagerImpl extends DataManager implements ApplicationComponent myEventCount + "; current event count = " + currentEventCount ); */ - LOG.assertTrue(false, "cannot share data context between Swing events; initial event count = " + myEventCount + - "; current event count = " + currentEventCount); + LOG.error("cannot share data context between Swing events; initial event count = " + myEventCount + "; current event count = " + + currentEventCount); } Component _component = myRef.get(); diff --git a/platform/platform-impl/src/com/intellij/ide/impl/DataValidator.java b/platform/platform-impl/src/com/intellij/ide/impl/DataValidator.java index a2e4e3f4062f..c2b0462573ab 100644 --- a/platform/platform-impl/src/com/intellij/ide/impl/DataValidator.java +++ b/platform/platform-impl/src/com/intellij/ide/impl/DataValidator.java @@ -85,8 +85,8 @@ public abstract class DataValidator { public T[] findInvalid(final String dataId, T[] array, final Object dataSource) { for (T element : array) { if (element == null) { - LOG.assertTrue(false, "Data isn't valid. " + dataId + "=null Provided by: " + dataSource.getClass().getName() + - " (" + dataSource.toString() + ")"); + LOG.error( + "Data isn't valid. " + dataId + "=null Provided by: " + dataSource.getClass().getName() + " (" + dataSource.toString() + ")"); } T invalid = myElementValidator.findInvalid(dataId, element, dataSource); if (invalid != null) { diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java index 520db075c1ad..0048b5fde244 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java @@ -839,7 +839,7 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat private static void assertActionIsGroupOrStub(final AnAction action) { if (!(action instanceof ActionGroup || action instanceof ActionStub)) { - LOG.assertTrue(false, "Action : "+action + "; class: "+action.getClass()); + LOG.error("Action : " + action + "; class: " + action.getClass()); } } @@ -1147,7 +1147,7 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat public void removeTimerListener(TimerListener listener){ final boolean removed = myTimerListeners.remove(listener); if (!removed) { - LOG.assertTrue(false, "Unknown listener " + listener); + LOG.error("Unknown listener " + listener); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/Utils.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/Utils.java index 0f444fb37a8b..6c537cb7bcba 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/Utils.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/Utils.java @@ -99,7 +99,7 @@ public class Utils{ AnAction child = children[i]; if (child == null) { String groupId = ActionManager.getInstance().getId(group); - LOG.assertTrue(false, "action is null: i=" + i + " group=" + group + " group id=" + groupId); + LOG.error("action is null: i=" + i + " group=" + group + " group id=" + groupId); continue; } diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java index f40da2a5825b..341d3d3caf24 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java @@ -348,7 +348,7 @@ abstract class ComponentStoreImpl implements IComponentStore { private static String getComponentName(@NotNull final PersistentStateComponent persistentStateComponent) { final State stateSpec = getStateSpec(persistentStateComponent); if (stateSpec == null) { - LOG.assertTrue(false, "Null state spec for " + persistentStateComponent); + LOG.error("Null state spec for " + persistentStateComponent); } return stateSpec.name(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java index 24a24125fd66..eae0f578e829 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java @@ -90,7 +90,7 @@ public class MergeList implements ChangeList.Parent, UserDataHolder { rightChanges.add(SimpleChange.fromRanges(ranges[1], new TextRange(rightTextLength, rightTextLength), mergeList.myChanges[1])); leftChanges.add(SimpleChange.fromRanges(ranges[1], new TextRange(leftTextLength, leftTextLength), mergeList.myChanges[0])); } else { - LOG.assertTrue(false, "Left Text: " + leftText + "\n" + "Right Text: " + rightText + "\nBase Text: " + baseText); + LOG.error("Left Text: " + leftText + "\n" + "Right Text: " + rightText + "\nBase Text: " + baseText); } } else { rightChanges.add(SimpleChange.fromRanges(ranges[1], ranges[2], mergeList.myChanges[1])); @@ -98,7 +98,7 @@ public class MergeList implements ChangeList.Parent, UserDataHolder { } else if (ranges[2] == null) { if (ranges[0] == null) { - LOG.assertTrue(false, "Left Text: " + leftText + "\n" + "Right Text: " + rightText + "\nBase Text: " + baseText); + LOG.error("Left Text: " + leftText + "\n" + "Right Text: " + rightText + "\nBase Text: " + baseText); } leftChanges.add(SimpleChange.fromRanges(ranges[1], ranges[0], mergeList.myChanges[0])); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/PreferWholeLines.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/PreferWholeLines.java index edcac10b3e3b..2a6a01c10414 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/PreferWholeLines.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/PreferWholeLines.java @@ -30,8 +30,7 @@ class PreferWholeLines implements DiffCorrection { DiffFragment nextFragment = fragments[i + 1]; FragmentSide side = FragmentSide.chooseSide(fragment); if (nextFragment.isOneSide()) { - LOG.assertTrue(false, - "<" + side.getText(fragment) + "> <" + side.getOtherText(nextFragment) + ">"); + LOG.error("<" + side.getText(fragment) + "> <" + side.getOtherText(nextFragment) + ">"); } if (StringUtil.startsWithChar(side.getText(fragment), '\n') && StringUtil.startsWithChar(side.getText(nextFragment), '\n') && diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java index 4c034522dac0..619ae78e7d40 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java @@ -125,7 +125,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme final FileEditor[] editors = editorsWithProviders.getFirst(); final FileEditorProvider[] oldProviders = editorsWithProviders.getSecond(); if (editors.length <= 0) { - LOG.assertTrue(false, "No editors for file " + file.getPresentableUrl()); + LOG.error("No editors for file " + file.getPresentableUrl()); } final FileEditor selectedEditor = editorManager.getSelectedEditor(file); LOG.assertTrue(selectedEditor != null); diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java index 0953b839cf6d..3041414f2323 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java @@ -148,7 +148,7 @@ public final class EditorsSplitters extends JPanel { return res; } else { - LOG.assertTrue(false, comp != null ? comp.getClass().getName() : null); + LOG.error(comp != null ? comp.getClass().getName() : null); return null; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java index bfd46bad00cc..b2b1c86543bc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java @@ -308,7 +308,7 @@ public class DumbServiceImpl extends DumbService { final IndexUpdateRunnable nextUpdateRunnable = myUpdatesQueue.pullFirst(); // run next action under already existing progress indicator if (!myActionQueue.offer(new Ref(nextUpdateRunnable.myAction))) { - LOG.assertTrue(false, "Action queue rejected next updateRunnable!"); + LOG.error("Action queue rejected next updateRunnable!"); nextUpdateRunnable.run(); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java index 5fce05c6b919..66d976010ac4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java @@ -58,7 +58,7 @@ public class Win32Kernel { names.add(info.name); } - return names.toArray(new String[names.size()]); + return ArrayUtil.toStringArray(names); } public boolean exists(String path) { diff --git a/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java b/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java index 1d701013e79c..5b320c544bed 100644 --- a/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java +++ b/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java @@ -29,6 +29,7 @@ import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypes; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.TextComponentAccessor; +import com.intellij.util.ArrayUtil; import javax.swing.*; import java.awt.*; @@ -199,7 +200,7 @@ public class EditorComboBox extends JComboBox implements DocumentListener { objects.add(itemAt); } } - setModel(new DefaultComboBoxModel(objects.toArray(new Object[objects.size()]))); + setModel(new DefaultComboBoxModel(ArrayUtil.toObjectArray(objects))); } private class MyEditor implements ComboBoxEditor { diff --git a/platform/platform-impl/src/com/intellij/util/PendingEventDispatcher.java b/platform/platform-impl/src/com/intellij/util/PendingEventDispatcher.java index adffad01cf50..e70784de9bdb 100644 --- a/platform/platform-impl/src/com/intellij/util/PendingEventDispatcher.java +++ b/platform/platform-impl/src/com/intellij/util/PendingEventDispatcher.java @@ -171,8 +171,7 @@ public class PendingEventDispatcher { private void dispatch(Method method, Object[] args) { assertDispatchThread(); if(myCurrentDispatchMethod != null) { - LOG.assertTrue(false, - "Event cannot be raised when dispatching another event is in progress. Dispatching " + myCurrentDispatchMethod.getName()); + LOG.error("Event cannot be raised when dispatching another event is in progress. Dispatching " + myCurrentDispatchMethod.getName()); } method.setAccessible(true); diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestSuiteStack.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestSuiteStack.java index 7887db9c3c7c..9033ed9ea731 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestSuiteStack.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestSuiteStack.java @@ -55,13 +55,16 @@ public class TestSuiteStack { @NotNull public SMTestProxy popSuite(final String suiteName) throws EmptyStackException { if (myStack.isEmpty()) { - LOG.assertTrue(false, "Pop error: Test runner tried to close test suite which has been already closed or wasn't started at all. Unexpected suite name [" + suiteName + "]"); + LOG.error( + "Pop error: Test runner tried to close test suite which has been already closed or wasn't started at all. Unexpected suite name [" + + suiteName + "]"); return null; } final SMTestProxy currentSuite = myStack.pop(); if (!suiteName.equals(currentSuite.getName())) { - LOG.assertTrue(false, "Pop error: Unexpected closing suite. Expected [" + suiteName + "] but [" + currentSuite.getName() + "] was found. Rest of stack: " + getSuitePathPresentation()); + LOG.error("Pop error: Unexpected closing suite. Expected [" + suiteName + "] but [" + currentSuite.getName() + + "] was found. Rest of stack: " + getSuitePathPresentation()); return null; } diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/statistics/StatisticsTableModel.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/statistics/StatisticsTableModel.java index 274dcba28801..dfd0ba5b6685 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/statistics/StatisticsTableModel.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/statistics/StatisticsTableModel.java @@ -136,7 +136,7 @@ public class StatisticsTableModel extends ListTableModel { public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) { // Setting value is prevented! - LOG.assertTrue(false, "value: " + aValue + " row: " + rowIndex + " column: " + columnIndex); + LOG.error("value: " + aValue + " row: " + rowIndex + " column: " + columnIndex); } @Nullable diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index e0c0b24009cf..800f286f6b6f 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java @@ -29,6 +29,7 @@ import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.Alarm; +import com.intellij.util.ArrayUtil; import com.intellij.util.SystemProperties; import com.intellij.util.ui.UIUtil; import junit.framework.Assert; @@ -230,7 +231,7 @@ public class PlatformTestUtil { if (comparator != null) { ArrayList list = new ArrayList(Arrays.asList(children)); Collections.sort(list, comparator); - children = list.toArray(new Object[list.size()]); + children = ArrayUtil.toObjectArray(list); } for (Object child : children) { currentLine = doPrint(buffer, currentLevel + 1, child, structure, comparator, maxRowCount, currentLine, paddingChar); diff --git a/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java b/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java index 06ce759a280f..7d10f844cf4b 100644 --- a/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java +++ b/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java @@ -84,8 +84,7 @@ public class UsageInfo2UsageAdapter implements UsageInModule, UsageInLibrary, Us myLineNumber = getLineNumber(document, startOffset); if (endOffset > document.getTextLength()) { - LOG.assertTrue(false, - "Invalid usage info, psiElement:" + element + " end offset: " + endOffset + " psiFile: " + psiFile.getName()); + LOG.error("Invalid usage info, psiElement:" + element + " end offset: " + endOffset + " psiFile: " + psiFile.getName()); } myRangeMarkers.add(document.createRangeMarker(startOffset, endOffset)); diff --git a/platform/util/src/com/intellij/openapi/diff/impl/highlighting/Util.java b/platform/util/src/com/intellij/openapi/diff/impl/highlighting/Util.java index d0e72eff5b23..1356eb6d20af 100644 --- a/platform/util/src/com/intellij/openapi/diff/impl/highlighting/Util.java +++ b/platform/util/src/com/intellij/openapi/diff/impl/highlighting/Util.java @@ -72,7 +72,7 @@ public class Util { String[] lines1 = splitByLines(fragment.getText1()); String[] lines2 = splitByLines(fragment.getText2()); if (lines1 != null && lines2 != null && lines1.length != lines2.length) { - LOG.assertTrue(false, "1:<" + fragment.getText1() + "> 2:<" + fragment.getText2() + ">"); + LOG.error("1:<" + fragment.getText1() + "> 2:<" + fragment.getText2() + ">"); } int length = lines1 == null ? lines2.length : lines1.length; DiffFragment[] lines = new DiffFragment[length]; diff --git a/platform/util/src/com/intellij/util/ArrayUtil.java b/platform/util/src/com/intellij/util/ArrayUtil.java index 8c8f973b1206..879d4539fffc 100644 --- a/platform/util/src/com/intellij/util/ArrayUtil.java +++ b/platform/util/src/com/intellij/util/ArrayUtil.java @@ -34,14 +34,15 @@ public class ArrayUtil { public static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; public static final int [] EMPTY_INT_ARRAY = new int[0]; public static final boolean[] EMPTY_BOOLEAN_ARRAY = new boolean[0]; - public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - public static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; + @SuppressWarnings({"SSBasedInspection"}) public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; + @SuppressWarnings({"SSBasedInspection"}) public static final String[] EMPTY_STRING_ARRAY = new String[0]; + @SuppressWarnings({"SSBasedInspection"}) public static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; public static final long[] EMPTY_LONG_ARRAY = new long[0]; public static final Collection[] EMPTY_COLLECTION_ARRAY = new Collection[0]; public static final CharSequence EMPTY_CHAR_SEQUENCE = new CharArrayCharSequence(EMPTY_CHAR_ARRAY); - public static byte[] realloc (final byte [] array, final int newSize) { + @NotNull + public static byte[] realloc (@NotNull byte [] array, final int newSize) { if (newSize == 0) { return EMPTY_BYTE_ARRAY; } @@ -56,7 +57,8 @@ public class ArrayUtil { return result; } - public static int[] realloc (final int [] array, final int newSize) { + @NotNull + public static int[] realloc (@NotNull int [] array, final int newSize) { if (newSize == 0) { return EMPTY_INT_ARRAY; } @@ -71,13 +73,15 @@ public class ArrayUtil { return result; } - public static int[] append(int[] array, int value) { + @NotNull + public static int[] append(@NotNull int[] array, int value) { array = realloc(array, array.length + 1); array[array.length - 1] = value; return array; } - public static char[] realloc (final char[] array, final int newSize) { + @NotNull + public static char[] realloc (@NotNull char[] array, final int newSize) { if (newSize == 0) { return EMPTY_CHAR_ARRAY; } @@ -117,7 +121,8 @@ public class ArrayUtil { return collection.toArray(new String[collection.size()]); } - public static T[] mergeArrays(T[] a1, T[] a2, Class aClass) { + @NotNull + public static T[] mergeArrays(@NotNull T[] a1, @NotNull T[] a2, @NotNull Class aClass) { if (a1.length == 0) { return a2; } @@ -156,10 +161,12 @@ public class ArrayUtil { * @param src array to which the element should be appended. * @param element object to be appended to the end of src array. */ + @NotNull public static T[] append(@NotNull final T[] src,final T element){ return append(src, element, (Class)src.getClass().getComponentType()); } + @NotNull public static T[] append(@NotNull T[] src, final T element, @NotNull Class componentType) { int length=src.length; T[] result=(T[])Array.newInstance(componentType, length+ 1); diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java index 394f67ac39f5..0bff817da623 100644 --- a/platform/util/src/com/intellij/util/ReflectionUtil.java +++ b/platform/util/src/com/intellij/util/ReflectionUtil.java @@ -65,10 +65,8 @@ public class ReflectionUtil { final TypeVariable typeVariable = (TypeVariable)resolved; index = ArrayUtil.find(ReflectionCache.getTypeParameters(anInterface), typeVariable); if (index < 0) { - LOG.assertTrue(false, "Cannot resolve type variable:\n" + - "typeVariable = " + typeVariable + "\n" + - "genericDeclaration = " + declarationToString(typeVariable.getGenericDeclaration()) + "\n" + - "searching in " + declarationToString(anInterface)); + LOG.error("Cannot resolve type variable:\n" + "typeVariable = " + typeVariable + "\n" + "genericDeclaration = " + + declarationToString(typeVariable.getGenericDeclaration()) + "\n" + "searching in " + declarationToString(anInterface)); } final Type type = i < genericInterfaces.length ? genericInterfaces[i] : aClass.getGenericSuperclass(); if (type instanceof Class) { diff --git a/platform/util/src/com/intellij/util/containers/VariableWidthIntArray.java b/platform/util/src/com/intellij/util/containers/VariableWidthIntArray.java index ef5cc676d492..f82ca19646ec 100644 --- a/platform/util/src/com/intellij/util/containers/VariableWidthIntArray.java +++ b/platform/util/src/com/intellij/util/containers/VariableWidthIntArray.java @@ -82,13 +82,13 @@ public final class VariableWidthIntArray implements Cloneable { case SHORT: return shortArray[index]; case BYTE: return byteArray[index]; } - LOG.assertTrue( false, "No array allocated" ); + LOG.error("No array allocated"); return 0; } public void put( int index, int value ) { if( value < minValue || value > maxValue ) { - LOG.assertTrue( false, "Value out of domain" ); + LOG.error("Value out of domain"); } switch( arrayType ) { @@ -97,7 +97,7 @@ public final class VariableWidthIntArray implements Cloneable { case BYTE: byteArray[index] = (byte)value; return; } - LOG.assertTrue( false, "No array allocated" ); + LOG.error("No array allocated"); } public Object clone() throws CloneNotSupportedException { @@ -118,7 +118,8 @@ public final class VariableWidthIntArray implements Cloneable { case INT: System.arraycopy( intArray, from, intArray, to, count ); break; case SHORT: System.arraycopy( shortArray, from, shortArray, to, count ); break; case BYTE: System.arraycopy( byteArray, from, byteArray, to, count ); break; - default: LOG.assertTrue( false, "Invalid array type" ); + default: + LOG.error("Invalid array type"); } } diff --git a/platform/util/src/com/intellij/util/xmlb/OptionTagBinding.java b/platform/util/src/com/intellij/util/xmlb/OptionTagBinding.java index 2a7c8e6b9f78..e076e3632735 100644 --- a/platform/util/src/com/intellij/util/xmlb/OptionTagBinding.java +++ b/platform/util/src/com/intellij/util/xmlb/OptionTagBinding.java @@ -18,6 +18,7 @@ package com.intellij.util.xmlb; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.JDOMUtil; +import com.intellij.util.ArrayUtil; import org.jdom.Attribute; import org.jdom.Content; import org.jdom.Element; @@ -87,7 +88,7 @@ class OptionTagBinding implements Binding { } if (children.size() > 0) { - Object value = myBinding.deserialize(accessor.read(o), children.toArray(new Object[children.size()])); + Object value = myBinding.deserialize(accessor.read(o), ArrayUtil.toObjectArray(children)); accessor.write(o, value); } else { diff --git a/platform/vcs-impl/src/com/intellij/ide/actions/StartUseVcsDialog.java b/platform/vcs-impl/src/com/intellij/ide/actions/StartUseVcsDialog.java index 61b699d9281f..7b67aef3f0f5 100644 --- a/platform/vcs-impl/src/com/intellij/ide/actions/StartUseVcsDialog.java +++ b/platform/vcs-impl/src/com/intellij/ide/actions/StartUseVcsDialog.java @@ -19,6 +19,7 @@ import com.intellij.openapi.help.HelpManager; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.MultiLineLabelUI; import com.intellij.openapi.vcs.VcsBundle; +import com.intellij.util.ArrayUtil; import com.intellij.util.ui.UIUtil; import javax.swing.*; @@ -113,7 +114,7 @@ public class StartUseVcsDialog extends DialogWrapper { keys.add(""); keys.addAll(displayNames); Collections.sort(keys); - return keys.toArray(new Object[keys.size()]); + return ArrayUtil.toObjectArray(keys); } private static class VcsCombo extends JComboBox { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsGroupsWrapper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsGroupsWrapper.java index 7cbd28e6314f..acdee8ce2017 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsGroupsWrapper.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsGroupsWrapper.java @@ -44,9 +44,8 @@ public class VcsGroupsWrapper extends DefaultActionGroup { 0)); for (AnAction child : children) { if (!(child instanceof StandardVcsGroup)) { - LOG.assertTrue(false, - "Any version control group should extends com.intellij.openapi.vcs.actions.StandardVcsGroup class. Groupd class: " + - child.getClass().getName() + ", group ID: " + ActionManager.getInstance().getId(child)); + LOG.error("Any version control group should extends com.intellij.openapi.vcs.actions.StandardVcsGroup class. Groupd class: " + + child.getClass().getName() + ", group ID: " + ActionManager.getInstance().getId(child)); } else { validChildren.add(child); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java index 44c0946f3b13..f476453ee4b3 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java @@ -390,7 +390,7 @@ public class LineStatusTracker { myRanges.addAll(rangesAfterChange); if (myHighlighterCount != myRanges.size()) { - LOG.assertTrue(false, "Highlighters: " + myHighlighterCount + ", ranges: " + myRanges.size()); + LOG.error("Highlighters: " + myHighlighterCount + ", ranges: " + myRanges.size()); } myRanges = mergeRanges(myRanges); @@ -401,7 +401,7 @@ public class LineStatusTracker { } if (myHighlighterCount != myRanges.size()) { - LOG.assertTrue(false, "Highlighters: " + myHighlighterCount + ", ranges: " + myRanges.size()); + LOG.error("Highlighters: " + myHighlighterCount + ", ranges: " + myRanges.size()); } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java index 2e341af96700..eba9acb089a3 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java @@ -53,7 +53,7 @@ public class Range { if ((change.deleted > 0) && (change.inserted > 0)) return MODIFIED; if ((change.deleted > 0)) return DELETED; if ((change.inserted > 0)) return INSERTED; - LOG.assertTrue(false, "Unknown change type"); + LOG.error("Unknown change type"); return 0; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java index 4a2be06fd5d3..23129e1810c3 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java @@ -40,6 +40,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.registry.Registry; import com.intellij.ui.content.Content; import com.intellij.ui.content.tabs.PinToolwindowTabAction; +import com.intellij.util.ArrayUtil; import com.intellij.xdebugger.XDebugProcess; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerBundle; @@ -132,7 +133,7 @@ public class XDebugSessionTab extends DebuggerLogConsoleManagerBase { public XDebugSessionData saveData() { final List watchExpressions = myWatchesView.getWatchExpressions(); - return new XDebugSessionData(watchExpressions.toArray(new String[watchExpressions.size()])); + return new XDebugSessionData(ArrayUtil.toStringArray(watchExpressions)); } public ExecutionConsole getConsole() { diff --git a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataNavigationHandler.java b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataNavigationHandler.java index 0856f6cd98f3..8682806dc338 100644 --- a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataNavigationHandler.java +++ b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataNavigationHandler.java @@ -99,7 +99,7 @@ public class TestDataNavigationHandler implements GutterIconNavigationHandler index) return; myLastPacketIndex++; diff --git a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorerTreeStructure.java b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorerTreeStructure.java index bcfbce834253..5049c3356a37 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorerTreeStructure.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorerTreeStructure.java @@ -64,7 +64,7 @@ final class AntExplorerTreeStructure extends AbstractTreeStructure { else if (element instanceof AntBuildTarget) { return new AntTargetNodeDescriptor(myProject, parentDescriptor, (AntBuildTargetBase)element); } - LOG.assertTrue(false, "Unknown element for this tree structure " + element); + LOG.error("Unknown element for this tree structure " + element); return null; } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/AddFileOrDirectoryAction.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/AddFileOrDirectoryAction.java index 827878244f3e..0ad0135e5991 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/AddFileOrDirectoryAction.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/AddFileOrDirectoryAction.java @@ -104,7 +104,7 @@ public class AddFileOrDirectoryAction extends ActionOnSelectedElement { Collection roots = new CreateTreeOnFileList(filesToAdd, project, includeAllRoots).getRoots(); if (roots.size() == 0) { - LOG.assertTrue(false, filesToAdd); + LOG.error(filesToAdd.toString()); } if (showDialog){ diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/IgnoreFileAction.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/IgnoreFileAction.java index a16592798c9c..aeef0caf2a9b 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/IgnoreFileAction.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/IgnoreFileAction.java @@ -113,9 +113,7 @@ public class IgnoreFileAction extends AnAction { VirtualFile cvsIgnoreFile = CvsVfsUtil.refreshAndfFindChild(parent, CvsUtil.CVS_IGNORE_FILE); if (cvsIgnoreFile == null) { String path = parent.getPath() + "/" + CvsUtil.CVS_IGNORE_FILE; - LOG.assertTrue(false, - String.valueOf(CvsVfsUtil.findFileByPath(path)) + " " + parent.getPath() + " " + - new File(VfsUtil.virtualToIoFile(parent), CvsUtil.CVS_IGNORE_FILE).isFile()); + LOG.error(String.valueOf(CvsVfsUtil.findFileByPath(path)) + " " + parent.getPath() + " " + new File(VfsUtil.virtualToIoFile(parent), CvsUtil.CVS_IGNORE_FILE).isFile()); return; } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsApplicationLevelConfiguration.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsApplicationLevelConfiguration.java index cdb94979508b..b807b713baaf 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsApplicationLevelConfiguration.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsApplicationLevelConfiguration.java @@ -147,7 +147,7 @@ public class CvsApplicationLevelConfiguration implements ApplicationComponent, J return result; } catch (Exception ex) { - LOG.assertTrue(false, "userHome = " + userHome + ", presenation = " + presentation); + LOG.error("userHome = " + userHome + ", presenation = " + presentation); return ""; } } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsAdd/AddFileOperation.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsAdd/AddFileOperation.java index 62fe1b7dec69..dbea13021049 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsAdd/AddFileOperation.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsAdd/AddFileOperation.java @@ -45,7 +45,7 @@ public class AddFileOperation extends CvsOperationOnFiles { List fileObjects = command.getFileObjects().getFileObjects(); for (final AbstractFileObject fileObject: fileObjects) { if (fileObject.getParent() == null) { - LOG.assertTrue(false, "Local Root: " + getLocalRootFor(root) + ", Files: " + myFiles); + LOG.error("Local Root: " + getLocalRootFor(root) + ", Files: " + myFiles); } } } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/javacvsSpecificImpls/AdminWriterOnCache.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/javacvsSpecificImpls/AdminWriterOnCache.java index 32400daadd5b..b77014a99714 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/javacvsSpecificImpls/AdminWriterOnCache.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/javacvsSpecificImpls/AdminWriterOnCache.java @@ -118,7 +118,7 @@ public class AdminWriterOnCache implements IAdminWriter { } public void pruneDirectory(DirectoryObject directoryObject, ICvsFileSystem cvsFileSystem) { - LOG.assertTrue(false, "Cannot be called"); + LOG.error("Cannot be called"); } public void editFile(FileObject fileObject, diff --git a/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHMain.java b/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHMain.java index 991226263ce0..8eb04a347743 100644 --- a/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHMain.java +++ b/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHMain.java @@ -440,7 +440,7 @@ public class SSHMain { database.addHostkeys(knownHostFile); } final List algorithms = myHost.getHostKeyAlgorithms(); - c.setServerHostKeyAlgorithms(algorithms.toArray(new String[algorithms.size()])); + c.setServerHostKeyAlgorithms(ArrayUtil.toStringArray(algorithms)); } /** @@ -520,7 +520,7 @@ public class SSHMain { return rc; } else { - return result.toArray(new String[result.size()]); + return ArrayUtil.toStringArray(result); } } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyParameterInfoHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyParameterInfoHandler.java index 019dfba4f977..a312c60674a0 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyParameterInfoHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyParameterInfoHandler.java @@ -68,7 +68,7 @@ public class GroovyParameterInfoHandler implements ParameterInfoHandler knownKeys = new ArrayList(myKnownObjects.keySet()); Collections.sort(knownKeys); diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/StatisticsTable.java b/plugins/junit/src/com/intellij/execution/junit2/ui/StatisticsTable.java index 2a079c63aac2..bb8eca3b22e2 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/StatisticsTable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/StatisticsTable.java @@ -73,7 +73,7 @@ public class StatisticsTable extends ListTableModel { } public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) { - LOG.assertTrue(false, "value: " + aValue + " row: " + rowIndex + " column: " + columnIndex); + LOG.error("value: " + aValue + " row: " + rowIndex + " column: " + columnIndex); } public boolean isCellEditable(final int rowIndex, final int columnIndex) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesConverter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesConverter.java index 34eb8e1aec71..0bd0966ed633 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesConverter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesConverter.java @@ -312,7 +312,7 @@ public abstract class MavenArtifactCoordinatesConverter extends ResolvingConvert private String[] getGroupIdVariants(MavenProjectIndicesManager manager, MavenDomShortArtifactCoordinates coordinates) { if (DomUtil.hasXml(coordinates.getGroupId())) { Set strings = manager.getGroupIds(); - return strings.toArray(new String[strings.size()]); + return ArrayUtil.toStringArray(strings); } return MavenArtifactUtil.DEFAULT_GROUPS; } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java index 71234c65b98f..37ebc09c5559 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java @@ -28,6 +28,7 @@ import com.intellij.psi.xml.XmlDocument; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; import com.intellij.psi.xml.XmlTagChild; +import com.intellij.util.ArrayUtil; import com.intellij.util.Function; import com.intellij.util.Icons; import com.intellij.util.IncorrectOperationException; @@ -199,7 +200,7 @@ public class MavenPropertyPsiReference extends MavenPsiReference { public Object[] getVariants() { List result = new ArrayList(); collectVariants(result); - return result.toArray(new Object[result.size()]); + return ArrayUtil.toObjectArray(result); } protected void collectVariants(List result) { diff --git a/plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java b/plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java index 479b6b701bd3..a9300721225b 100644 --- a/plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java +++ b/plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java @@ -105,7 +105,7 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, else {*/ ElementManipulator manipulator = ElementManipulators.getManipulator(myElement); if (manipulator == null) { - LOG.assertTrue(false, "Cannot find manipulator for " + myElement + " of class " + myElement.getClass()); + LOG.error("Cannot find manipulator for " + myElement + " of class " + myElement.getClass()); } return manipulator.handleContentChange(myElement, getRangeInElement(), newElementName); /*}*/ diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java index c48319cb8625..6d569fce7b67 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java @@ -18,6 +18,7 @@ package org.jetbrains.idea.svn.dialogs.browser; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vcs.VcsConfiguration; +import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; @@ -92,7 +93,7 @@ public class DeleteOptionsDialog extends DialogWrapper { final ArrayList messages = VcsConfiguration.getInstance(myProject).getRecentMessages(); Collections.reverse(messages); - final String[] model = messages.toArray(new String[messages.size()]); + final String[] model = ArrayUtil.toStringArray(messages); final JComboBox messagesBox = new JComboBox(model); messagesBox.setRenderer(new MessageBoxCellRenderer()); panel.add(messagesBox, gc); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java index d16e78bb0d3e..6de82420a5d8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java @@ -22,6 +22,7 @@ import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.DepthCombo; @@ -165,7 +166,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener final ArrayList messages = VcsConfiguration.getInstance(myProject).getRecentMessages(); Collections.reverse(messages); - final String[] model = messages.toArray(new String[messages.size()]); + final String[] model = ArrayUtil.toStringArray(messages); final JComboBox messagesBox = new JComboBox(model); messagesBox.setRenderer(new MessageBoxCellRenderer()); panel.add(messagesBox, gc); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java index 5f69a79898f1..0333d4f555e3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java @@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.ui.DocumentAdapter; +import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; import org.tmatesoft.svn.core.SVNException; @@ -64,7 +65,7 @@ public class MkdirOptionsDialog extends DialogWrapper { final ArrayList messages = VcsConfiguration.getInstance(project).getRecentMessages(); Collections.reverse(messages); - final String[] model = messages.toArray(new String[messages.size()]); + final String[] model = ArrayUtil.toStringArray(messages); myMessagesBox.setModel(new DefaultComboBoxModel(model)); myMessagesBox.setRenderer(new MessageBoxCellRenderer()); } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridDropLocation.java b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridDropLocation.java index c66cae060f30..d4c89d4fe0ef 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridDropLocation.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridDropLocation.java @@ -209,9 +209,8 @@ public class GridDropLocation implements ComponentDropLocation { RadComponent old = container.findComponentInRect(row + relativeRow, column + relativeCol, rowSpan, colSpan); if (old != null) { - LOG.assertTrue(false, - "Drop rectangle not empty: (" + (row + relativeRow) + ", " + (column + relativeCol) - + ", " + rowSpan + ", " + colSpan + "), component ID=" + old.getId()); + LOG.error("Drop rectangle not empty: (" + (row + relativeRow) + ", " + (column + relativeCol) + ", " + rowSpan + ", " + colSpan + + "), component ID=" + old.getId()); } final GridConstraints constraints = c.getConstraints(); diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltContextProvider.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltContextProvider.java index 979dee5ddfd9..45378bd859c6 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltContextProvider.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltContextProvider.java @@ -27,6 +27,7 @@ import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.*; +import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; import com.intellij.xml.XmlAttributeDescriptor; import com.intellij.xml.XmlElementDescriptor; @@ -264,7 +265,7 @@ public class XsltContextProvider extends ContextProvider { } //noinspection unchecked - return new Result(names, names.dependencies.toArray(new Object[names.dependencies.size()])); + return new Result(names, ArrayUtil.toObjectArray(names.dependencies)); } }, false); } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/ModeReference.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/ModeReference.java index 27b2dfafba7f..b28d84643769 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/ModeReference.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/ModeReference.java @@ -77,7 +77,7 @@ class ModeReference extends SimpleAttributeReference implements PsiPolyVariantRe final PsiElement[] modes = ResolveUtil.collect(getMatcher().variantMatcher()); l.addAll(Arrays.asList(modes)); } - return l.toArray(new Object[l.size()]); + return ArrayUtil.toObjectArray(l); } return ArrayUtil.EMPTY_OBJECT_ARRAY; } @@ -165,7 +165,7 @@ class ModeReference extends SimpleAttributeReference implements PsiPolyVariantRe lookups.add(new NamespaceLookup(prefix)); } - return lookups.toArray(new Object[lookups.size()]); + return ArrayUtil.toObjectArray(lookups); } public void registerQuickfix(HighlightInfo highlightInfo, PrefixReference psiReference) { diff --git a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java index 1a821147747b..cc56c4838485 100644 --- a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java +++ b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java @@ -235,7 +235,7 @@ public class XPathEvalAction extends XPathAction { } else if (result instanceof Boolean) { Messages.showMessageDialog(result.toString(), "XPath result (Boolean)", Messages.getInformationIcon()); } else { - LOG.assertTrue(false, "Unknown XPath result: " + result); + LOG.error("Unknown XPath result: " + result); } } catch (XPathSyntaxException e) { LOG.debug(e); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java index 7912652468eb..234de3afe58c 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java @@ -38,7 +38,7 @@ public abstract class DomAnchorImpl { public static DomAnchorImpl createAnchor(@NotNull T t) { final DomElement parent = t.getParent(); if (parent == null) { - LOG.assertTrue(false, "Parent null: " + t); + LOG.error("Parent null: " + t); } if (parent instanceof DomFileElementImpl) { @@ -73,7 +73,7 @@ public abstract class DomAnchorImpl { } } diag.append("Child name: ").append(t.getXmlElementName()).append(";").append(t.getXmlElementNamespaceKey()); - LOG.assertTrue(false, diag); + LOG.error(diag.toString()); } return new IndexedAnchor(parentAnchor, description, index); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java index b03360b4bc12..a4d19f215895 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java @@ -270,7 +270,7 @@ public class DomFileElementImpl implements DomFileElement< if (fileElement == null) { final FileDescriptionCachedValueProvider provider = myManager.getOrCreateCachedValueProvider(myFile); String s = provider.getFileElementWithLogging(); - LOG.assertTrue(false, "Null, log=" + s); + LOG.error("Null, log=" + s); } else { assert false: this + " does not equal to " + fileElement; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java index fca7ce5da904..c7decb64abd3 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java @@ -79,7 +79,7 @@ public abstract class DomInvocationHandler" + parameter.getName()); + LOG.error("No converter specified: String<->" + parameter.getName()); } return converter; } @@ -139,7 +139,7 @@ public abstract class DomInvocationHandler(result[0], deps.toArray(new Object[deps.size()])); + return new CachedValueProvider.Result(result[0], ArrayUtil.toObjectArray(deps)); } finally { targetElement.putUserData(EVALUATION_IN_PROCESS, null); diff --git a/xml/impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java b/xml/impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java index da409f4e1e23..17e875218422 100644 --- a/xml/impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java +++ b/xml/impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java @@ -316,14 +316,9 @@ public class ExternalDocumentValidator { private static void assertValidElement(PsiElement currentElement, PsiElement originalElement, String message) { if (currentElement==null) { XmlTag tag = PsiTreeUtil.getParentOfType(originalElement, XmlTag.class); - LOG.assertTrue( - false, - "The validator message:"+ message+ " is bound to null node,\n" + - "initial element:"+originalElement.getText()+",\n"+ - "parent:" + originalElement.getParent()+",\n" + - "tag:" + (tag != null? tag.getText():"null") + ",\n" + - "offset in tag: " + (originalElement.getTextOffset() - (tag == null ? 0 : tag.getTextOffset())) - ); + LOG.error("The validator message:" + message + " is bound to null node,\n" + "initial element:" + originalElement.getText() + ",\n" + + "parent:" + originalElement.getParent() + ",\n" + "tag:" + (tag != null ? tag.getText() : "null") + ",\n" + + "offset in tag: " + (originalElement.getTextOffset() - (tag == null ? 0 : tag.getTextOffset()))); } }