update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / codeInspection / dataFlow / ValuableDataFlowRunner.java
blob544d9901acec86322ebb4571d5f6b119892dd53d
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.intellij.codeInspection.dataFlow;
19 import com.intellij.codeInspection.dataFlow.value.DfaValue;
20 import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
21 import com.intellij.psi.PsiExpression;
22 import com.intellij.psi.PsiVariable;
24 /**
25 * @author Gregory.Shrago
27 public class ValuableDataFlowRunner extends AnnotationsAwareDataFlowRunner {
29 protected DfaMemoryState createMemoryState() {
30 return new MyDfaMemoryState(getFactory());
33 protected ControlFlowAnalyzer createControlFlowAnalyzer() {
34 final ControlFlowAnalyzer analyzer = super.createControlFlowAnalyzer();
35 analyzer.setHonorRuntimeExceptions(false);
36 return analyzer;
39 static class MyDfaMemoryState extends DfaMemoryStateImpl {
40 private MyDfaMemoryState(final DfaValueFactory factory) {
41 super(factory);
44 protected DfaMemoryStateImpl createNew() {
45 return new MyDfaMemoryState(getFactory());
48 protected DfaVariableState createVariableState(final PsiVariable psiVariable) {
49 return new ValuableDfaVariableState(psiVariable);
54 static class ValuableDfaVariableState extends DfaVariableState {
55 DfaValue myValue;
56 PsiExpression myExpression;
58 private ValuableDfaVariableState(final PsiVariable psiVariable) {
59 super(psiVariable);
62 protected ValuableDfaVariableState(final ValuableDfaVariableState state) {
63 super(state);
64 myExpression = state.myExpression;
67 public void setValue(final DfaValue value) {
68 myValue = value;
71 public DfaValue getValue() {
72 return myValue;
75 protected Object clone() throws CloneNotSupportedException {
76 return new ValuableDfaVariableState(this);