else if (tag == FIELD_INFO_TAG) {
return new FieldInfo(in);
}
- LOG.assertTrue(false, "Unknown member info");
+ LOG.error("Unknown member info");
return null;
}
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;
}
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;
}
out.writeByte(FIELD_INFO_TAG);
}
else {
- LOG.assertTrue(false, "Unknown member info");
+ LOG.error("Unknown member info");
}
info.save(out);
}
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));
}
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};
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));
}
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));
}
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;
}
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) {
@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();
buffer.append(getPrimitiveSignature(psiType.getCanonicalText()));
}
else {
- LOG.assertTrue(false, "unknown type " + type.getCanonicalText());
+ LOG.error("unknown type " + type.getCanonicalText());
}
}
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<ReferenceType> outers = myDebugProcess.getVirtualMachineProxy().classesByName(parentClassName);
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) {}
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;
}
}
}
if(getCurrentRequest() != current) {
- LOG.assertTrue(false, "Expected " + current + " instead of " + getCurrentRequest());
+ LOG.error("Expected " + current + " instead of " + getCurrentRequest());
}
processEvent(myEvents.get());
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;
}
}
final DescriptorData<FieldDescriptorImpl> 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);
}
if (modules.length > 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);
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.*;
final List<String> macros = new ArrayList<String>(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();
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;
}
}
}
- LOG.assertTrue(false, "Unknown library " + item);
+ LOG.error("Unknown library " + item);
return null;
}
}
}
}
- LOG.assertTrue(false, "Unknown library " + item);
+ LOG.error("Unknown library " + item);
return null;
}
if (columnIndex == ITEM_COLUMN) {
return item;
}
- LOG.assertTrue(false, "Incorrect column index: " + columnIndex);
+ LOG.error("Incorrect column index: " + columnIndex);
return null;
}
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 {
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;
myBuilder.addSubtreeToUpdate(treeNode, new Runnable() {
public void run() {
List<PackagingElementNode<?>> nodes = myTree.findNodes(toSelect);
- myBuilder.select(nodes.toArray(new Object[nodes.size()]), null);
+ myBuilder.select(ArrayUtil.toObjectArray(nodes), null);
}
});
}
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;
@Override
public Object[] getEqualityObjects() {
- return myPackagingElements.toArray(new Object[myPackagingElements.size()]);
+ return ArrayUtil.toObjectArray(myPackagingElements);
}
@Override
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);
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;
}
if (array.isEmpty()) return;
- Object[] selectedObjects = array.toArray(new Object[array.size()]);
+ Object[] selectedObjects = ArrayUtil.toObjectArray(array);
Arrays.sort(
selectedObjects,
new Comparator<Object>() {
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<PsiParameter, String>() {
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();
}
}
}
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());
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;
}
return JavaResolveResult.EMPTY_ARRAY;
}
else {
- LOG.assertTrue(false, "Invalid java reference!");
+ LOG.error("Invalid java reference!");
return JavaResolveResult.EMPTY_ARRAY;
}
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) {
}
}
else {
- LOG.assertTrue(false, "Wrong element type: " + original.getElementType());
+ LOG.error("Wrong element type: " + original.getElementType());
}
}
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);
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());
}
return 14;
}
else {
- LOG.assertTrue(false, "Unknown element type:"+i);
+ LOG.error("Unknown element type:" + i);
return -1;
}
}
}
}
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){
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{
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");
}
}
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);
else if (parent instanceof PsiAnonymousClass) {
return ((PsiNewExpression)parent.getParent()).resolveConstructor();
}
- LOG.assertTrue(false, "Unknown reference");
+ LOG.error("Unknown reference");
return null;
}
if (myFlowStart <= startOffset && endOffset <= myFlowEnd) continue;
}
else {
- LOG.assertTrue(false, exitStatement);
+ LOG.error(String.valueOf(exitStatement));
continue;
}
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);
}
}
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);
}
visitor.visitReadUsage(expression, null, referencedElement);
}
else {
- LOG.assertTrue(false, "Unknown variation of class instance usage");
+ LOG.error("Unknown variation of class instance usage");
}
}
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) {
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();
}
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);
}
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);
}
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)) {
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);
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;
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);
protected <T> T findNotNullChildByClass(Class<T> 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;
}
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;
}
protected Object[] getAllElements() {
- return data.toArray(new Object[data.size()]);
+ return ArrayUtil.toObjectArray(data);
}
protected String getElementText(Object element) {
if (result.isEmpty()) {
result.add(getEmptyScreen());
}
- return result.toArray(new Object[result.size()]);
+ return ArrayUtil.toObjectArray(result);
}
catch (Exception e) {
}
}
}
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);
}
}
}
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) {
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);
}
ApplicationManager.getApplication().assertReadAccessAllowed();
if (!vFile.isValid()) {
- LOG.assertTrue(false, "Invalid file: " + vFile);
+ LOG.error("Invalid file: " + vFile);
return null;
}
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;
}
@NotNull
public <E extends PsiElement> SmartPsiElementPointer<E> createSmartPsiElementPointer(E element) {
if (!element.isValid()) {
- LOG.assertTrue(false, "Invalid element:" + element);
+ LOG.error("Invalid element:" + element);
}
PsiFile file = element.getContainingFile();
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;
private PsiFile getContainingFile() {
PsiFile file = myElement.getContainingFile();
if (file == null) {
- LOG.assertTrue(false, "Invalid element: " + myElement);
+ LOG.error("Invalid element: " + myElement);
}
return file.getOriginalFile();
if (tree instanceof FileElement) return ((FileElement)tree).getCharTable();
tree = tree.getTreeParent();
}
- LOG.assertTrue(false, "Invalid root element");
+ LOG.error("Invalid root element");
return null;
}
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));
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;
}
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()) {
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)) {
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);
myEventMulticaster.startNotified(new ProcessEvent(this));
}
else {
- LOG.assertTrue(false, "startNotify called already");
+ LOG.error("startNotify called already");
}
}
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);
}
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);
}
for (Iterator<TextSection> 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();
}
}
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;
}
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;
}
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;
}
}
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);
synchronized (myLock) {
final boolean wasRemoved = myActivityListeners.remove(runnable);
if (!wasRemoved) {
- LOG.assertTrue(false, "unknown runnable: " + runnable);
+ LOG.error("unknown runnable: " + runnable);
}
}
}
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();
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) {
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());
}
}
public void removeTimerListener(TimerListener listener){
final boolean removed = myTimerListeners.remove(listener);
if (!removed) {
- LOG.assertTrue(false, "Unknown listener " + listener);
+ LOG.error("Unknown listener " + listener);
}
}
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;
}
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();
}
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]));
}
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]));
}
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') &&
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);
return res;
}
else {
- LOG.assertTrue(false, comp != null ? comp.getClass().getName() : null);
+ LOG.error(comp != null ? comp.getClass().getName() : null);
return null;
}
}
final IndexUpdateRunnable nextUpdateRunnable = myUpdatesQueue.pullFirst();
// run next action under already existing progress indicator
if (!myActionQueue.offer(new Ref<CacheUpdateRunner>(nextUpdateRunnable.myAction))) {
- LOG.assertTrue(false, "Action queue rejected next updateRunnable!");
+ LOG.error("Action queue rejected next updateRunnable!");
nextUpdateRunnable.run();
}
}
names.add(info.name);
}
- return names.toArray(new String[names.size()]);
+ return ArrayUtil.toStringArray(names);
}
public boolean exists(String path) {
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.*;
objects.add(itemAt);
}
}
- setModel(new DefaultComboBoxModel(objects.toArray(new Object[objects.size()])));
+ setModel(new DefaultComboBoxModel(ArrayUtil.toObjectArray(objects)));
}
private class MyEditor implements ComboBoxEditor {
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);
@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;
}
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
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;
if (comparator != null) {
ArrayList<?> list = new ArrayList<Object>(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);
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));
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];
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;
}
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;
}
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;
}
return collection.toArray(new String[collection.size()]);
}
- public static <T> T[] mergeArrays(T[] a1, T[] a2, Class<T> aClass) {
+ @NotNull
+ public static <T> T[] mergeArrays(@NotNull T[] a1, @NotNull T[] a2, @NotNull Class<T> aClass) {
if (a1.length == 0) {
return a2;
}
* @param src array to which the <code>element</code> should be appended.
* @param element object to be appended to the end of <code>src</code> array.
*/
+ @NotNull
public static <T> T[] append(@NotNull final T[] src,final T element){
return append(src, element, (Class<T>)src.getClass().getComponentType());
}
+ @NotNull
public static <T> T[] append(@NotNull T[] src, final T element, @NotNull Class<T> componentType) {
int length=src.length;
T[] result=(T[])Array.newInstance(componentType, length+ 1);
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) {
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 ) {
case BYTE: byteArray[index] = (byte)value; return;
}
- LOG.assertTrue( false, "No array allocated" );
+ LOG.error("No array allocated");
}
public Object clone() throws CloneNotSupportedException {
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");
}
}
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;
}
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 {
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.*;
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 {
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);
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);
}
if (myHighlighterCount != myRanges.size()) {
- LOG.assertTrue(false, "Highlighters: " + myHighlighterCount + ", ranges: " + myRanges.size());
+ LOG.error("Highlighters: " + myHighlighterCount + ", ranges: " + myRanges.size());
}
}
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;
}
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;
public XDebugSessionData saveData() {
final List<String> watchExpressions = myWatchesView.getWatchExpressions();
- return new XDebugSessionData(watchExpressions.toArray(new String[watchExpressions.size()]));
+ return new XDebugSessionData(ArrayUtil.toStringArray(watchExpressions));
}
public ExecutionConsole getConsole() {
if (myFileNames.size() == 2) {
shortNames.add(CREATE_MISSING_OPTION);
}
- final JList list = new JList(shortNames.toArray(new String[shortNames.size()]));
+ final JList list = new JList(ArrayUtil.toStringArray(shortNames));
list.setCellRenderer(new ColoredListCellRenderer() {
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
SegmentReader reader = new SegmentReader(packet);
int index = reader.readInt();
if (myLastPacketIndex + 1 < index) {
- LOG.assertTrue(false, "last: " + myLastPacketIndex + " current: " + index);
+ LOG.error("last: " + myLastPacketIndex + " current: " + index);
}
if (myLastPacketIndex + 1 > index) return;
myLastPacketIndex++;
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;
}
Collection<AddedFileInfo> roots = new CreateTreeOnFileList(filesToAdd, project, includeAllRoots).getRoots();
if (roots.size() == 0) {
- LOG.assertTrue(false, filesToAdd);
+ LOG.error(filesToAdd.toString());
}
if (showDialog){
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;
}
return result;
}
catch (Exception ex) {
- LOG.assertTrue(false, "userHome = " + userHome + ", presenation = " + presentation);
+ LOG.error("userHome = " + userHome + ", presenation = " + presentation);
return "";
}
}
List<AbstractFileObject> 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);
}
}
}
}
public void pruneDirectory(DirectoryObject directoryObject, ICvsFileSystem cvsFileSystem) {
- LOG.assertTrue(false, "Cannot be called");
+ LOG.error("Cannot be called");
}
public void editFile(FileObject fileObject,
database.addHostkeys(knownHostFile);
}
final List<String> algorithms = myHost.getHostKeyAlgorithms();
- c.setServerHostKeyAlgorithms(algorithms.toArray(new String[algorithms.size()]));
+ c.setServerHostKeyAlgorithms(ArrayUtil.toStringArray(algorithms));
}
/**
return rc;
}
else {
- return result.toArray(new String[result.size()]);
+ return ArrayUtil.toStringArray(result);
}
}
}
methods.add(new GroovyResolveResultImpl(element, true));
}
}
- return methods.toArray(new Object[methods.size()]);
+ return ArrayUtil.toObjectArray(methods);
}
return null;
return groovyResolveResult.getElement() instanceof PsiNamedElement;
}
});
- context.setItemsToShow(namedElements.toArray(new Object[namedElements.size()]));
+ context.setItemsToShow(ArrayUtil.toObjectArray(namedElements));
context.showHint(place, place.getTextRange().getStartOffset(), this);
}
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
+import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
}
context = context.getContext();
}
- return result.toArray(new Object[result.size()]);
+ return ArrayUtil.toObjectArray(result);
}
public boolean isSoft() {
variantList.add(variant);
}
- propertyVariants = variantList.toArray(new Object[variantList.size()]);
+ propertyVariants = ArrayUtil.toObjectArray(variantList);
}
}
propertyVariants =
- ArrayUtil.mergeArrays(propertyVariants, namedArgsVariants.toArray(new Object[namedArgsVariants.size()]), Object.class);
+ ArrayUtil.mergeArrays(propertyVariants, ArrayUtil.toObjectArray(namedArgsVariants), Object.class);
if (refExpr.getKind() == GrReferenceExpressionImpl.Kind.TYPE_OR_PROPERTY) {
ResolverProcessor classVariantsCollector = CompletionProcessor.createClassCompletionProcessor(refExpr);
result.add(variant);
}
}
- return result.toArray(new Object[result.size()]);
+ return ArrayUtil.toObjectArray(result);
}
private Object[] getVariantsImpl(ReferenceKind kind) {
public TestProxy getByKey(final String key) {
final TestProxy result = myKnownObjects.get(key);
if (result == null) {
- LOG.assertTrue(false, "Unknwon key: " + key);
+ LOG.error("Unknwon key: " + key);
LOG.info("Known keys:");
final ArrayList<String> knownKeys = new ArrayList<String>(myKnownObjects.keySet());
Collections.sort(knownKeys);
}
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) {
private String[] getGroupIdVariants(MavenProjectIndicesManager manager, MavenDomShortArtifactCoordinates coordinates) {
if (DomUtil.hasXml(coordinates.getGroupId())) {
Set<String> strings = manager.getGroupIds();
- return strings.toArray(new String[strings.size()]);
+ return ArrayUtil.toStringArray(strings);
}
return MavenArtifactUtil.DEFAULT_GROUPS;
}
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;
public Object[] getVariants() {
List<Object> result = new ArrayList<Object>();
collectVariants(result);
- return result.toArray(new Object[result.size()]);
+ return ArrayUtil.toObjectArray(result);
}
protected void collectVariants(List<Object> result) {
else {*/
ElementManipulator<PsiElement> 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);
/*}*/
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;
final ArrayList<String> 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);
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;
final ArrayList<String> 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);
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;
final ArrayList<String> 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());
}
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();
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;
}
//noinspection unchecked
- return new Result<ElementNames>(names, names.dependencies.toArray(new Object[names.dependencies.size()]));
+ return new Result<ElementNames>(names, ArrayUtil.toObjectArray(names.dependencies));
}
}, false);
}
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;
}
lookups.add(new NamespaceLookup(prefix));
}
- return lookups.toArray(new Object[lookups.size()]);
+ return ArrayUtil.toObjectArray(lookups);
}
public void registerQuickfix(HighlightInfo highlightInfo, PrefixReference psiReference) {
} 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);
public static <T extends DomElement> DomAnchorImpl<T> 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) {
}
}
diag.append("Child name: ").append(t.getXmlElementName()).append(";").append(t.getXmlElementNamespaceKey());
- LOG.assertTrue(false, diag);
+ LOG.error(diag.toString());
}
return new IndexedAnchor<T>(parentAnchor, description, index);
}
if (fileElement == null) {
final FileDescriptionCachedValueProvider<DomElement> 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;
}
converter = myManager.getConverterManager().getConverterByClass(parameter);
}
if (converter == null) {
- LOG.assertTrue(false, "No converter specified: String<->" + parameter.getName());
+ LOG.error("No converter specified: String<->" + parameter.getName());
}
return converter;
}
protected final void checkIsValid() {
if (!isValid()) {
- LOG.assertTrue(false, myType.toString() + " @" + hashCode() + "\nclass=" + getClass() + "\nxml=" + getXmlElement());
+ LOG.error(myType.toString() + " @" + hashCode() + "\nclass=" + getClass() + "\nxml=" + getXmlElement());
}
}
for (final DomElement child : DomUtil.getDefinedChildren(element, true, true)) {
final XmlElement element1 = child.getXmlElement();
if (element1 == null) {
- LOG.assertTrue(false, "child=" + child + "; parent=" + element);
+ LOG.error("child=" + child + "; parent=" + element);
}
if (element1.isPhysical()) {
visitor.consume(child);
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.psi.xml.XmlFile;
+import com.intellij.util.ArrayUtil;
import com.intellij.util.xml.DomElement;
import com.intellij.util.xml.DomFileElement;
import com.intellij.util.xml.ModelMerger;
if (scope != null) {
dependencies.add(ProjectRootManager.getInstance(getProject()));
}
- return dependencies.toArray(new Object[dependencies.size()]);
+ return ArrayUtil.toObjectArray(dependencies);
}
@Nullable
if (simpleContent != null) {
final HashSet<String> variants = new HashSet<String>();
XmlUtil.collectEnumerationValues(simpleContent, variants);
- return variants.toArray(new Object[variants.size()]);
+ return ArrayUtil.toObjectArray(variants);
}
}
message += "\n contentsText:\n" + getContents().toString();
message += "\n jspText:\n" + getPsi(getBaseLanguage()).getNode().getText();
}
- LOG.assertTrue(false, message);
+ LOG.error(message);
assert false;
}
}
IElementType type = lexer.getTokenType();
if (!XML_WHITE_SPACE_OR_COMMENT_BIT_SET.contains(type)) {
- LOG.assertTrue(false, "Missed token should be white space or comment:" + type);
+ LOG.error("Missed token should be white space or comment:" + type);
throw new RuntimeException();
}
switch (context) {
default :
- LOG.assertTrue(false, "Entity: " + getName() + " context: " + context);
+ LOG.error("Entity: " + getName() + " context: " + context);
return null;
case CONTEXT_ELEMENT_CONTENT_SPEC:
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.xml.XmlElementDescriptor;
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor;
import com.intellij.xml.util.XmlUtil;
}
}
- return new CachedValueProvider.Result<XmlEntityDecl>(result[0], deps.toArray(new Object[deps.size()]));
+ return new CachedValueProvider.Result<XmlEntityDecl>(result[0], ArrayUtil.toObjectArray(deps));
}
finally {
targetElement.putUserData(EVALUATION_IN_PROCESS, null);
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())));
}
}