-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add MethodAccessSystemGetProperty predicate #4898
Add MethodAccessSystemGetProperty predicate #4898
Conversation
@@ -16,5 +16,6 @@ class PrintAstConfigurationOverride extends PrintAstConfiguration { | |||
/** | |||
* TWEAK THIS PREDICATE AS NEEDED. | |||
*/ | |||
override predicate shouldPrint(Element e, Location l) { super.shouldPrint(e, l) } | |||
override predicate shouldPrint(Element e, Location l) { super.shouldPrint(e, l) and | |||
not l.getFile().getBaseName().matches("SystemGetPropertyCall.java") } |
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.
Accidentally committed?
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.
Nope, this is intentional. Do you want me to just update the test result?
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.
Yes, please update the test result instead.
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.
This should be resolved now.
java/ql/src/semmle/code/java/JDK.qll
Outdated
MethodAccessSystemGetProperty() { getMethod() instanceof MethodSystemGetProperty } | ||
|
||
/** | ||
* Holds true if this is a compile-time constant call for the specified `propertyName`. |
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.
* Holds true if this is a compile-time constant call for the specified `propertyName`. | |
* Holds true if this call gets a compile-time constant property `propertyName`. |
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.
I believe this is resolved.
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
99c0ef1
to
ba4a562
Compare
This should be ready for another review pass. 😄 Thanks for the quick turnarround on feedback! |
This simple predicate looks for calls to
System.getProperty
with a compile time constant.This pattern is pretty common. As an example: https://lgtm.com/query/1737527738205752665/
This PR is a dependency for both #4388 & #4473