-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
base: develop
Are you sure you want to change the base?
Conversation
sootup.core/src/main/java/sootup/core/validation/InvokeArgumentValidator.java
Outdated
Show resolved
Hide resolved
sootup.core/src/main/java/sootup/core/validation/InvokeArgumentValidator.java
Show resolved
Hide resolved
sootup.tests/src/test/java/sootup/tests/validator/InvokeArgumentValidatorTest.java
Outdated
Show resolved
Hide resolved
sootup.tests/src/test/java/sootup/tests/validator/InvokeArgumentValidatorTest.java
Outdated
Show resolved
Hide resolved
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
sootup.core/src/main/java/sootup/core/validation/InvokeArgumentValidator.java
Outdated
Show resolved
Hide resolved
...code/src/main/java/sootup/java/bytecode/inputlocation/ArchiveBasedAnalysisInputLocation.java
Outdated
Show resolved
Hide resolved
sootup.java.core/src/main/java/sootup/java/core/JavaIdentifierFactory.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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); |
There was a problem hiding this comment.
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; | ||
} | ||
|
There was a problem hiding this comment.
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
...code/src/main/java/sootup/java/bytecode/inputlocation/ArchiveBasedAnalysisInputLocation.java
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
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. |
rt.jar
in the analysis input locations, as the validator relies on typeHierarchy. Add a corresponding test case for this scenario.JavaIdentifierFactory.getBoxedType(...)
related to the int type. Replace the erroneousjava.lang.Int
with the correct type, which isjava.lang.Integer
.ArchiveBasedAnalysisInputLocation.getClassSource(...)
to avoid casting exception when passing an anonymousClassType
object which cannot be casted toJavaClassType
directly.