private void buildAssignment(AssignmentExpressionTree tree) { currentBlock.elements.add(tree); build(tree.expression()); // The variable is not evaluated for simple assignment as it's only used to know where to store the value: JLS8-15.26 if (!ExpressionUtils.isSimpleAssignment(tree)) { build(tree.variable()); } }
private void buildAssignment(AssignmentExpressionTree tree) { currentBlock.elements.add(tree); build(tree.expression()); // The variable is not evaluated for simple assignment as it's only used to know where to store the value: JLS8-15.26 if (!ExpressionUtils.isSimpleAssignment(tree)) { build(tree.variable()); } }
@Override public void visitAssignmentExpression(AssignmentExpressionTree syntaxNode) { final ExpressionTree variable = syntaxNode.variable(); if (isNonLocalStorage(variable)) { SymbolicValue value; if (ExpressionUtils.isSimpleAssignment(syntaxNode)) { value = programState.peekValue(); } else { value = programState.peekValues(2).get(0); } closeResource(value); } }
@Override public void visitAssignmentExpression(AssignmentExpressionTree tree) { SymbolicValue var; SymbolicValue expr; Symbol symbol; if (ExpressionUtils.isSimpleAssignment(tree)) { symbol = ExpressionUtils.extractIdentifier(tree).symbol(); var = programState.getValue(symbol); expr = programState.peekValue(); } else { ProgramState.Pop unstackValue = programState.unstackValue(2); var = unstackValue.values.get(1); expr = unstackValue.values.get(0); symbol = unstackValue.valuesAndSymbols.get(0).symbol(); } checkExpression(tree, var, expr, symbol); }
@Override public void visitAssignmentExpression(AssignmentExpressionTree syntaxNode) { final ExpressionTree variable = syntaxNode.variable(); if (isNonLocalStorage(variable)) { SymbolicValue value; if (ExpressionUtils.isSimpleAssignment(syntaxNode)) { value = programState.peekValue(); } else { value = programState.peekValues(2).get(0); } closeResource(value); } }
@Override public void visitAssignmentExpression(AssignmentExpressionTree tree) { SymbolicValue var; SymbolicValue expr; Symbol symbol; if (ExpressionUtils.isSimpleAssignment(tree)) { symbol = ExpressionUtils.extractIdentifier(tree).symbol(); var = programState.getValue(symbol); expr = programState.peekValue(); } else { ProgramState.Pop unstackValue = programState.unstackValue(2); var = unstackValue.values.get(1); expr = unstackValue.values.get(0); symbol = unstackValue.valuesAndSymbols.get(0).symbol(); } checkExpression(tree, var, expr, symbol); }
@Override public void visitAssignmentExpression(AssignmentExpressionTree tree) { if (ExpressionUtils.isSimpleAssignment(tree)) { IdentifierTree variable = ExpressionUtils.extractIdentifier(tree); Symbol symbol = variable.symbol(); String nonNullAnnotation = nonNullAnnotation(symbol); if (nonNullAnnotation == null) { return; } SymbolicValue assignedValue = programState.peekValue(); ObjectConstraint constraint = programState.getConstraint(assignedValue, ObjectConstraint.class); if (constraint != null && constraint.isNull()) { reportIssue(tree, "\"{0}\" is marked \"{1}\" but is set to null.", symbol.name(), nonNullAnnotation); } } }
private void executeAssignment(AssignmentExpressionTree tree) { ProgramState.Pop unstack; SymbolicValue value; if (tree.is(Tree.Kind.ASSIGNMENT)) { unstack = ExpressionUtils.isSimpleAssignment(tree) ? programState.unstackValue(1) : programState.unstackValue(2); value = unstack.values.get(0); } else { unstack = programState.unstackValue(2); value = constraintManager.createSymbolicValue(tree); } programState = unstack.state; Symbol symbol = null; if (tree.variable().is(Tree.Kind.IDENTIFIER) || ExpressionUtils.isSelectOnThisOrSuper(tree)) { symbol = ExpressionUtils.extractIdentifier(tree).symbol(); programState = programState.put(symbol, value); } programState = programState.stackValue(value, symbol); }
@Override public void visitAssignmentExpression(AssignmentExpressionTree tree) { if (ExpressionUtils.isSimpleAssignment(tree)) { IdentifierTree variable = ExpressionUtils.extractIdentifier(tree); Symbol symbol = variable.symbol(); String nonNullAnnotation = nonNullAnnotation(symbol); if (nonNullAnnotation == null) { return; } SymbolicValue assignedValue = programState.peekValue(); ObjectConstraint constraint = programState.getConstraint(assignedValue, ObjectConstraint.class); if (constraint != null && constraint.isNull()) { reportIssue(tree, "\"{0}\" is marked \"{1}\" but is set to null.", symbol.name(), nonNullAnnotation); } } }
private void executeAssignment(AssignmentExpressionTree tree) { ProgramState.Pop unstack; SymbolicValue value; if (tree.is(Tree.Kind.ASSIGNMENT)) { unstack = ExpressionUtils.isSimpleAssignment(tree) ? programState.unstackValue(1) : programState.unstackValue(2); value = unstack.values.get(0); } else { unstack = programState.unstackValue(2); value = constraintManager.createSymbolicValue(tree); } programState = unstack.state; Symbol symbol = null; if (tree.variable().is(Tree.Kind.IDENTIFIER) || ExpressionUtils.isSelectOnThisOrSuper(tree)) { symbol = ExpressionUtils.extractIdentifier(tree).symbol(); programState = programState.put(symbol, value); } programState = programState.stackValue(value, symbol); }