Skip to content

Commit b7c7449

Browse files
authored
Merge pull request github#12739 from jcogs33/jcogs33/add-one-more-top500-model
Java: add summary model for `UnsupportedOperationException(String)` constructor
2 parents d702c7b + 6a103f5 commit b7c7449

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Added a summary model for the `java.lang.UnsupportedOperationException(String)` constructor.

java/ql/lib/ext/java.lang.model.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ extensions:
132132
- ["java.lang", "Throwable", True, "getMessage", "()", "", "Argument[this].SyntheticField[java.lang.Throwable.message]", "ReturnValue", "value", "manual"]
133133
- ["java.lang", "Throwable", True, "getLocalizedMessage", "()", "", "Argument[this].SyntheticField[java.lang.Throwable.message]", "ReturnValue", "value", "manual"]
134134
- ["java.lang", "Throwable", True, "toString", "()", "", "Argument[this].SyntheticField[java.lang.Throwable.message]", "ReturnValue", "taint", "manual"]
135+
- ["java.lang", "UnsupportedOperationException", False, "UnsupportedOperationException", "(String)", "", "Argument[0]", "Argument[this].SyntheticField[java.lang.Throwable.message]", "value", "manual"]
136+
135137
- addsTo:
136138
pack: codeql/java-all
137139
extensible: neutralModel

java/ql/src/Metrics/Summaries/TopJdkApis.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ predicate topJdkApiName(string apiName) {
5656
"java.lang.StringBuilder#append(int)", "java.util.Objects#requireNonNull(Object,String)",
5757
"java.nio.file.Path#resolve(String)", "java.lang.Enum#toString()",
5858
"java.lang.RuntimeException#RuntimeException(Throwable)", "java.util.Collection#size()",
59-
"java.lang.String#charAt(int)", "java.util.stream.Stream#forEach(Consumer)",
59+
"java.lang.String#charAt(int)",
60+
"java.lang.UnsupportedOperationException#UnsupportedOperationException(String)",
6061
"java.util.Map#isEmpty()", "java.lang.String#valueOf(int)",
6162
// top 200 JDK APIs
6263
"java.lang.Integer#intValue()", "java.util.ArrayList#size()",

java/ql/test/ext/TestModels/Test.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public void test() throws Exception {
4444
Exception e4 = new IllegalStateException((String)source());
4545
sink((String)e4.getMessage()); // $hasValueFlow
4646

47+
Exception e5 = new UnsupportedOperationException((String)source());
48+
sink((String)e5.getMessage()); // $hasValueFlow
49+
4750
Throwable t = new Throwable((Throwable)source());
4851
sink((Throwable)t.getCause()); // $hasValueFlow
4952

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Manually created from java.lang.UnsupportedOperationException for testing purposes
2+
3+
package java.lang;
4+
5+
6+
public class UnsupportedOperationException
7+
{
8+
public UnsupportedOperationException(String p0){} // manual summary
9+
}

java/ql/test/query-tests/Metrics/GeneratedVsManualCoverage/TopJdkApisTest/TopJdkApisTest.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
| java.io | 0 | 0 | 22 | 9 | 31 | 0.7096774193548387 | 0.0 | 0.7096774193548387 | 0.0 | NaN | 0.2903225806451613 |
2-
| java.lang | 0 | 0 | 59 | 89 | 148 | 0.39864864864864863 | 0.0 | 0.39864864864864863 | 0.0 | NaN | 0.6013513513513513 |
2+
| java.lang | 0 | 0 | 60 | 89 | 149 | 0.40268456375838924 | 0.0 | 0.40268456375838924 | 0.0 | NaN | 0.5973154362416108 |
33
| java.lang.invoke | 0 | 0 | 0 | 1 | 1 | 0.0 | 0.0 | 0.0 | NaN | NaN | 1.0 |
44
| java.lang.reflect | 0 | 0 | 0 | 4 | 4 | 0.0 | 0.0 | 0.0 | NaN | NaN | 1.0 |
55
| java.math | 0 | 0 | 0 | 16 | 16 | 0.0 | 0.0 | 0.0 | NaN | NaN | 1.0 |

0 commit comments

Comments
 (0)