Source:
public static FakedTrackingVariable getCloseTrackingVariable(Expression expression, FlowInfo flowInfo, FlowContext flowContext) { while (true) { if (expression instanceof CastExpression) expression = ((CastExpression) expression).expression; else if (expression instanceof Assignment) expression = ((Assignment) expression).expression; else if (expression instanceof ConditionalExpression) { FakedTrackingVariable falseTrackingVariable = getCloseTrackingVariable(((ConditionalExpression)expression).valueIfFalse, flowInfo, flowContext); if (falseTrackingVariable != null) { return falseTrackingVariable; } return getCloseTrackingVariable(((ConditionalExpression)expression).valueIfTrue, flowInfo, flowContext); } else if (expression instanceof SwitchExpression) { for (Expression re : ((SwitchExpression) expression).resultExpressions) { FakedTrackingVariable falseTrackingVariable = getCloseTrackingVariable(re, flowInfo, flowContext); if (falseTrackingVariable != null) { return falseTrackingVariable; } } return null; } else break; } if (expression instanceof SingleNameReference) { SingleNameReference name = (SingleNameReference) expression; if (name.binding instanceof LocalVariableBinding) { LocalVariableBinding local = (LocalVariableBinding)name.binding; if (local.closeTracker != null) return local.closeTracker; if (!isAnyCloseable(expression.resolvedType)) return null; if ((local.tagBits & TagBits.IsResource) != 0) return null; Statement location = local.declaration; local.closeTracker = new FakedTrackingVariable(local, location, flowInfo, flowContext, FlowInfo.UNKNOWN); if (local.isParameter()) { local.closeTracker.globalClosingState |= OWNED_BY_OUTSIDE; } return local.closeTracker; } } else if (expression instanceof AllocationExpression) { return ((AllocationExpression) expression).closeTracker; } return null; }

Target:
public static FakedTrackingVariable getCloseTrackingVariable(Expression expression, FlowInfo flowInfo, FlowContext flowContext) { while (true) { if (expression instanceof CastExpression) expression = ((CastExpression) expression).expression; else if (expression instanceof Assignment) expression = ((Assignment) expression).expression; else if (expression instanceof ConditionalExpression) { FakedTrackingVariable falseTrackingVariable = getCloseTrackingVariable(((ConditionalExpression)expression).valueIfFalse, flowInfo, flowContext); if (falseTrackingVariable != null) { return falseTrackingVariable; } return getCloseTrackingVariable(((ConditionalExpression)expression).valueIfTrue, flowInfo, flowContext); } else if (expression instanceof SwitchExpression) { for (Expression re : ((SwitchExpression) expression).resultExpressions) { FakedTrackingVariable fakedTrackingVariable = getCloseTrackingVariable(re, flowInfo, flowContext); if (fakedTrackingVariable != null) { return fakedTrackingVariable; } } return null; } else break; } if (expression instanceof SingleNameReference) { SingleNameReference name = (SingleNameReference) expression; if (name.binding instanceof LocalVariableBinding) { LocalVariableBinding local = (LocalVariableBinding)name.binding; if (local.closeTracker != null) return local.closeTracker; if (!isAnyCloseable(expression.resolvedType)) return null; if ((local.tagBits & TagBits.IsResource) != 0) return null; Statement location = local.declaration; local.closeTracker = new FakedTrackingVariable(local, location, flowInfo, flowContext, FlowInfo.UNKNOWN); if (local.isParameter()) { local.closeTracker.globalClosingState |= OWNED_BY_OUTSIDE; } return local.closeTracker; } } else if (expression instanceof AllocationExpression) { return ((AllocationExpression) expression).closeTracker; } return null; }