When reversing Java code to sequence diagram, sometimes you may not be able to specify a method for conversion. In the window, somehow the class (to which the method belongs) can’t seem to be expanded to list anything and therefore the method is nowhere to be selected. What happens?
When you do run into this problem, you’d probably see something similar below. At the point of being asked to select an operation, the java classes are not expandable ( i.e. no leading ‘+’ signs ).
The Java source path is incorrectly set.
As an example, let’s say we are reversing Java code of method createNewFile() in Java class File.java which is packaged in java.io.
In the Windows Explorer, the source code file File.java appears living in C:\src\java\io
Back in the source code file File.java, we can see that the package line defines the class to be in package \java\io\
When we specified the Java source path to be C:\src\java , we were asking the program to look for File.java in C:\src\java\java\io (which doesn’t exist).
i.e. The program begins at C:\src\java and from there, goes to \java\io
Instead, we should specify the Java source path to be C:\src in this case so that the program will look for File.java in the path C:\src\java\io
i.e. beginning at C:\src and then going down to \java\io
Steps to Fix It
- Click < Back to return to the Java Source section.
- Remove the incorrect Java source by selecting it and clicking Remove.
- Add a new java source for C:\src by clicking Add Source Folder…
Specify a new java source
After fixing the Java source path, the operations should now be available for selection under their corresponding Java classes ( with leading ‘+’ signs ).
Upon completion of the conversion, you should be able to see the sequence diagram.