Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvokeArgumentValidator changes #865

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

Momo-Not-Emo
Copy link
Contributor

@Momo-Not-Emo Momo-Not-Emo commented Feb 21, 2024

  1. Adapt InvokeArgumentValidator and add test cases. The original version primarily focuses on verifying the number of arguments.
  2. Implement argument type checking by including rt.jar in the analysis input locations, as the validator relies on typeHierarchy. Add a corresponding test case for this scenario.
  3. Rectify a bug in JavaIdentifierFactory.getBoxedType(...) related to the int type. Replace the erroneous java.lang.Int with the correct type, which is java.lang.Integer.
  4. Add support to check implicit conversion for primitive types.
  5. Add a workaround check in ArchiveBasedAnalysisInputLocation.getClassSource(...) to avoid casting exception when passing an anonymous ClassType object which cannot be casted to JavaClassType directly.

1. Refactor the test case code as per the review comments for simplicity.
2. Implement argument type checking by including `rt.jar` in the analysis input locations, as the validator relies on typeHierarchy. Add a corresponding test case for this scenario.
3. Rectify a bug in `JavaIdentifierFactory.getBoxedType(...)` related to the int type. Replace the erroneous `java.lang.Int` with the correct type, which is `java.lang.Integer`.
4. Address a bug in `ArchiveBasedAnalysisInputLocation.getClassSource(...)` where attempting to cast `ClassType` to `JavaClassType` is incorrect. Update the code to handle `ClassType` appropriately, as it cannot be directly cast to `JavaClassType`.
Speed up the class search process by limiting the search scope within application classes, since classTypeFieldRefValidator does not exist in rt.jar
Copy link
Collaborator

@JonasKlauke JonasKlauke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help to improve SootUp 👍

continue;
}
// other cases
ClassType argClassType = getClassType(identifierFactory, argType);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the primitive type check the argument could still have the type: arraytype. You can not assume it is automatically a classtype.


return;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a testcase for array types. Primitive type array, Classtype array and both cases also as multi-dimensional array

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 19.48052% with 62 lines in your changes are missing coverage. Please review.

Project coverage is 69.71%. Comparing base (e63dc81) to head (24672be).

Files Patch % Lines
...ootup/core/validation/InvokeArgumentValidator.java 0.00% 43 Missing ⚠️
...src/main/java/sootup/core/types/PrimitiveType.java 48.14% 14 Missing ⚠️
.../java/sootup/core/typehierarchy/TypeHierarchy.java 0.00% 2 Missing ⚠️
...putlocation/ArchiveBasedAnalysisInputLocation.java 50.00% 1 Missing and 1 partial ⚠️
...n/java/sootup/java/core/JavaIdentifierFactory.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #865      +/-   ##
=============================================
- Coverage      69.88%   69.71%   -0.17%     
- Complexity      4039     4044       +5     
=============================================
  Files            310      310              
  Lines          15248    15317      +69     
  Branches        2605     2624      +19     
=============================================
+ Hits           10656    10679      +23     
- Misses          3735     3782      +47     
+ Partials         857      856       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stschott stschott marked this pull request as draft September 5, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants