soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.85k stars 706 forks source link

refactor: changing sootclass getname to getpathplusclassname #2022

Open jkraft-pjr opened 9 months ago

jkraft-pjr commented 9 months ago

In the SootClass class, the function getName() is not specific enough regarding what it is returning. I refactored the function name to getPathPlusClassName() as it is a better description of what the function is returning.

The motivation behind making this change is in certain areas Soot assumes getName() is returning the fully qualified name of the class, package name + the class name. However, in some applications that is not always the case. For instance, in a SpringBoot application, all the application classes are put into the directories BOOT-INF/classes. It is important to note, the BOOT-INF/classes directories are not part of the class's package name. Which causes the path + class name to not equal the class's fully qualified name.

This boils down to the file path of the class does not always equal the class's package name. According to the JDK 8 documentation, it states, "Many implementations of the Java platform rely on hierarchical file systems to manage source and class files, although The Java Language Specification does not require this."

This pull request is merely to refactor the SootClass function, getName(), to describe the information it is returning accurately.