/** * checking if returnStatement is boolean, not null and has only one return * * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ReturnStatement) */ @Override public boolean visit(ReturnStatement node) { // one more return statement encountered. returnCount++; // examine what is being returned. ASTNode expression = node.getExpression(); // if there is a return statement, it must return a boolean literal. if (expression == null || !(expression instanceof BooleanLiteral)) { this.encounteredInvalidReturnStatement = true; } return super.visit(node); }
private boolean hasNonStaticFieldsWithInitializers(ASTNode node) { if (node instanceof TypeDeclaration) { TypeDeclaration td = (TypeDeclaration)node; for (FieldDeclaration fd : td.getFields()) { if (!hasStaticModifier(fd)) { for (Object o : fd.fragments()) { VariableDeclarationFragment vdf = (VariableDeclarationFragment)o; if (vdf.getInitializer() != null && (vdf.getInitializer() instanceof BooleanLiteral || vdf.getInitializer() instanceof NumberLiteral || vdf.getInitializer() instanceof StringLiteral)) { return true; } } } } return false; } // TODO is this correct for enums? return false; }
public RefinementBoolean(Expression e) { if (knownConstants(e)) return; if (! (e instanceof BooleanLiteral)) { this.exists = false; this.value = false; return; } this.exists = true; this.value = ((BooleanLiteral) e).booleanValue(); }
private VariableReference retrieveVariableReference(BooleanLiteral boolLiteral) { boolean bool = boolLiteral.booleanValue(); PrimitiveStatement<Boolean> charAssignment = new BooleanPrimitiveStatement( testCase.getReference(), bool); testCase.addStatement(charAssignment); return charAssignment.getReturnValue(); }
@Override public boolean visit(BooleanLiteral node) { if (node.booleanValue() == true) { this.fBuffer.append("true");//$NON-NLS-1$ } else { this.fBuffer.append("false");//$NON-NLS-1$ } return false; }
public boolean visit(BooleanLiteral node) { if (node.booleanValue() == true) { this.buffer.append("true");//$NON-NLS-1$ } else { this.buffer.append("false");//$NON-NLS-1$ } return false; }
@Override public boolean visit(BooleanLiteral node) { if (this.badBooleanLiteral != null) { return false; } if (node.resolveBoxing()) { // did boxing happen? If so, that's our cue badBooleanLiteral = node; return false; } return true; }
public BooleanLiteral booleanLiteral(boolean value) { return ast.get().newBooleanLiteral(value); }
@Override public void endVisit(BooleanLiteral node) { // Leaf node. }
@Override public void endVisit(BooleanLiteral node) { ITypeBinding typeBinding = node.resolveTypeBinding(); ImmutableTypeVariable2 cv = fTCModel.makeImmutableTypeVariable(typeBinding, node); setConstraintVariable(node, cv); }
@Override public boolean visit(BooleanLiteral node) { return visitLiteral(node); }
/** {@inheritDoc} */ @Override public void endVisit(BooleanLiteral node) { logger.warn("Method endVisitBooleanLiteral for " + node + " for " + node + " not implemented!"); super.endVisit(node); }
/** {@inheritDoc} */ @Override public boolean visit(BooleanLiteral node) { logger.warn("Method visitBooleanLiteral for " + node + " for " + node + " not implemented!"); return super.visit(node); }
@Override public boolean visit(final BooleanLiteral node) { return false; }
@Override public boolean visit(final BooleanLiteral node) { // not instrumentable, contains no instrumentable nodes return false; }
@Override public void endVisit(BooleanLiteral node) { ITypeBinding typeBinding= node.resolveTypeBinding(); ImmutableTypeVariable2 cv= fTCModel.makeImmutableTypeVariable(typeBinding, node); setConstraintVariable(node, cv); }
@Override public boolean visit(BooleanLiteral node) { if (node.subtreeMatch(fMatcher, fNodeToMatch)) return matches(node); return super.visit(node); }
@Override public boolean visit(BooleanLiteral node) { add(fCreator.create(node)); return true; }
@Override public void endVisit(BooleanLiteral node) { endVisitNode(node); }
@Override public boolean visit(BooleanLiteral node) { return visitNode(node); }
@Override public boolean visit(BooleanLiteral node) { return visit((Expression)node); }
@Override public void endVisit(BooleanLiteral node) { endVisit((Expression)node); }
@Override public boolean visit(final BooleanLiteral node) { return this.internalVisit(node); }
@Override public boolean visit(BooleanLiteral node) { //System.out.println("Found: " + node.getClass()); print(node.booleanValue() ? "true" : "false"); return false; }
@Override public boolean visit(VariableDeclarationFragment node) { //System.out.println("Found: " + node.getClass()); print(" "); Writer w = new StringWriter(); pushWriter(w); if (inMethod) { doRewrite = false; } node.getName().accept(this); if (inMethod) { doRewrite = true; } popWriter(); locals.add(w.toString()); print(w.toString()); Expression e = node.getInitializer(); if (e != null) { if (node.getParent() instanceof FieldDeclaration) { FieldDeclaration parent = (FieldDeclaration)node.getParent(); if (e instanceof NumberLiteral || e instanceof BooleanLiteral || e instanceof StringLiteral) { ; } else { String initializer = w.toString() + " = "; w = new StringWriter(); pushWriter(w); e.accept(this); popWriter(); initializer += w.toString() + ";"; if (hasStaticModifier(parent)) { staticFieldInitializers.add(initializer); } else { fieldInitializers.add(initializer); } return false; } } print(" = "); // TODO Things that can't be computed at compile time need // moving into a static ctor e.accept(this); } return false; }
/** * @param node the AST node * @return array of type constraints, may be empty * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BooleanLiteral) */ public ITypeConstraint[] create(BooleanLiteral node) { return EMPTY_ARRAY; }