[Java-frontend] Add functionLinenumberEnd to methods #1618
Merged
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.
In #1396, a new variable functionLinenumberEnd is added to indicate the possible ending line number of specific functions/methods in the source file. The Java frontend does not comply with this new element and always has the functionLinenumberEnd equal to -1.
To accommodate additional API to retrieve the real method source location for oss-fuzz-gen cross reference, it is necessary to know both the starting line number and ending line number of a method to retrieve the source code for reference.
This PR fixes the Java frontend logic to calculate the ending line number using the data contained in the active body of the SootMethod. Then the ending line number is added to the function elements and output in the data.yaml file for fuzz-introspector to process. If the logic fails to retrieve the active body, it will use the default -1 as the ending line number.