@Override public void visitMethodInvocation(MethodInvocationTree syntaxNode) { if (syntaxNode.methodSelect().is(Tree.Kind.MEMBER_SELECT) && needsClosing(syntaxNode.symbolType())) { final ExpressionTree targetExpression = ((MemberSelectExpressionTree) syntaxNode.methodSelect()).expression(); if (targetExpression.is(Tree.Kind.IDENTIFIER) && !isWithinTryHeader(syntaxNode) && (syntaxNode.symbol().isStatic() || isJdbcResourceCreation(targetExpression))) { programState = programState.addConstraint( programState.peekValue(), new ObjectConstraint(false, false, syntaxNode, Status.OPENED)); } } }
private void checkForUnboxing(ExpressionTree expressionTree) { if (!expressionTree.is(Tree.Kind.METHOD_INVOCATION)) { return; } MethodInvocationTree methodInvocationTree = (MethodInvocationTree) expressionTree; if (isUnboxingMethodInvocation(methodInvocationTree)) { ExpressionTree methodSelect = methodInvocationTree.methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree memberSelectExpressionTree = (MemberSelectExpressionTree) methodSelect; ExpressionTree unboxedExpression = memberSelectExpressionTree.expression(); String unboxingResultTypeName = methodInvocationTree.symbolType().fullyQualifiedName(); if (unboxingResultTypeName.equals( PRIMITIVE_TYPES_BY_WRAPPER.get(unboxedExpression.symbolType().fullyQualifiedName()))) { addUnboxingIssue(expressionTree, unboxedExpression); } } } }