@Override
 public void visitAssignmentExpression(AssignmentExpressionTree tree) {
   if (tree.variable().is(Tree.Kind.IDENTIFIER)) {
     checkIdentifier((IdentifierTree) tree.variable());
   }
   super.visitAssignmentExpression(tree);
 }
 @Override
 public void visitAssignmentExpression(AssignmentExpressionTree tree) {
   // skip writing to a variable.
   if (!tree.variable().is(Tree.Kind.IDENTIFIER)) {
     scan(tree.variable());
   }
   scan(tree.expression());
 }
 @Override
 public void visitAssignmentExpression(AssignmentExpressionTree tree) {
   super.visitAssignmentExpression(tree);
   if (isFileCreateTempFile(tree.expression())) {
     ExpressionTree variable = tree.variable();
     if (variable.is(Tree.Kind.IDENTIFIER) && !symbolStack.isEmpty()) {
       symbolStack.peek().put(((IdentifierTree) variable).symbol(), State.CREATE_TMP_FILE);
     }
   }
 }
 @Override
 public void visitAssignmentExpression(AssignmentExpressionTree tree) {
   Type wrapper = ((JavaType) tree.expression().symbolType()).primitiveWrapperType();
   if (tree.is(Kind.PLUS_ASSIGNMENT)
       && tree.variable().symbolType().is("java.lang.String")
       && wrapper != null) {
     createIssue(tree, wrapper.name());
   }
   super.visitAssignmentExpression(tree);
 }
Exemplo n.º 5
0
 @Override
 public void visitAssignmentExpression(AssignmentExpressionTree tree) {
   Tree assignedVariable = getAssignedVariable(tree.variable());
   if (assignedVariable != null) {
     type = getTypeFromExpression(assignedVariable);
   }
 }
 @Override
 public void visitAssignmentExpression(AssignmentExpressionTree syntaxNode) {
   final ExpressionTree variable = syntaxNode.variable();
   if (variable.is(Tree.Kind.ARRAY_ACCESS_EXPRESSION)) {
     List<SymbolicValue> stackedValues = programState.peekValues(2);
     SymbolicValue value = stackedValues.get(1);
     programState = closeResource(programState, value);
   }
 }
 @Override
 public void visitNode(Tree tree) {
   if (hasSemantic()) {
     if (tree.is(Tree.Kind.METHOD_INVOCATION)) {
       visitMethodInvocationTree((MethodInvocationTree) tree);
     } else if (tree.is(Tree.Kind.VARIABLE)) {
       VariableTree variableTree = (VariableTree) tree;
       ExpressionTree initializer = variableTree.initializer();
       if (initializer != null) {
         checkExpression(initializer, variableTree.type().symbolType());
       }
     } else if (tree.is(Tree.Kind.ASSIGNMENT)) {
       AssignmentExpressionTree assignmentTree = (AssignmentExpressionTree) tree;
       checkExpression(assignmentTree.expression(), assignmentTree.symbolType());
     } else {
       NewClassTree newClassTree = (NewClassTree) tree;
       Symbol.TypeSymbol classSymbol = wrapperClassSymbol(newClassTree);
       if (classSymbol != null) {
         checkForUnboxing(newClassTree.arguments().get(0));
       }
     }
   }
 }
Exemplo n.º 8
0
 private void buildAssignment(AssignmentExpressionTree tree) {
   currentBlock.elements.add(tree);
   build(tree.variable());
   build(tree.expression());
 }