[Bug fix]return incorrect nullness in the method Scene#getTypeUnsafe #1697
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixed #1647
fixed #1696
In method soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder#addType, it calls Scene#getTypeUnsafe(String),
but the argument passed into the method Scene#getTypeUnsafe(String) may be quoted, just like:
Scene#getTypeUnsafe(String) will return null if the argument passed into is quoted, it will lead to Soot crashing with NullPointerException or IllegalArgumentException somewhere, just like the following 'test3' failing to pass the test with IllegalArgumentException
Here is a minimal test for evaluating the bug fixing.
Before fixing the bug, soot will crash with the messages:
Why type name string may be quoted?(like sun.reflect.'annotation'.AnnotationType)
For serialization, e.g. to .jimple format, a textual (and quoted as needed) representation of type is necessary.So for some reserved names, they will be replaced with quoted.(reserved names table are listed in the method Scene#setReservedNames)
"annotation" is a reserved name for textual serialization, and in the method Scene#quotedNameOf, If a part of a string contains reserved name, the part will be replaced with 'part', just like annotation replaced with 'annotation'.