cleanup - yellow code

This commit is contained in:
Egor.Ushakov
2015-10-06 14:32:06 +03:00
parent 64f113633e
commit a54e96386d
25 changed files with 64 additions and 60 deletions
@@ -1,6 +1,6 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -27,7 +27,7 @@ public class ThrowDebugExceptionAction extends AnAction implements DumbAware {
try{
throw new DebugException();
}
catch(DebugException e){
catch(DebugException ignored){
}
}
}
@@ -52,7 +52,7 @@ public class ViewTextAction extends XFetchValueActionBase {
dialog.setText(StringUtil.unquoteString(value));
}
};
};
}
//@Override
//protected void processText(final Project project, final String text, DebuggerTreeNodeImpl node, DebuggerContextImpl debuggerContext) {
@@ -45,9 +45,9 @@ public class BasicStepMethodFilter implements NamedMethodFilter {
}
protected BasicStepMethodFilter(@NotNull JVMName declaringClassName,
@NotNull String targetMethodName,
JVMName targetMethodSignature,
Range<Integer> callingExpressionLines) {
@NotNull String targetMethodName,
@Nullable JVMName targetMethodSignature,
Range<Integer> callingExpressionLines) {
myDeclaringClassName = declaringClassName;
myTargetMethodName = targetMethodName;
myTargetMethodSignature = targetMethodSignature;
@@ -25,6 +25,7 @@ import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.debugger.ui.impl.watch.MethodsTracker;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.xdebugger.frame.XExecutionStack;
import com.sun.jdi.ThreadReference;
import org.jetbrains.annotations.NotNull;
@@ -38,6 +39,8 @@ import java.util.Iterator;
* @author egor
*/
public class JavaExecutionStack extends XExecutionStack {
private static final Logger LOG = Logger.getInstance(JavaExecutionStack.class);
private final ThreadReferenceProxyImpl myThreadProxy;
private final DebugProcessImpl myDebugProcess;
private volatile JavaStackFrame myTopFrame;
@@ -79,7 +82,7 @@ public class JavaExecutionStack extends XExecutionStack {
}
}
catch (EvaluateException e) {
e.printStackTrace();
LOG.info(e);
}
finally {
myTopFrameReady = true;
@@ -18,13 +18,13 @@ package com.intellij.debugger.engine;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.EvaluatingComputable;
import com.intellij.debugger.engine.evaluation.*;
import com.intellij.debugger.engine.evaluation.expression.*;
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.jdi.LocalVariableProxyImpl;
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
import com.intellij.debugger.ui.impl.watch.*;
@@ -273,7 +273,7 @@ public class JavaValueModifier extends XValueModifier {
return value;
}
private static interface SetValueRunnable {
private interface SetValueRunnable {
void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
InvalidTypeException,
EvaluateException,
@@ -341,10 +341,10 @@ public class JavaValueModifier extends XValueModifier {
}
public void threadAction() {
ExpressionEvaluator evaluator = null;
ExpressionEvaluator evaluator;
try {
evaluator = DebuggerInvocationUtil
.commitAndRunReadAction(evaluationContext.getProject(), new com.intellij.debugger.EvaluatingComputable<ExpressionEvaluator>() {
.commitAndRunReadAction(evaluationContext.getProject(), new EvaluatingComputable<ExpressionEvaluator>() {
public ExpressionEvaluator compute() throws EvaluateException {
return EvaluatorBuilderImpl
.build(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, expression), ContextUtil.getContextElement(evaluationContext),
@@ -565,7 +565,7 @@ public class JavaValueModifier extends XValueModifier {
// editor.show();
//}
@SuppressWarnings({"HardCodedStringLiteral"})
@SuppressWarnings({"HardCodedStringLiteral", "StringToUpperCaseOrToLowerCaseWithoutLocale"})
private static String getDisplayableString(PrimitiveValue value, boolean showAsHex) {
if (value instanceof CharValue) {
long longValue = value.longValue();
@@ -595,7 +595,7 @@ public class JavaValueModifier extends XValueModifier {
long val = value.longValue();
return showAsHex ? "0x" + Long.toHexString(val).toUpperCase() + "L" : value.toString() + "L";
}
return DebuggerUtilsEx.translateStringValue(value.toString());
return DebuggerUtils.translateStringValue(value.toString());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -23,7 +23,7 @@ public class EvaluateRuntimeException extends RuntimeException {
super(e);
}
public EvaluateException getCause() {
public synchronized EvaluateException getCause() {
return (EvaluateException)super.getCause();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -25,7 +25,7 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
public interface Evaluator {
/**
* @throws com.intellij.debugger.engine.evaluation.EvaluateException
* @throws EvaluateException
*/
Object evaluate(EvaluationContextImpl context) throws EvaluateException;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -23,10 +23,10 @@ package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.DebuggerUtils;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.openapi.diagnostic.Logger;
import com.sun.jdi.*;
@@ -60,7 +60,7 @@ class NewArrayInstanceEvaluator implements Evaluator {
Object[] initialValues = null;
if (myDimensionEvaluator != null) {
Object o = myDimensionEvaluator.evaluate(context);
if (!(o instanceof Value && DebuggerUtilsEx.isNumeric((Value)o))) {
if (!(o instanceof Value && DebuggerUtils.isNumeric((Value)o))) {
throw EvaluateExceptionUtil.createEvaluateException(
DebuggerBundle.message("evaluation.error.array.dimention.numeric.value.expected")
);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -21,6 +21,7 @@
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.engine.DebuggerUtils;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
@@ -53,24 +54,24 @@ class UnaryExpressionEvaluator implements Evaluator {
Value operand = (Value)myOperandEvaluator.evaluate(context);
VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
if (myOperationType == JavaTokenType.PLUS) {
if (DebuggerUtilsEx.isNumeric(operand)) {
if (DebuggerUtils.isNumeric(operand)) {
return operand;
}
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.numeric.expected"));
}
else if (myOperationType == JavaTokenType.MINUS) {
if (DebuggerUtilsEx.isInteger(operand)) {
if (DebuggerUtils.isInteger(operand)) {
long v = ((PrimitiveValue)operand).longValue();
return DebuggerUtilsEx.createValue(vm, myExpectedType, -v);
}
if (DebuggerUtilsEx.isNumeric(operand)) {
if (DebuggerUtils.isNumeric(operand)) {
double v = ((PrimitiveValue)operand).doubleValue();
return DebuggerUtilsEx.createValue(vm, myExpectedType, -v);
}
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.numeric.expected"));
}
else if (myOperationType == JavaTokenType.TILDE) {
if (DebuggerUtilsEx.isInteger(operand)) {
if (DebuggerUtils.isInteger(operand)) {
long v = ((PrimitiveValue)operand).longValue();
return DebuggerUtilsEx.createValue(vm, myExpectedType, ~v);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -20,7 +20,7 @@ package com.intellij.debugger.impl;
*/
public class EventQueueClosedException extends Exception {
@Override
public Throwable fillInStackTrace() {
public synchronized Throwable fillInStackTrace() {
return this;
}
}
@@ -564,7 +564,7 @@ class Bytecodes {
b[INVOKESTATIC_QUICK] = FIELDORMETH_INSN; // = 217;
b[INVOKEINTERFACE_QUICK] = ITFMETH_INSN; // = 218;
b[INVOKEVIRTUALOBJECT_QUICK] = FIELDORMETH_INSN; // = 219;
b[220] = Bytecodes.NOARG_INSN; // the ID is not used for any opcode
b[220] = NOARG_INSN; // the ID is not used for any opcode
b[NEW_QUICK] = TYPE_INSN; // = 221;
b[ANEWARRAY_QUICK] = TYPE_INSN; // = 222;
b[MULTIANEWARRAY_QUICK] = MANA_INSN; // = 223;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -16,7 +16,6 @@
package com.intellij.debugger.ui;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.hint.HintManagerImpl;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.DebuggerManagerEx;
@@ -87,8 +86,8 @@ public abstract class EditorEvaluationCommand<T> extends DebuggerContextCommandI
if (myEditor.isDisposed() || !myEditor.getComponent().isVisible()) return;
HintManager.getInstance().showErrorHint(myEditor, e.getMessage(), myElement.getTextRange().getStartOffset(),
myElement.getTextRange().getEndOffset(), HintManagerImpl.UNDER,
HintManagerImpl.HIDE_BY_ESCAPE | HintManagerImpl.HIDE_BY_TEXT_CHANGE,
myElement.getTextRange().getEndOffset(), HintManager.UNDER,
HintManager.HIDE_BY_ESCAPE | HintManager.HIDE_BY_TEXT_CHANGE,
1500);
}
@@ -73,7 +73,7 @@ public class RunHotswapDialog extends OptionsDialog {
else {
setTitle(DebuggerBundle.message("hotswap.dialog.title"));
}
setButtonsAlignment(SwingUtilities.CENTER);
setButtonsAlignment(SwingConstants.CENTER);
this.init();
}
@@ -382,11 +382,11 @@ public class FieldBreakpoint extends BreakpointWithHighlighter<JavaFieldBreakpoi
}
try {
getProperties().WATCH_MODIFICATION = Boolean.valueOf(JDOMExternalizerUtil.readField(breakpointNode, "WATCH_MODIFICATION"));
} catch (Exception e) {
} catch (Exception ignored) {
}
try {
getProperties().WATCH_ACCESS = Boolean.valueOf(JDOMExternalizerUtil.readField(breakpointNode, "WATCH_ACCESS"));
} catch (Exception e) {
} catch (Exception ignored) {
}
}
//
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -167,7 +167,7 @@ public class FilteredRequestorImpl implements JDOMExternalizable, FilteredReques
try {
iFilters.add(InstanceFilter.create(instanceFilter));
}
catch (Exception e) {
catch (Exception ignored) {
}
}
myInstanceFilters = iFilters.isEmpty() ? InstanceFilter.EMPTY_ARRAY : iFilters.toArray(new InstanceFilter[iFilters.size()]);
@@ -366,11 +366,11 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
super.readExternal(breakpointNode);
try {
getProperties().WATCH_ENTRY = Boolean.valueOf(JDOMExternalizerUtil.readField(breakpointNode, "WATCH_ENTRY"));
} catch (Exception e) {
} catch (Exception ignored) {
}
try {
getProperties().WATCH_EXIT = Boolean.valueOf(JDOMExternalizerUtil.readField(breakpointNode, "WATCH_EXIT"));
} catch (Exception e) {
} catch (Exception ignored) {
}
}
@@ -20,6 +20,7 @@ import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
import com.intellij.debugger.engine.DebuggerUtils;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.engine.requests.RequestManagerImpl;
@@ -44,7 +45,6 @@ import com.sun.jdi.ReferenceType;
import com.sun.jdi.event.LocatableEvent;
import com.sun.jdi.event.MethodEntryEvent;
import com.sun.jdi.event.MethodExitEvent;
import com.sun.jdi.request.EventRequest;
import com.sun.jdi.request.MethodEntryRequest;
import com.sun.jdi.request.MethodExitRequest;
import org.jdom.Element;
@@ -53,8 +53,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.java.debugger.breakpoints.properties.JavaMethodBreakpointProperties;
import javax.swing.*;
import java.util.Iterator;
import java.util.Set;
public class WildcardMethodBreakpoint extends Breakpoint<JavaMethodBreakpointProperties> {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.breakpoints.ExceptionBreakpoint");
@@ -90,7 +88,7 @@ public class WildcardMethodBreakpoint extends Breakpoint<JavaMethodBreakpointPro
public PsiClass getPsiClass() {
return PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Computable<PsiClass>() {
public PsiClass compute() {
return getClassName() != null ? DebuggerUtilsEx.findClass(getClassName(), myProject, GlobalSearchScope.allScope(myProject)) : null;
return getClassName() != null ? DebuggerUtils.findClass(getClassName(), myProject, GlobalSearchScope.allScope(myProject)) : null;
}
});
}
@@ -236,11 +234,11 @@ public class WildcardMethodBreakpoint extends Breakpoint<JavaMethodBreakpointPro
try {
getProperties().WATCH_ENTRY = Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "WATCH_ENTRY"));
} catch (Exception e) {
} catch (Exception ignored) {
}
try {
getProperties().WATCH_EXIT = Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "WATCH_EXIT"));
} catch (Exception e) {
} catch (Exception ignored) {
}
if(className == null || methodName == null) {
@@ -30,6 +30,7 @@ import com.intellij.util.PlatformIcons;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -41,7 +42,7 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer {
private static final SimpleTextAttributes SPECIAL_NODE_ATTRIBUTES = new SimpleTextAttributes(Font.PLAIN, new JBColor(Color.lightGray, Gray._130));
private static final SimpleTextAttributes OBJECT_ID_HIGHLIGHT_ATTRIBUTES = new SimpleTextAttributes(Font.PLAIN, new JBColor(Color.lightGray, Gray._130));
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
final DebuggerTreeNodeImpl node = (DebuggerTreeNodeImpl) value;
if (node != null) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -18,5 +18,5 @@ package com.intellij.debugger.ui.tree;
import com.intellij.debugger.engine.jdi.ThreadReferenceProxy;
public interface ThreadDescriptor extends NodeDescriptor{
public ThreadReferenceProxy getThreadReference();
ThreadReferenceProxy getThreadReference();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -15,9 +15,8 @@
*/
package com.intellij.debugger.ui.tree;
import com.intellij.debugger.engine.evaluation.TextWithImports;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
public interface UserExpressionDescriptor extends ValueDescriptor {
public void setContext(EvaluationContextImpl evaluationContext);
void setContext(EvaluationContextImpl evaluationContext);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -37,7 +37,7 @@ public class ShowAllAs extends AnAction {
myRenderer = renderer;
}
private boolean isPrimitiveArray(DebuggerTreeNode selectedNode) {
private static boolean isPrimitiveArray(DebuggerTreeNode selectedNode) {
try {
if(selectedNode.getDescriptor() instanceof ValueDescriptor) {
ValueDescriptor valueDescriptor = ((ValueDescriptor)selectedNode.getDescriptor());
@@ -55,7 +55,7 @@ public class ShowAllAs extends AnAction {
}
}
}
catch (ClassNotLoadedException e) {
catch (ClassNotLoadedException ignored) {
}
return false;
}
@@ -39,7 +39,7 @@ import java.util.List;
* Date: Dec 19, 2003
* Time: 1:25:15 PM
*/
public final class EnumerationChildrenRenderer extends com.intellij.debugger.ui.tree.render.ReferenceRenderer implements ChildrenRenderer{
public final class EnumerationChildrenRenderer extends ReferenceRenderer implements ChildrenRenderer{
public static final @NonNls String UNIQUE_ID = "EnumerationChildrenRenderer";
private List<Pair<String, TextWithImports>> myChildren;
@@ -43,6 +43,7 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public class NamedChildrenConfigurable implements UnnamedConfigurable, Disposable {
private Table myTable;
@@ -139,7 +140,7 @@ public class NamedChildrenConfigurable implements UnnamedConfigurable, Disposabl
DefaultTableModel model = getModel();
final int size = model.getRowCount();
java.util.List<Pair<String, TextWithImports>> result = new ArrayList<Pair<String, TextWithImports>>();
List<Pair<String, TextWithImports>> result = new ArrayList<Pair<String, TextWithImports>>();
for (int idx = 0; idx < size; idx++) {
result.add(Pair.create((String)model.getValueAt(idx, 0), (TextWithImports)model.getValueAt(idx, 1)));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -16,17 +16,18 @@
package com.intellij.debugger;
public class NoDataException extends Exception {
@SuppressWarnings({"deprecation", "ThrowableInstanceNeverThrown"})
public static final NoDataException INSTANCE = new NoDataException();
/**
* @deprecated Use shared {@link com.intellij.debugger.NoDataException#INSTANCE} instead
* @deprecated Use shared {@link NoDataException#INSTANCE} instead
*/
@Deprecated
public NoDataException() {
}
@Override
public Throwable fillInStackTrace() {
public synchronized Throwable fillInStackTrace() {
return this;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -22,6 +22,7 @@ import com.sun.jdi.*;
/**
* @author lex
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public class EvaluateExceptionUtil {
public static final EvaluateException INCONSISTEND_DEBUG_INFO = createEvaluateException(DebuggerBundle.message("evaluation.error.inconsistent.debug.info"));
public static final EvaluateException BOOLEAN_EXPECTED = createEvaluateException(DebuggerBundle.message("evaluation.error.boolean.value.expected.in.condition"));