ComponentWithBrowseButton - optional remove listener on hide
[fedora-idea.git] / java / java-impl / src / com / intellij / codeInspection / dataFlow / AnnotationsAwareDataFlowRunner.java
blob41b3fb6d9dea5bfbacf590d5705485037b85f8a9
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.
16 package com.intellij.codeInspection.dataFlow;
18 import com.intellij.psi.PsiElement;
19 import com.intellij.psi.PsiMethod;
20 import com.intellij.psi.PsiParameter;
21 import com.intellij.codeInsight.AnnotationUtil;
22 import com.intellij.codeInspection.dataFlow.value.DfaVariableValue;
23 import org.jetbrains.annotations.NotNull;
25 import java.util.Collection;
27 /**
28 * @author peter
30 public class AnnotationsAwareDataFlowRunner extends DataFlowRunner {
32 @Override
33 protected Collection<DfaMemoryState> createInitialStates(@NotNull PsiElement psiBlock, InstructionVisitor visitor) {
34 final Collection<DfaMemoryState> initialStates = super.createInitialStates(psiBlock, visitor);
35 if (initialStates == null) {
36 return null;
39 final PsiElement parent = psiBlock.getParent();
40 if (parent instanceof PsiMethod) {
41 PsiMethod method = (PsiMethod)parent;
43 //todo move out from generic runner
44 for (PsiParameter parameter : method.getParameterList().getParameters()) {
45 if (AnnotationUtil.isNotNull(parameter)) {
46 final DfaVariableValue value = getFactory().getVarFactory().create(parameter, false);
47 for (final DfaMemoryState initialState : initialStates) {
48 initialState.applyNotNull(value);
53 return initialStates;