gousiosg / java-callgraph Goto Github PK
View Code? Open in Web Editor NEWPrograms for producing static and dynamic (runtime) call graphs for Java programs
Programs for producing static and dynamic (runtime) call graphs for Java programs
As the version of bcel that is used does not support Java 8, java-callgraph will fail with ClassFormatException: Invalid byte tag in constant pool: 18
As there is no updated version of Apache BCEL yet, one needs to use the spinoff from findbugs for now, see the attached patch and https://issues.apache.org/jira/browse/BCEL-173 for details.
0001-Update-to-latest-javassist-and-use-bcel-from-findbug.patch.txt
my project need a func to get callgraph, but it omit the native func cause it doesn't has call-graph in jar, but we need know which is native func while analyzing.
i think it's a nice func and i modifed the code to get that feature
During the dynamic execution of program, is it possible to record the data passed from one method call in class to other method in other class
When trying to generate a dynamic call graph for my spring boot project I got this error:
Error: Could not find or load main class :jar.batik-all.jar:jar.xml-apis-ext.jar
1- The command that I ran:
java -Xbootclasspath:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:jar/batik-all.jar:jar/xml-apis-ext.jar -javaagent:target/javacg-0.1-SNAPSHOT-dycg-agent.jar="incl=org.apache.batik.,org.w3c.;" -jar dacapo-9.12-bach.jar batik -s small | tail -n 10
2- The example that I followed:
https://github.com/gousiosg/java-callgraph#examples
I downloaded the package, installed it with maven 3.8.1, then it have these errors:
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.187 sec <<< FAILURE!
Retrieve nested lambdas(Lambda) Time elapsed: 0.141 sec <<< ERROR!
java.lang.RuntimeException: Cannot found: M:NestedLambdaTest:lambda$lambda$methodA$2$1() (D)Runner:run(NestedLambdaTest)
at gr.gousiosg.javacg.StepDefinitions.the_result_should_contain(StepDefinitions.java:45)
at ?.the result should contain:(gr/gousiosg/javacg/lambda.feature:69)
Could someone please tell me how to fix it? Thanks a lot!
From reading the documentation, it requires the XBootClassPath flag.
Can this still be run on Java 1.8 even though it does not support that option?
For thread pool, I don't know how to trace in javacg-dynamic.
In these cases, the method call is missing:
I added support for the above types, you can see my fork:
https://github.com/Adrninistrator/java-callgraph
I want to get the line number of the method call in the class file?through the line number,I can connect all the methods. Thank you for your generous answer.
can you remove System.out.println in method ClassVisitor.visitConstantPool() ? It could be good to let user to decide how to print information, for example use logger
I wonder if this tool can analyze calls to dependencies in the pom.xml
of program analyzed. I tried and found all result only contained calls to its own classed or Java core packages like java.lang
, java.io
.
If not, is it feasible to create an executable JAR with dependencies using Maven and process this JAR with the javacg-0.1-SNAPSHOT-static.jar
?
Could someone please tell me how to make that? Thanks a lot!
Hi,
when i run java-CallGraph getTweets method inside jar doesn't involve to call graph.
jar file source code like that:
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JTextArea textArea = new **JTextArea(getTweets("#XXX"));**
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setBounds(500, 500, 500, 500);
JScrollPane jScrollPane1 = new JScrollPane(textArea);
jScrollPane1.setBounds(500, 500, 500, 500);
JOptionPane.showMessageDialog(null, jScrollPane1, "Tweets",
JOptionPane.CLOSED_OPTION);
}
});
I would kindly request to upload the snapshot release in any maven repository.
Here is the sample procedure to follow:
http://maven.apache.org/guides/mini/guide-ibiblio-upload.html
I need the maven upload because i would like to use the latest snapshot release of BCEL.
Also could you please update the documentation of Compile section - https://github.com/gousiosg/java-callgraph#compile for the fact that 3 jars are created. Two executable and one standard maven release javacg-0.1-SNAPSHOT.jar.
Hello, I want to know if this project has a method to judge that function A calls function B (non-direct call, and arbitrary),thank you!
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar.
When i want to use dynamic modes, I cant find classes.jar in 1.8.x JRE on Mac os.
I'm looking for a tool that can read one class file and show which methods reference other class variables and methods in the same class. The purpose is to find places where I can split a class. If a class variable is referenced by three methods and they don't reference other variables, then I can move this set to a new class. Your java-callgraph product is the closest I have found. Do you know if the functionality that I'm looking for is possible to implement?
Hey, nice concise tool!
Do you think it would be useful/easy to write the result in graphviz format? that way it would have a rudimentary way to visualize the graph. Maybe I missed something in the docs but the only output I saw is text based.
Maybe changing the current format, or adding a flag parameter, although I see it's currently straight to the point.
I might get some time to do it myself, at least for the static part.
Let me know what you think.
Only saw the static call graph works on jar
. Does it support Java files?
Hello,
This project is awesome, I found it the most straightforward among all of the others.
I tested java -jar javacg-0.1-SNAPSHOT-static.jar
against a maven project and everything was good except that no result for Junit
test suite is generated. Is that basically possible in this project? If not, could you please provide me with information that how can I add this feature into the project?
Thanks.
I have several java source code files and they may not be compiled to jar files because of the absent of dependency jar file. I can analyze the AST of it. I wonder if I can analyze the call graph with this tool?
In order to see, what may be called from what, two further types of method calls seem to me important: (1.) a method is overwritten by another one. (this is not just a true call, but however, I think java-callgraph could do so, since the overwriting method is executed instead of the overwritten one.)
(2.) an interface method is implemented by a concrete method. (java-callgraph is already listing calls of interface method. So for completeness (respective to the given jars) I want to see also the implementing methods.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.