EA-23902 (diagnostics)

This commit is contained in:
Roman Shevchenko
2011-02-02 18:39:53 +01:00
parent d373545152
commit f227331cae
4 changed files with 37 additions and 12 deletions
@@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author max
*/
package com.intellij.psi.stubs;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.diagnostic.LogUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.io.FileUtil;
@@ -40,6 +37,9 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/*
* @author max
*/
public class SerializationManagerImpl extends SerializationManager implements ApplicationComponent {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.SerializationManagerImpl");
@@ -213,7 +213,7 @@ public class SerializationManagerImpl extends SerializationManager implements Ap
private int getClassId(final StubSerializer serializer) {
final Integer idValue = mySerializerToId.get(serializer);
assert idValue != null: "No ID found for serializer " + serializer;
assert idValue != null: "No ID found for serializer " + LogUtil.objectAndClass(serializer);
return idValue.intValue();
}
@@ -238,4 +238,3 @@ public class SerializationManagerImpl extends SerializationManager implements Ap
}
}
}
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author max
*/
package com.intellij.psi.stubs;
import org.jetbrains.annotations.NonNls;
import java.io.IOException;
/*
* @author max
*/
public interface StubSerializer<T extends StubElement> {
@NonNls
String getExternalId();
@@ -22,6 +22,7 @@ package com.intellij.psi.impl.source.tree;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.diagnostic.LogUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.ILazyParseableElementType;
@@ -174,9 +175,9 @@ public class LazyParseableElement extends CompositeElement {
if (parsedNode == null && myText.length() > 0) {
if (ApplicationManagerEx.getApplicationEx().isInternal() && !ApplicationManager.getApplication().isUnitTestMode()) {
LOG.error("No parse for a non-empty string: " + myText + "; type=" + type + " (" + type.getClass().getName() + ")");
LOG.error("No parse for a non-empty string: " + myText + "; type=" + LogUtil.objectAndClass(type));
} else {
LOG.error("No parse for a non-empty string: type=" + type + " (" + type.getClass().getName() + ")");
LOG.error("No parse for a non-empty string: type=" + LogUtil.objectAndClass(type));
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.diagnostic;
import org.jetbrains.annotations.Nullable;
public class LogUtil {
private LogUtil() { }
public static String objectAndClass(@Nullable final Object o) {
return o != null ? o + " (" + o.getClass().getName() + ")" : "null";
}
}