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
;
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);
39 static class MyDfaMemoryState
extends DfaMemoryStateImpl
{
40 private MyDfaMemoryState(final DfaValueFactory 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
{
56 PsiExpression myExpression
;
58 private ValuableDfaVariableState(final PsiVariable psiVariable
) {
62 protected ValuableDfaVariableState(final ValuableDfaVariableState state
) {
64 myExpression
= state
.myExpression
;
67 public void setValue(final DfaValue value
) {
71 public DfaValue
getValue() {
75 protected Object
clone() throws CloneNotSupportedException
{
76 return new ValuableDfaVariableState(this);