org.eclipse.jdt.internal.compiler.lookup.BlockScope.checkUnclosedCloseables()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(13.6k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.eclipse.jdt.internal.compiler.lookup.BlockScope.checkUnclosedCloseables()方法的一些代码示例,展示了BlockScope.checkUnclosedCloseables()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockScope.checkUnclosedCloseables()方法的具体详情如下:
包路径:org.eclipse.jdt.internal.compiler.lookup.BlockScope
类名称:BlockScope
方法名:checkUnclosedCloseables

BlockScope.checkUnclosedCloseables介绍

[英]At the end of a block check the closing-status of all tracked closeables that are declared in this block. Also invoked when entering unreachable code.
[中]在块结束时,检查在此块中声明的所有跟踪可关闭项的关闭状态。在输入无法访问的代码时也会调用。

代码示例

代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  this.exception.analyseCode(currentScope, flowContext, flowInfo);
  this.exception.checkNPE(currentScope, flowContext, flowInfo);
  // need to check that exception thrown is actually caught somewhere
  flowContext.checkExceptionHandlers(this.exceptionType, this, flowInfo, currentScope);
  currentScope.checkUnclosedCloseables(flowInfo, flowContext, this, currentScope);
  flowContext.recordAbruptExit();
  return FlowInfo.DEAD_END;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj

public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel, boolean endOfBlock) {
  if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
    if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
      this.bits &= ~ASTNode.IsReachable;
    if (flowInfo == FlowInfo.DEAD_END) {
      if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
        scope.problemReporter().unreachableCode(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_UNREACHABLE;
    } else {
      if (previousComplaintLevel < COMPLAINED_FAKE_REACHABLE) {
        scope.problemReporter().fakeReachable(this);
        if (endOfBlock)
          scope.checkUnclosedCloseables(flowInfo, null, null, null);
      }
      return COMPLAINED_FAKE_REACHABLE;
    }
  }
  return previousComplaintLevel;
}

代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
  // empty block
  if (this.statements == null)	return flowInfo;
  int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0 ? Statement.COMPLAINED_FAKE_REACHABLE : Statement.NOT_COMPLAINED;
  for (int i = 0, max = this.statements.length; i < max; i++) {
    Statement stat = this.statements[i];
    if ((complaintLevel = stat.complainIfUnreachable(flowInfo, this.scope, complaintLevel, true)) < Statement.COMPLAINED_UNREACHABLE) {
      flowInfo = stat.analyseCode(this.scope, flowContext, flowInfo);
    }
  }
  if (this.explicitDeclarations > 0) {
    // if block has its own scope analyze tracking vars now:
    this.scope.checkUnclosedCloseables(flowInfo, flowContext, null, null);
    // cleanup assignment info for locals that are scoped to this block:
    LocalVariableBinding[] locals = this.scope.locals;
    if (locals != null) {
      int numLocals = this.scope.localIndex;
      for (int i = 0; i < numLocals; i++) {
        flowInfo.resetAssignmentInfo(locals[i]);
      }
    }
  }
  return flowInfo;
}
/**

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

this.scope.checkUnclosedCloseables(flowInfo, flowContext, null, null);

相关文章

微信公众号

最新文章

更多

BlockScope类方法