Source:
<code>public static ParameterGuessingProposal createProposal(CContentAssistInvocationContext context, ArrayList<IBinding> availableElements, CCompletionProposal proposal, IFunction function, String prefix) { String replacement = getParametersList(function); String fullPrefix = function.getName() + "("; int replacementOffset = proposal.getReplacementOffset(); int replacementLength = 0; int invocationOffset = context.getInvocationOffset(); int parseOffset = context.getParseOffset(); IASTTranslationUnit <START> translationUnit = <END> context.getCompletionNode().getTranslationUnit(); IDocument document = context.getDocument(); if (isInsideBracket(invocationOffset, parseOffset)) { replacementOffset = parseOffset - prefix.length(); try { fullPrefix = document.get(replacementOffset, invocationOffset - replacementOffset); replacement = fullPrefix + replacement + ")"; } catch (BadLocationException e1) { } try { if (document.getChar(invocationOffset) == ')') replacement = replacement.substring(0, replacement.length() - 1); } catch (BadLocationException e) { } } else { replacement = fullPrefix + replacement + ")"; replacementOffset = proposal.getReplacementOffset(); } replacementLength = replacement.length(); ParameterGuessingProposal ret = new ParameterGuessingProposal(replacement, replacementOffset, replacementLength, proposal.getImage(), proposal.getDisplayString(), proposal.getIdString(), proposal.getRelevance(), context.getViewer(), function, invocationOffset, parseOffset, translationUnit, document); ret.setContextInformation(proposal.getContextInformation()); ret.fFullPrefix = fullPrefix; ret.fAssignableElemebts = availableElements; return ret; }</code><technical_language>Holding AST lifetime of index read lock build AST is unsafe. I potential solutions: a) index read lock is held for duration of parameter guessing process. A special care index read lock leak. b) Get a fresh AST in places original AST used</technical_language>

Target:
public static ParameterGuessingProposal createProposal(CContentAssistInvocationContext context, ArrayList<IBinding> availableElements, CCompletionProposal proposal, IFunction function, String prefix) { String replacement = getParametersList(function); String fullPrefix = function.getName() + "("; int replacementOffset = proposal.getReplacementOffset(); int replacementLength = 0; int invocationOffset = context.getInvocationOffset(); int parseOffset = context.getParseOffset(); IDocument document = context.getDocument(); if (isInsideBracket(invocationOffset, parseOffset)) { replacementOffset = parseOffset - prefix.length(); try { fullPrefix = document.get(replacementOffset, invocationOffset - replacementOffset); replacement = fullPrefix + replacement + ")"; } catch (BadLocationException e1) { } try { if (document.getChar(invocationOffset) == ')') replacement = replacement.substring(0, replacement.length() - 1); } catch (BadLocationException e) { } } else { replacement = fullPrefix + replacement + ")"; replacementOffset = proposal.getReplacementOffset(); } replacementLength = replacement.length(); ParameterGuessingProposal ret = new ParameterGuessingProposal(replacement, replacementOffset, replacementLength, proposal.getImage(), proposal.getDisplayString(), proposal.getIdString(), proposal.getRelevance(), context.getViewer(), function, invocationOffset, parseOffset, document); ret.setContextInformation(proposal.getContextInformation()); ret.fFullPrefix = fullPrefix; ret.fAssignableElements = availableElements; return ret; }