Skip to content

Commit f8b2721

Browse files
committed
Clean up.
1 parent c7a9686 commit f8b2721

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/utils/Util.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*/
44
package edu.cuny.hunter.streamrefactoring.core.utils;
55

6+
import static org.eclipse.jdt.core.dom.ASTNode.PARENTHESIZED_EXPRESSION;
7+
68
import java.util.Optional;
79

810
import org.eclipse.core.runtime.CoreException;
@@ -155,7 +157,7 @@ public static String getQualifiedNameFromTypeSignature(String typeSignature, ITy
155157
}
156158

157159
public static ASTNode stripParenthesizedExpressions(ASTNode node) {
158-
if (node != null && node.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION) {
160+
if (node != null && node.getNodeType() == PARENTHESIZED_EXPRESSION) {
159161
ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) node;
160162
return stripParenthesizedExpressions(parenthesizedExpression.getExpression());
161163
} else

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
*/
44
package edu.cuny.hunter.streamrefactoring.core.wala;
55

6+
import static com.ibm.wala.ide.util.EclipseProjectPath.AnalysisScopeType.NO_SOURCE;
7+
import static com.ibm.wala.types.ClassLoaderReference.Primordial;
8+
import static edu.cuny.hunter.streamrefactoring.core.utils.LoggerNames.LOGGER_NAME;
9+
610
import java.io.File;
711
import java.io.IOException;
812
import java.io.InputStream;
13+
import java.nio.file.Path;
914
import java.util.jar.JarFile;
1015
import java.util.logging.Logger;
1116

@@ -17,7 +22,6 @@
1722

1823
import com.ibm.wala.cast.java.client.JDTJavaSourceAnalysisEngine;
1924
import com.ibm.wala.ide.util.EclipseProjectPath;
20-
import com.ibm.wala.ide.util.EclipseProjectPath.AnalysisScopeType;
2125
import com.ibm.wala.ipa.callgraph.AnalysisCache;
2226
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
2327
import com.ibm.wala.ipa.callgraph.CallGraph;
@@ -32,8 +36,6 @@
3236
import com.ibm.wala.util.CancelException;
3337
import com.ibm.wala.util.config.FileOfClasses;
3438

35-
import edu.cuny.hunter.streamrefactoring.core.utils.LoggerNames;
36-
3739
/**
3840
* Modified from EclipseAnalysisEngine.java, originally from Keshmesh. Authored
3941
* by Mohsen Vakilian and Stas Negara. Modified by Nicholas Chen and Raffi
@@ -42,7 +44,7 @@
4244
*/
4345
public class EclipseProjectAnalysisEngine<I extends InstanceKey> extends JDTJavaSourceAnalysisEngine<I> {
4446

45-
private static final Logger LOGGER = Logger.getLogger(LoggerNames.LOGGER_NAME);
47+
private static final Logger LOGGER = Logger.getLogger(LOGGER_NAME);
4648

4749
/**
4850
* The N value used to create the {@link nCFABuilder}.
@@ -94,7 +96,7 @@ public void buildAnalysisScope() throws IOException {
9496

9597
IVMInstall defaultVMInstall = JavaRuntime.getDefaultVMInstall();
9698
File installLocation = defaultVMInstall.getInstallLocation();
97-
java.nio.file.Path installPath = installLocation.toPath();
99+
Path installPath = installLocation.toPath();
98100

99101
if (Util.isWindows()) {
100102
addToScopeWindows("resources.jar", installPath);
@@ -118,21 +120,19 @@ public void buildAnalysisScope() throws IOException {
118120
}
119121
}
120122

121-
void addToScopeWindows(String fileName, java.nio.file.Path installPath) throws IOException {
122-
scope.addToScope(ClassLoaderReference.Primordial,
123-
new JarFile(installPath.resolve("lib").resolve(fileName).toFile()));
123+
void addToScopeWindows(String fileName, Path installPath) throws IOException {
124+
scope.addToScope(Primordial, new JarFile(installPath.resolve("lib").resolve(fileName).toFile()));
124125
}
125126

126-
void addToScopeNotWindows(String fileName, java.nio.file.Path installPath) throws IOException {
127-
scope.addToScope(ClassLoaderReference.Primordial,
128-
new JarFile(installPath.resolve("jre").resolve("lib").resolve(fileName).toFile()));
127+
void addToScopeNotWindows(String fileName, Path installPath) throws IOException {
128+
scope.addToScope(Primordial, new JarFile(installPath.resolve("jre").resolve("lib").resolve(fileName).toFile()));
129129
}
130130

131131
@Override
132132
protected EclipseProjectPath<?, IJavaProject> createProjectPath(IJavaProject project)
133133
throws IOException, CoreException {
134134
project.open(new NullProgressMonitor());
135-
return TestableJavaEclipseProjectPath.create(project, AnalysisScopeType.NO_SOURCE);
135+
return TestableJavaEclipseProjectPath.create(project, NO_SOURCE);
136136
}
137137

138138
@Override

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
import static com.ibm.wala.ipa.callgraph.impl.Util.addDefaultBypassLogic;
44
import static com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors;
5+
import static com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys.ALLOCATIONS;
6+
import static com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys.SMUSH_MANY;
7+
import static com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys.SMUSH_PRIMITIVE_HOLDERS;
8+
import static com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys.SMUSH_STRINGS;
9+
import static com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys.SMUSH_THROWABLES;
10+
import static com.ibm.wala.types.ClassLoaderReference.Application;
11+
import static com.ibm.wala.types.ClassLoaderReference.Extension;
12+
import static com.ibm.wala.types.ClassLoaderReference.Primordial;
513

614
import java.io.File;
715
import java.io.IOException;
@@ -83,8 +91,7 @@ public static SSAPropagationCallGraphBuilder makeNCFABuilder(int n, AnalysisOpti
8391
// nCFABuilder uses type-based heap abstraction by default, but we want
8492
// allocation sites
8593
result.setInstanceKeys(new ZeroXInstanceKeys(options, cha, result.getContextInterpreter(),
86-
ZeroXInstanceKeys.ALLOCATIONS | ZeroXInstanceKeys.SMUSH_MANY | ZeroXInstanceKeys.SMUSH_PRIMITIVE_HOLDERS
87-
| ZeroXInstanceKeys.SMUSH_STRINGS | ZeroXInstanceKeys.SMUSH_THROWABLES));
94+
ALLOCATIONS | SMUSH_MANY | SMUSH_PRIMITIVE_HOLDERS | SMUSH_STRINGS | SMUSH_THROWABLES));
8895
return result;
8996
}
9097

@@ -98,9 +105,9 @@ public static AnalysisScope mergeProjectPaths(Collection<EclipseProjectPath> pro
98105
// to avoid duplicates, we first add all application modules, then
99106
// extension
100107
// modules, then primordial
101-
buildScope(ClassLoaderReference.Application, projectPaths, scope, seen);
102-
buildScope(ClassLoaderReference.Extension, projectPaths, scope, seen);
103-
buildScope(ClassLoaderReference.Primordial, projectPaths, scope, seen);
108+
buildScope(Application, projectPaths, scope, seen);
109+
buildScope(Extension, projectPaths, scope, seen);
110+
buildScope(Primordial, projectPaths, scope, seen);
104111
return scope;
105112
}
106113

0 commit comments

Comments
 (0)