private static boolean isVolatileField(Symbol symbol) { return isField(symbol) && symbol.isVolatile(); }
private static boolean isVolatileField(Symbol symbol) { return isField(symbol) && symbol.isVolatile(); }
private static boolean isStaticNotFinalNotVolatile(Symbol symbol) { return symbol.isStatic() && !symbol.isVolatile() && !symbol.isFinal(); }
private boolean isStaticNotFinalNotVolatile(Symbol symbol) { return symbol.isStatic() && !symbol.isVolatile() && !symbol.isFinal(); }
private static boolean isStaticNotFinalNotVolatile(Symbol symbol) { return symbol.isStatic() && !symbol.isVolatile() && !symbol.isFinal(); }
private void ifSynchronizedIfPattern(IfFieldEqNull parentIf, IfStatementTree nestedIf) { if (thenStmtInitializeField(nestedIf.thenStatement(), parentIf.field) && !parentIf.field.isVolatile() && !methodIsSynchronized) { SyntaxToken synchronizedKeyword = synchronizedStmtStack.peek().synchronizedTree.synchronizedKeyword(); reportIssue(synchronizedKeyword, "Remove this dangerous instance of double-checked locking.", createFlow(parentIf.ifTree, nestedIf), null); } }
private void ifSynchronizedIfPattern(IfFieldEqNull parentIf, IfStatementTree nestedIf) { if (thenStmtInitializeField(nestedIf.thenStatement(), parentIf.field) && !parentIf.field.isVolatile() && !methodIsSynchronized) { SyntaxToken synchronizedKeyword = synchronizedStmtStack.peek().synchronizedTree.synchronizedKeyword(); reportIssue(synchronizedKeyword, "Remove this dangerous instance of double-checked locking.", createFlow(parentIf.ifTree, nestedIf), null); } }
@Override public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ExpressionTree expression; if (tree instanceof UnaryExpressionTree) { expression = ExpressionUtils.skipParentheses(((UnaryExpressionTree) tree).expression()); } else { expression = ((AssignmentExpressionTree) tree).variable(); } IdentifierTree identifier = getVariableIdentifier(expression); if (identifier == null || !identifier.symbol().isVolatile()) { return; } if (tree.is(Tree.Kind.LOGICAL_COMPLEMENT)) { checkBooleanToggling(tree, identifier.symbol()); } else { checkIncrementDecrement(tree, identifier); } }
@Override public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ExpressionTree expression; if (tree instanceof UnaryExpressionTree) { expression = ExpressionUtils.skipParentheses(((UnaryExpressionTree) tree).expression()); } else { expression = ((AssignmentExpressionTree) tree).variable(); } IdentifierTree identifier = getVariableIdentifier(expression); if (identifier == null || !identifier.symbol().isVolatile()) { return; } if (tree.is(Tree.Kind.LOGICAL_COMPLEMENT)) { checkBooleanToggling(tree, identifier.symbol()); } else { checkIncrementDecrement(tree, identifier); } }