-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate Java call graphs from local JARs in OPALPlugin
#459
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
core/src/main/java/eu/fasten/core/data/opal/MavenCoordinate.java
Outdated
Show resolved
Hide resolved
CHA, date, artifactRepository, ONLY_STATIC_CALLSITES); | ||
long duration = currentTimeMillis() - startTime; | ||
try { | ||
this.graph = OPALPartialCallGraphConstructor.createPCGFromLocalJar(mavenCoordinate, date, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
analyzer/javacg-opal/src/main/java/eu/fasten/analyzer/javacgopal/OPALPlugin.java
Outdated
Show resolved
Hide resolved
* @return RevisionCallGraph of the given coordinate. | ||
* @throws FileNotFoundException | ||
*/ | ||
public static PartialJavaCallGraph createPCGFromLocalJar(final MavenCoordinate coordinate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge the two createPCG
methods into one. There is NO need for a case distinction, both should do exactly the same...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 2c4d825
…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
.m2
folder, created byPOMAnalyzer
.This PR makes the following changes:
DataWriter
interface toDataRW
so that the plugins can read/write from/to the disk given a base directory.OPALPlugin
first 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
POMAnalyzer
stores 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.