A command-line tool to find method invocations in Java bytecode. JMF helps you locate where specific methods are being called across your Java project.
- Find all invocations of a specific method in a given class
- Support scanning compiled Java class files
- Provide detailed output with line numbers
- Optional verbose mode for debugging
- Easy-to-use command-line interface
- Java 8 or higher
- Maven
- Clone the repository:
git clone https://github.com/ywjno/javamethodfinder.git- Build the project:
mvn clean packageThis will create an executable jar file in the target directory named jmf.jar.
Basic usage:
java -jar jmf.jar -c com.example.TargetClass -m targetMethod| Option | Description |
|---|---|
-c, --class |
The fully qualified name of the target class to find method calls (required) |
-m, --method |
The name of the target method to find its invocations (required) |
-s, --scan |
The root directory to scan for class files (default: ./target/classes) |
-v, --verbose |
Enable verbose output for debugging |
-h, --help |
Show this help message and exit |
Find all calls to targetMethod() method in com.example.TargetClass:
java -jar jmf.jar -c com.example.TargetClass -m targetMethodScan a specific directory with verbose output:
java -jar jmf.jar -c com.example.TargetClass -m targetMethod -s ./build/classes -vThe tool outputs results in the following format:
com.example.TargetClass#targetMethod
- com.example.CallerClass#callerMethod (L123)
- com.example.AnotherClass#someMethod (L45)
Each line shows:
- The calling class and method
- The line number where the call occurs (prefixed with 'L')
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.