Skip to content

Commit 94f3001

Browse files
committed
Logging for #178.
1 parent 8af42bd commit 94f3001

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/StreamAnalyzer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ public StreamAnalyzer(boolean visitDocTags, int nForStreams, boolean findImplici
121121
* @return {@link Map} of project's analyzed along with the entry points used.
122122
*/
123123
public Map<IJavaProject, Collection<Entrypoint>> analyze() throws CoreException {
124+
LOGGER.info(() -> "Using N = " + this.getNForStreams());
125+
124126
Map<IJavaProject, Collection<Entrypoint>> ret = new HashMap<>();
125127

126128
// collect the projects to be analyzed.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public CallGraphBuilder<?> getCallGraphBuilder() {
173173
@Override
174174
protected CallGraphBuilder<?> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options,
175175
IAnalysisCacheView cache) {
176+
LOGGER.info(() -> "Using N = " + this.getNToUseForStreams());
176177
return Util.makeNCFABuilder(N, options, (AnalysisCache) cache, cha, scope, this.getNToUseForStreams());
177178
}
178179

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package edu.cuny.hunter.streamrefactoring.core.wala;
22

3+
import static edu.cuny.hunter.streamrefactoring.core.utils.LoggerNames.LOGGER_NAME;
4+
35
import java.util.HashMap;
46
import java.util.Map;
7+
import java.util.logging.Logger;
58
import java.util.stream.BaseStream;
69

710
import com.ibm.wala.classLoader.CallSiteReference;
@@ -20,6 +23,8 @@
2023

2124
public class nCFAContextWithReceiversSelector extends nCFAContextSelector {
2225

26+
private static final Logger LOGGER = Logger.getLogger(LOGGER_NAME);
27+
2328
protected class CallStringTriple {
2429

2530
CGNode node;
@@ -90,6 +95,7 @@ public nCFAContextWithReceiversSelector(int n, ContextSelector base) {
9095
*/
9196
public nCFAContextWithReceiversSelector(int n, ContextSelector base, int nToUseForStreams) {
9297
super(n, base);
98+
LOGGER.info(() -> "Using N = " + nToUseForStreams);
9399
this.contextLengthForStreams = nToUseForStreams;
94100
}
95101

@@ -159,9 +165,11 @@ protected int getLength(CGNode caller, CallSiteReference site, IMethod target) {
159165
TypeReference typeToCheck = Util.getEvaluationType(target);
160166
boolean implementsBaseStream = Util.implementsBaseStream(typeToCheck, target.getClassHierarchy());
161167

162-
if (implementsBaseStream)
163-
return this.getContextLengthForStreams();
164-
else
168+
if (implementsBaseStream) {
169+
int lengthForStreams = this.getContextLengthForStreams();
170+
LOGGER.fine(() -> "Using N = " + lengthForStreams);
171+
return lengthForStreams;
172+
} else
165173
return super.getLength(caller, site, target);
166174
}
167175

0 commit comments

Comments
 (0)