private static List<Type> getTypes(ListTree<TypeTree> superInterfaces) { List<Type> types = new ArrayList<>(superInterfaces.size()); for (TypeTree superInterface : superInterfaces) { types.add(superInterface.symbolType()); } return types; }
private static List<Type> getTypes(ListTree<TypeTree> superInterfaces) { List<Type> types = new ArrayList<>(superInterfaces.size()); for (TypeTree superInterface : superInterfaces) { types.add(superInterface.symbolType()); } return types; }
@Override public void visitTryStatement(TryStatementTree tree) { statements++; statements -= tree.resourceList().size(); statements -= tree.catches().size(); super.visitTryStatement(tree); }
@Override public void visitTryStatement(TryStatementTree tree) { statements++; statements -= tree.resources().size(); statements -= tree.catches().size(); super.visitTryStatement(tree); }
@Override public void visitTryStatement(TryStatementTree tree) { statements++; statements -= tree.resourceList().size(); statements -= tree.catches().size(); super.visitTryStatement(tree); }
private void executeNewArray(NewArrayTree newArrayTree) { int numberDimensions = (int) newArrayTree.dimensions().stream().map(ArrayDimensionTree::expression).filter(Objects::nonNull).count(); programState = programState.unstackValue(numberDimensions).state; programState = programState.unstackValue(newArrayTree.initializers().size()).state; SymbolicValue svNewArray = constraintManager.createSymbolicValue(newArrayTree); programState = programState.stackValue(svNewArray); programState = svNewArray.setSingleConstraint(programState, ObjectConstraint.NOT_NULL); }
@Override public void visitNode(Tree tree) { ListTree<Tree> resources = ((TryStatementTree) tree).resourceList(); // need only (resources.size - 1) separators if (!resources.isEmpty() && resources.separators().size() == resources.size()) { reportIssue(Iterables.getLast(resources.separators()), "Remove this extraneous semicolon."); } }
@Override public void visitNode(Tree tree) { ListTree<Tree> resources = ((TryStatementTree) tree).resourceList(); // need only (resources.size - 1) separators if (!resources.isEmpty() && resources.separators().size() == resources.size()) { reportIssue(Iterables.getLast(resources.separators()), "Remove this extraneous semicolon."); } }
private void executeNewArray(NewArrayTree newArrayTree) { int numberDimensions = (int) newArrayTree.dimensions().stream().map(ArrayDimensionTree::expression).filter(Objects::nonNull).count(); programState = programState.unstackValue(numberDimensions).state; programState = programState.unstackValue(newArrayTree.initializers().size()).state; SymbolicValue svNewArray = constraintManager.createSymbolicValue(newArrayTree); programState = programState.stackValue(svNewArray); programState = svNewArray.setSingleConstraint(programState, ObjectConstraint.NOT_NULL); }
private static boolean hasMoreThanOneValue(AssignmentExpressionTree assignment) { if (assignment.expression().is(Tree.Kind.NEW_ARRAY)) { return ((NewArrayTree) assignment.expression()).initializers().size() > 1; } return false; }
private static boolean hasMoreThanOneValue(AssignmentExpressionTree assignment) { if (assignment.expression().is(Tree.Kind.NEW_ARRAY)) { return ((NewArrayTree) assignment.expression()).initializers().size() > 1; } return false; }
private void executeNewArray(NewArrayTree newArrayTree) { programState = programState.unstackValue(newArrayTree.initializers().size()).state; SymbolicValue svNewArray = constraintManager.createSymbolicValue(newArrayTree); programState = programState.stackValue(svNewArray); programState = svNewArray.setSingleConstraint(programState, ObjectConstraint.NOT_NULL); }
private void checkIncrement(ForStatementTree forStatement, IdentifierTree loopIdentifier, boolean positiveIncrement) { if (forStatement.update().size() <= 1) { ForLoopIncrement loopIncrement = ForLoopIncrement.findInUpdates(forStatement); if (loopIncrement == null || !loopIncrement.hasSameIdentifier(loopIdentifier)) { addIssue(forStatement); } else if (loopIncrement.hasValue()) { int requiredIncrement = positiveIncrement ? 1 : -1; if (loopIncrement.value() != requiredIncrement || forBodyUpdatesLoopIdentifier(forStatement, loopIdentifier)) { addIssue(forStatement); } } } }
private void checkIncrement(ForStatementTree forStatement, IdentifierTree loopIdentifier, boolean positiveIncrement) { if (forStatement.update().size() <= 1) { ForLoopIncrement loopIncrement = ForLoopIncrement.findInUpdates(forStatement); if (loopIncrement == null || !loopIncrement.hasSameIdentifier(loopIdentifier)) { addIssue(forStatement); } else if (loopIncrement.hasValue()) { int requiredIncrement = positiveIncrement ? 1 : -1; if (loopIncrement.value() != requiredIncrement || forBodyUpdatesLoopIdentifier(forStatement, loopIdentifier)) { addIssue(forStatement); } } } }