Skip to content

Commit 6c6a374

Browse files
committed
Extract constant.
1 parent 552f221 commit 6c6a374

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/wala/nCFAContextWithReceiversSelector.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919

2020
public class nCFAContextWithReceiversSelector extends nCFAContextSelector {
2121

22+
/**
23+
* The N to use if the instance implements BaseStream.
24+
*/
25+
public static final int CONTEXT_LENGTH_FOR_STREAMS = 2;
26+
2227
protected class CallStringTriple {
2328

2429
public CallStringTriple(CGNode node, CallSiteReference site, IMethod target) {
@@ -118,15 +123,15 @@ protected Map<CallStringTriple, CallStringWithReceivers> getCallStringWithReceiv
118123
/**
119124
* {@inheritDoc}
120125
*
121-
* @return 2 if the target's return type implements {@link BaseStream},
126+
* @return CONTEXT_LENGTH_FOR_STREAMS if the target's return type implements {@link BaseStream},
122127
* otherwise, return the original value.
123128
*/
124129
@Override
125130
protected int getLength(CGNode caller, CallSiteReference site, IMethod target) {
126131
boolean implementsBaseStream = Util.implementsBaseStream(target.getReturnType(), target.getClassHierarchy());
127132

128133
if (implementsBaseStream)
129-
return 2;
134+
return CONTEXT_LENGTH_FOR_STREAMS;
130135
else
131136
return super.getLength(caller, site, target);
132137
}

0 commit comments

Comments
 (0)