move constant

This commit is contained in:
Ilya Klyuchnikov
2014-08-19 09:04:36 +04:00
parent c3b39ad707
commit cfd3a7dfdb
4 changed files with 8 additions and 4 deletions
@@ -224,8 +224,6 @@ abstract class Analysis<Res> {
}
};
protected static final BasicValue THROWABLE_VALUE = new BasicValue(Type.getType("java/lang/Throwable"));
public static final int STEPS_LIMIT = 30000;
public static final int EQUATION_SIZE_LIMIT = 30;
public static final int MERGE_LIMIT = 100000;
@@ -15,6 +15,7 @@
*/
package com.intellij.codeInspection.bytecodeAnalysis;
import com.intellij.codeInspection.bytecodeAnalysis.asm.ASMUtils;
import com.intellij.codeInspection.bytecodeAnalysis.asm.ControlFlowGraph.Edge;
import com.intellij.codeInspection.bytecodeAnalysis.asm.RichControlFlow;
import org.jetbrains.annotations.NotNull;
@@ -214,7 +215,7 @@ class InOutAnalysis extends Analysis<Result<Key, Value>> {
if (controlFlow.errors[nextInsnIndex] && controlFlow.errorTransitions.contains(new Edge(insnIndex, nextInsnIndex))) {
nextFrame1 = new Frame<BasicValue>(frame);
nextFrame1.clearStack();
nextFrame1.push(THROWABLE_VALUE);
nextFrame1.push(ASMUtils.THROWABLE_VALUE);
}
pendingPush(new ProceedState<Result<Key, Value>>(
new State(subIndices[i], new Conf(nextInsnIndex, nextFrame1), nextHistory, taken, false)));
@@ -15,6 +15,7 @@
*/
package com.intellij.codeInspection.bytecodeAnalysis;
import com.intellij.codeInspection.bytecodeAnalysis.asm.ASMUtils;
import com.intellij.codeInspection.bytecodeAnalysis.asm.ControlFlowGraph.Edge;
import com.intellij.codeInspection.bytecodeAnalysis.asm.RichControlFlow;
import org.jetbrains.annotations.NotNull;
@@ -283,7 +284,7 @@ class NonNullInAnalysis extends Analysis<PResult> {
if (controlFlow.errors[nextInsnIndex] && controlFlow.errorTransitions.contains(new Edge(insnIndex, nextInsnIndex))) {
nextFrame1 = new Frame<BasicValue>(frame);
nextFrame1.clearStack();
nextFrame1.push(THROWABLE_VALUE);
nextFrame1.push(ASMUtils.THROWABLE_VALUE);
}
pendingPush(new ProceedState<PResult>(new State(subIndices[i], new Conf(nextInsnIndex, nextFrame1), nextHistory, taken, hasCompanions || notEmptySubResult)));
}
@@ -16,11 +16,15 @@
package com.intellij.codeInspection.bytecodeAnalysis.asm;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue;
/**
* @author lambdamix
*/
public class ASMUtils {
public static final Type THROWABLE_TYPE = Type.getType("java/lang/Throwable");
public static final BasicValue THROWABLE_VALUE = new BasicValue(THROWABLE_TYPE);
public static boolean isReferenceType(Type tp) {
int sort = tp.getSort();
return sort == Type.OBJECT || sort == Type.ARRAY;