コード例 #1
0
  private void analyzeCodeBlock(
      @Nullable final PsiElement scope, ProblemsHolder holder, final boolean onTheFly) {
    if (scope == null) return;

    PsiClass containingClass = PsiTreeUtil.getParentOfType(scope, PsiClass.class);
    if (containingClass != null && PsiUtil.isLocalOrAnonymousClass(containingClass)) return;

    final StandardDataFlowRunner dfaRunner =
        new StandardDataFlowRunner(scope) {
          @Override
          protected boolean shouldCheckTimeLimit() {
            if (!onTheFly) return false;
            return super.shouldCheckTimeLimit();
          }
        };
    analyzeDfaWithNestedClosures(
        scope, holder, dfaRunner, Arrays.asList(dfaRunner.createMemoryState()));
  }
コード例 #2
0
  private void analyzeCodeBlock(
      @Nullable final PsiElement scope, ProblemsHolder holder, final boolean onTheFly) {
    if (scope == null) return;

    PsiClass containingClass = PsiTreeUtil.getParentOfType(scope, PsiClass.class);
    if (containingClass != null
        && PsiUtil.isLocalOrAnonymousClass(containingClass)
        && !(containingClass instanceof PsiEnumConstantInitializer)) return;

    final StandardDataFlowRunner dfaRunner =
        new StandardDataFlowRunner(
            TREAT_UNKNOWN_MEMBERS_AS_NULLABLE, !isInsideConstructorOrInitializer(scope)) {
          @Override
          protected boolean shouldCheckTimeLimit() {
            if (!onTheFly) return false;
            return super.shouldCheckTimeLimit();
          }
        };
    analyzeDfaWithNestedClosures(
        scope, holder, dfaRunner, Arrays.asList(dfaRunner.createMemoryState()), onTheFly);
  }