Skip to content

Commit 3555fa4

Browse files
committed
Fix bug in missing call edge
Signed-off-by: Rahul Krishna <[email protected]>
1 parent 78d704e commit 3555fa4

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/main/java/com/ibm/northstar/CodeAnalyzer.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@
2929
import java.io.File;
3030
import java.io.FileWriter;
3131
import java.io.IOException;
32-
import java.nio.charset.StandardCharsets;
3332
import java.nio.file.Files;
3433
import java.nio.file.Path;
3534
import java.nio.file.Paths;
3635
import java.util.List;
3736
import java.util.Map;
38-
import java.util.zip.GZIPOutputStream;
3937

4038
/**
4139
* The type Code analyzer.
@@ -61,9 +59,6 @@ public class CodeAnalyzer implements Runnable {
6159
@Option(names = {"-a", "--analysis-level"}, description = "Level of analysis to perform. Options: 1 (for just symbol table) or 2 (for call graph). Default: 1")
6260
private static int analysisLevel = 1;
6361

64-
@Option(names = {"-d", "--dependencies"}, description = "Path to the application 3rd party dependencies that may be helpful in analyzing the application.")
65-
private static String dependencies;
66-
6762
@Option(names = {"-v", "--verbose"}, description = "Print logs to console.")
6863
private static boolean verbose = false;
6964

@@ -107,9 +102,10 @@ private static void analyze() throws IOException, ClassHierarchyException, CallG
107102
}
108103

109104
else {
110-
105+
String dependencies = null;
111106
// download library dependencies of project for type resolution
112107
if (!BuildProject.downloadLibraryDependencies(input)) {
108+
dependencies = String.valueOf(BuildProject.libDownloadPath);
113109
Log.warn("Failed to download library dependencies of project");
114110
}
115111
// construct symbol table for project, write parse problems to file in output directory if specified
@@ -123,8 +119,8 @@ private static void analyze() throws IOException, ClassHierarchyException, CallG
123119
if (!Files.exists(outputPath)) {
124120
Files.createDirectories(outputPath);
125121
}
126-
String parseError = gson.toJson(symbolTableExtractionResult.getRight());
127-
emit(parseError, "parse_errors.json");
122+
// String parseError = gson.toJson(symbolTableExtractionResult.getRight());
123+
// emit(parseError, "parse_errors.json");
128124
/* gson.toJson(symbolTableExtractionResult.getRight(), new FileWriter(new File(outputPath.toString(), "parse_errors.json")));
129125
* }
130126
**/

src/main/java/com/ibm/northstar/SystemDependencyGraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public static String construct(
206206

207207
// Initialize scope
208208
AnalysisScope scope = ScopeUtils.createScope(input, dependencies, build);
209-
IClassHierarchy cha = ClassHierarchyFactory.makeWithRoot(scope,
209+
IClassHierarchy cha = ClassHierarchyFactory.make(scope,
210210
new ECJClassLoaderFactory(scope.getExclusions()));
211211
Log.done("There were a total of " + cha.getNumberOfClasses() + " classes of which "
212212
+ AnalysisUtils.getNumberOfApplicationClasses(cha) + " are application classes.");

src/main/java/com/ibm/northstar/utils/BuildProject.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
public class BuildProject {
1515

16-
private static final String LIB_DEPS_DOWNLOAD_DIR = "_libdeps";
17-
16+
public static Path libDownloadPath = null;
17+
private static final String LIB_DEPS_DOWNLOAD_DIR = ".library-dependencies";
1818
private static final String MAVEN_CMD = System.getProperty("os.name").contains("win") ? "mvn.cmd" : "mvn";
1919
private static final String GRADLE_CMD = System.getProperty("os.name").contains("win") ? "gradlew.bat" : "gradlew";
2020

@@ -129,7 +129,7 @@ public static List<Path> buildProjectAndStreamClassFiles(String projectPath, Str
129129
*/
130130
public static boolean downloadLibraryDependencies(String projectPath) {
131131
// created download dir if it does not exist
132-
Path libDownloadPath = Paths.get(projectPath, LIB_DEPS_DOWNLOAD_DIR);
132+
libDownloadPath = Paths.get(projectPath, LIB_DEPS_DOWNLOAD_DIR);
133133
if (!Files.exists(libDownloadPath)) {
134134
try {
135135
Files.createDirectory(libDownloadPath);

0 commit comments

Comments
 (0)