-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Java: Update models for commons-io and add negative models. #10170
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
Conversation
Click to show differences in coveragejavaGenerated file changes for java
- `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,561,104,89,,,,,,15
+ `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,556,106,91,,,,,,15
- Totals,,217,6438,1474,117,6,10,107,33,1,84
+ Totals,,217,6433,1476,119,6,10,107,33,1,84
- org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,547,14
+ org.apache.commons.io,106,,556,,91,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,542,14 |
Click to show differences in coveragejavaGenerated file changes for java
- `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,561,104,89,,,,,,15
+ `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,556,106,91,,,,,,15
- Totals,,217,6438,1474,117,6,10,107,33,1,84
+ Totals,,217,6433,1476,119,6,10,107,33,1,84
- org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,547,14
+ org.apache.commons.io,106,,556,,91,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,542,14 |
Click to show differences in coveragejavaGenerated file changes for java
- `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,561,104,89,,,,,,15
+ `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,556,106,91,,,,,,15
- Totals,,217,6438,1474,117,6,10,107,33,1,84
+ Totals,,217,6433,1476,119,6,10,107,33,1,84
- org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,547,14
+ org.apache.commons.io,106,,556,,91,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,542,14 |
Click to show differences in coveragejavaGenerated file changes for java
- `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,561,104,89,,,,,,15
+ `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,556,106,91,,,,,,15
- Totals,,217,6438,1474,117,6,10,107,33,1,84
+ Totals,,217,6433,1476,119,6,10,107,33,1,84
- org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,547,14
+ org.apache.commons.io,106,,556,,91,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,542,14 |
Click to show differences in coveragejavaGenerated file changes for java
- `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,561,104,89,,,,,,15
+ `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,556,106,91,,,,,,15
- Totals,,217,6438,1474,117,6,10,107,33,1,84
+ Totals,,217,6433,1476,119,6,10,107,33,1,84
- org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,547,14
+ org.apache.commons.io,106,,556,,91,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,542,14 |
7537321
to
e8d7266
Compare
Click to show differences in coveragejavaGenerated file changes for java
- `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,561,104,89,,,,,,15
+ `Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,556,106,91,,,,,,15
- Totals,,217,6438,1474,117,6,10,107,33,1,84
+ Totals,,217,6433,1476,119,6,10,107,33,1,84
- org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,547,14
+ org.apache.commons.io,106,,556,,91,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,542,14 |
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.
Looks plausible to me. It would be great to understand why there are changes in the generated models.
@@ -55,7 +55,8 @@ private predicate isJdkInternal(J::CompilationUnit cu) { | |||
private predicate isRelevantForModels(J::Callable api) { | |||
not isInTestFile(api.getCompilationUnit().getFile()) and | |||
not isJdkInternal(api.getCompilationUnit()) and | |||
not api instanceof J::MainMethod | |||
not api instanceof J::MainMethod and | |||
not api instanceof J::StaticInitializer |
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.
Why are static initializers not relevant for model generation?
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.
They showed up in the negative generated summary models and I don't think it makes sense to include them for positive models either as the static initializers are not explicitly called.
Yes, but I think that needs to be a separate project where we need to improve the tooling such that we can "see" what changes causes the models to change. |
"org.apache.commons.io.output;BrokenWriter;BrokenWriter;(IOException);generated", | ||
"org.apache.commons.io.output;ByteArrayOutputStream;ByteArrayOutputStream;();generated", | ||
"org.apache.commons.io.output;ByteArrayOutputStream;ByteArrayOutputStream;(int);generated", | ||
"org.apache.commons.io.output;ByteArrayOutputStream;toBufferedInputStream;(InputStream);generated", |
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.
It may be that I'm misunderstanding negative models, but why should there be no flow here?
public static InputStream toBufferedInputStream(InputStream input)
throws IOExceptionFetches entire contents of an InputStream and represent same data as result InputStream.
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, that would seem reasonable. The negative models are generated in the following way:
If the model generator does not discover flow, then we generate a negative model (stating there is no flow). The model generator is far from perfect and this is probably a case, where "positive" flow is missing.
In any case, the negative models are only used for telemetry purposes at the moment, so they don't interfere with dataflow analysis as such.
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 didn't know that they are only for telemetry.
Thank you for the explanation.
This this PR
The output was produced by:
time python3 GenerateFlowModel.py --with-sinks --with-summaries --with-negative-summaries ~/Work/databases/java/commons-io "apache/IOGenerated.qll"