Exclusions and Entry Point Fixes in build()
There are two problems which I have ran into while working with the SceneBuilder class. The first is that there always is not an entry point, for example if just java.lang.String is being analyzed, no entry point would be needed. The syntax to create the SceneBuilder would be
Scene scene = SceneBuilder.create().addClass("java.lang.String").build();
Without the null check on this.loadMainClass(this.entryClassToLoad);,entryClassToLoad would be null and SootClass c = this.loadAppClass(name); would throw an exception.
The other problem which I encountered was that in the example drivers, packages were excluded such as in E1, addExclusions(Arrays.asList("java.*", "javax.*", "sun.*")) . These exclusions were not doing anything since these packages are already excluded by default.
When Scene is created it calls determineExcludedPackages(); which adds the following default exclusions
excludedPackages.add("java.*"); excludedPackages.add("sun.*"); excludedPackages.add("javax.*"); excludedPackages.add("com.sun.*"); excludedPackages.add("com.ibm.*"); excludedPackages.add("org.xml.*"); excludedPackages.add("org.w3c.*"); excludedPackages.add("apple.awt.*"); excludedPackages.add("com.apple.*");
In theory, calling options.set_exclude, like is done in the SceneBuilder, should override the default exclusions, but this does not appear to be the way it works. If a list of exclusions, or a blank list, was sent into options.set_exclude, the default exclusions were still in place. This was solved by calling options.set_include_all(true); which prevents determineExcludedPackages(); from excluding the above packages.
