Skip to content

Commit fc6a0eb

Browse files
committed
Add option to not perform analysis.
Useful for gathering metrics.
1 parent 30409df commit fc6a0eb

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

edu.cuny.hunter.streamrefactoring.eval/src/edu/cuny/hunter/streamrefactoring/eval/handlers/EvaluateConvertToParallelStreamRefactoringHandler.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public class EvaluateConvertToParallelStreamRefactoringHandler extends AbstractH
110110

111111
private static final String N_TO_USE_FOR_STREAMS_PROPERTY_KEY = "nToUseForStreams";
112112

113+
private static final boolean PERFORM_ANALYSIS_DEFAULT = true;
114+
115+
private static final String PERFORM_ANALYSIS_PROPERTY_KEY = "edu.cuny.hunter.streamrefactoring.eval.performAnalysis";
116+
113117
private static final boolean PERFORM_CHANGE_DEFAULT = false;
114118

115119
private static final String PERFORM_CHANGE_PROPERTY_KEY = "edu.cuny.hunter.streamrefactoring.eval.performChange";
@@ -272,6 +276,15 @@ private static boolean shouldFindImplicitTestEntrypoints() {
272276
return Boolean.valueOf(findImplicitTestEntrypoints);
273277
}
274278

279+
private static boolean shouldPerformAnalysis() {
280+
String value = System.getenv(PERFORM_ANALYSIS_PROPERTY_KEY);
281+
282+
if (value == null)
283+
return PERFORM_ANALYSIS_DEFAULT;
284+
else
285+
return Boolean.valueOf(value);
286+
}
287+
275288
private static boolean shouldPerformChange() {
276289
String performChangePropertyValue = System.getenv(PERFORM_CHANGE_PROPERTY_KEY);
277290

@@ -395,10 +408,14 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
395408
ConvertToParallelStreamRefactoringProcessor.setLoggingLevel(LOGGING_LEVEL);
396409

397410
// run the precondition checking.
398-
resultsTimeCollector.start();
399-
RefactoringStatus status = new ProcessorBasedRefactoring(processor)
400-
.checkAllConditions(new NullProgressMonitor());
401-
resultsTimeCollector.stop();
411+
RefactoringStatus status = null;
412+
413+
if (shouldPerformAnalysis()) {
414+
resultsTimeCollector.start();
415+
status = new ProcessorBasedRefactoring(processor).checkAllConditions(new NullProgressMonitor());
416+
resultsTimeCollector.stop();
417+
} else
418+
status = new RefactoringStatus();
402419

403420
// print entry points.
404421
Collection<Entrypoint> entryPoints = getProjectEntryPoints(javaProject, processor);

0 commit comments

Comments
 (0)