com.sun.tools.javac.tree.JCTree.JCAssert Java Examples

The following examples show how to use com.sun.tools.javac.tree.JCTree.JCAssert. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void visitAssert(JCAssert tree) {
    final Bits initsExit = new Bits(inits);
    final Bits uninitsExit = new Bits(uninits);
    scanCond(tree.cond);
    uninitsExit.andSet(uninitsWhenTrue);
    if (tree.detail != null) {
        inits.assign(initsWhenFalse);
        uninits.assign(uninitsWhenFalse);
        scanExpr(tree.detail);
    }
    inits.assign(initsExit);
    uninits.assign(uninitsExit);
}
 
Example #2
Source File: CompilationUnitBuilder.java    From j2cl with Apache License 2.0 5 votes vote down vote up
private AssertStatement convertAssert(JCAssert statement) {
  return AssertStatement.newBuilder()
      .setSourcePosition(getSourcePosition(statement))
      .setExpression(convertExpression(statement.getCondition()))
      .setMessage(convertExpressionOrNull(statement.getDetail()))
      .build();
}
 
Example #3
Source File: PrettyCommentsPrinter.java    From EasyMPermission with MIT License 5 votes vote down vote up
public void visitAssert(JCAssert tree) {
	try {
		print("assert ");
		printExpr(tree.cond);
		if (tree.detail != null) {
			print(" : ");
			printExpr(tree.detail);
		}
		print(";");
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
Example #4
Source File: CRTable.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void visitAssert(JCAssert tree) {
    SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
    sr.mergeWith(csp(tree.cond));
    sr.mergeWith(csp(tree.detail));
    result = sr;
}
 
Example #5
Source File: TransTypes.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void visitAssert(JCAssert tree) {
    tree.cond = translate(tree.cond, syms.booleanType);
    if (tree.detail != null)
        tree.detail = translate(tree.detail, erasure(tree.detail.type));
    result = tree;
}
 
Example #6
Source File: CompilationUnitBuilder.java    From j2cl with Apache License 2.0 4 votes vote down vote up
private Statement convertStatement(JCStatement jcStatement) {
  switch (jcStatement.getKind()) {
    case ASSERT:
      return convertAssert((JCAssert) jcStatement);
    case BLOCK:
      return convertBlock((JCBlock) jcStatement);
    case BREAK:
      return convertBreak((JCBreak) jcStatement);
    case CLASS:
      convertClassDeclaration((JCClassDecl) jcStatement);
      return null;
    case CONTINUE:
      return convertContinue((JCContinue) jcStatement);
    case DO_WHILE_LOOP:
      return convertDoWhileLoop((JCDoWhileLoop) jcStatement);
    case EMPTY_STATEMENT:
      return new EmptyStatement(getSourcePosition(jcStatement));
    case ENHANCED_FOR_LOOP:
      return convertEnhancedForLoop((JCEnhancedForLoop) jcStatement);
    case EXPRESSION_STATEMENT:
      return convertExpressionStatement((JCExpressionStatement) jcStatement);
    case FOR_LOOP:
      return convertForLoop((JCForLoop) jcStatement);
    case IF:
      return convertIf((JCIf) jcStatement);
    case LABELED_STATEMENT:
      return convertLabeledStatement((JCLabeledStatement) jcStatement);
    case RETURN:
      return convertReturn((JCReturn) jcStatement);
    case SWITCH:
      return convertSwitch((JCSwitch) jcStatement);
    case THROW:
      return convertThrow((JCThrow) jcStatement);
    case TRY:
      return convertTry((JCTry) jcStatement);
    case VARIABLE:
      return convertVariableDeclaration((JCVariableDecl) jcStatement);
    case WHILE_LOOP:
      return convertWhileLoop((JCWhileLoop) jcStatement);
    case SYNCHRONIZED:
      return convertSynchronized((JCSynchronized) jcStatement);
    default:
      throw new AssertionError("Unknown statement node type: " + jcStatement.getKind());
  }
}
 
Example #7
Source File: JavacTreeMaker.java    From EasyMPermission with MIT License 4 votes vote down vote up
public JCAssert Assert(JCExpression cond, JCExpression detail) {
	return invoke(Assert, cond, detail);
}