Generate Java call graphs from local JARs in OPALPlugin#459
Generate Java call graphs from local JARs in OPALPlugin#459
OPALPlugin#459Conversation
proksch
left a comment
There was a problem hiding this comment.
I think that the solution is sub-optimal... a case distinction that should be taken on a high level is dragged down through the various levels of the API. I have proposed a different strategy in the individual comments.
| CHA, date, artifactRepository, ONLY_STATIC_CALLSITES); | ||
| long duration = currentTimeMillis() - startTime; | ||
| try { | ||
| this.graph = OPALPartialCallGraphConstructor.createPCGFromLocalJar(mavenCoordinate, date, |
There was a problem hiding this comment.
Do not use exception handling for programming logic! Concrete proposal: There is no need to have two separate methods, one createPartialCG method should be enough, which just takes a path to the jar to be analyzed. The only difference is where the path comes from: either mavenCoord.getPath() exists or the .jar is downloaded and a path to the downloaded file is provided. As the jar should always exist locally in our setup, I would be fine with just throwing an error when the file is missing.
| * @return RevisionCallGraph of the given coordinate. | ||
| * @throws FileNotFoundException | ||
| */ | ||
| public static PartialJavaCallGraph createPCGFromLocalJar(final MavenCoordinate coordinate, |
There was a problem hiding this comment.
Please merge the two createPCG methods into one. There is NO need for a case distinction, both should do exactly the same...
…e existing JARs on FS and download them if not present
|
@proksch, thanks for the code review and comments. |
Description
As discussed in #363, it is now possible to generate call graphs from local JARs in the
.m2folder, created byPOMAnalyzer.This PR makes the following changes:
DataWriterinterface toDataRWso that the plugins can read/write from/to the disk given a base directory.OPALPluginfirst tries to generate a call graph from a local JAR file if available. If not, it downloads the JAR file from Maven central like before.Motivation and context
POMAnalyzerstores JAR files to the disk when resolving dependencies. Therefore, it is desirable to generate CGs from local JAR files and also reduce the network activity ofOPALPlugin.Testing
Tested with the DC.