Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Extract constant.
  • Loading branch information
khatchad committed Feb 6, 2018
commit 6c6a374b4cec05461d246f3e160d90216ba02db6
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

public class nCFAContextWithReceiversSelector extends nCFAContextSelector {

/**
* The N to use if the instance implements BaseStream.
*/
public static final int CONTEXT_LENGTH_FOR_STREAMS = 2;

protected class CallStringTriple {

public CallStringTriple(CGNode node, CallSiteReference site, IMethod target) {
Expand Down Expand Up @@ -118,15 +123,15 @@ protected Map<CallStringTriple, CallStringWithReceivers> getCallStringWithReceiv
/**
* {@inheritDoc}
*
* @return 2 if the target's return type implements {@link BaseStream},
* @return CONTEXT_LENGTH_FOR_STREAMS if the target's return type implements {@link BaseStream},
* otherwise, return the original value.
*/
@Override
protected int getLength(CGNode caller, CallSiteReference site, IMethod target) {
boolean implementsBaseStream = Util.implementsBaseStream(target.getReturnType(), target.getClassHierarchy());

if (implementsBaseStream)
return 2;
return CONTEXT_LENGTH_FOR_STREAMS;
else
return super.getLength(caller, site, target);
}
Expand Down