Skip to content

Commit 005a020

Browse files
authored
Merge pull request #8508 from igfoo/igfoo/error_elements
Java: Add ErrorExpr, ErrorStmt
2 parents 496aab7 + 7295a5d commit 005a020

File tree

8 files changed

+2026
-17
lines changed

8 files changed

+2026
-17
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: feature
3+
---
4+
* There are now QL classes ErrorExpr and ErrorStmt. These may be generated by upgrade or downgrade scripts when databases cannot be fully converted.

java/ql/lib/config/semmlecode.dbscheme

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ case @stmt.kind of
528528
| 21 = @case
529529
| 22 = @catchclause
530530
| 23 = @yieldstmt
531+
| 24 = @errorstmt
531532
;
532533

533534
#keyset[parent,idx]
@@ -628,6 +629,7 @@ case @expr.kind of
628629
| 71 = @typeannotation
629630
| 72 = @intersectiontypeaccess
630631
| 73 = @switchexpr
632+
| 74 = @errorexpr
631633
;
632634

633635
@classinstancexpr = @newexpr | @lambdaexpr | @memberref

java/ql/lib/config/semmlecode.dbscheme.stats

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<dbstats>
2-
<typesizes><e>
2+
<typesizes>
3+
<e>
34
<k>@compilation</k>
45
<v>8629</v>
56
</e>
@@ -21,7 +22,7 @@
2122
</e>
2223
<e>
2324
<k>@location_default</k>
24-
<v>13306607</v>
25+
<v>17430587</v>
2526
</e>
2627
<e>
2728
<k>@file</k>
@@ -149,7 +150,7 @@
149150
</e>
150151
<e>
151152
<k>@emptystmt</k>
152-
<v>886</v>
153+
<v>1562</v>
153154
</e>
154155
<e>
155156
<k>@exprstmt</k>
@@ -191,6 +192,10 @@
191192
<k>@yieldstmt</k>
192193
<v>1</v>
193194
</e>
195+
<e>
196+
<k>@errorstmt</k>
197+
<v>1</v>
198+
</e>
194199
<e>
195200
<k>@arrayaccess</k>
196201
<v>181399</v>
@@ -265,7 +270,7 @@
265270
</e>
266271
<e>
267272
<k>@mulexpr</k>
268-
<v>85898</v>
273+
<v>204610</v>
269274
</e>
270275
<e>
271276
<k>@divexpr</k>
@@ -281,7 +286,7 @@
281286
</e>
282287
<e>
283288
<k>@subexpr</k>
284-
<v>57171</v>
289+
<v>84397</v>
285290
</e>
286291
<e>
287292
<k>@lshiftexpr</k>
@@ -483,6 +488,10 @@
483488
<k>@switchexpr</k>
484489
<v>1</v>
485490
</e>
491+
<e>
492+
<k>@errorexpr</k>
493+
<v>1</v>
494+
</e>
486495
<e>
487496
<k>@localvar</k>
488497
<v>385335</v>
@@ -519,10 +528,6 @@
519528
<k>@javadocTag</k>
520529
<v>335863</v>
521530
</e>
522-
<e>
523-
<k>@javadocText</k>
524-
<v>2503256</v>
525-
</e>
526531
<e>
527532
<k>@xmldtd</k>
528533
<v>569</v>
@@ -531,6 +536,10 @@
531536
<k>@xmlelement</k>
532537
<v>1199832</v>
533538
</e>
539+
<e>
540+
<k>@javadocText</k>
541+
<v>2503256</v>
542+
</e>
534543
<e>
535544
<k>@xmlattribute</k>
536545
<v>1841492</v>
@@ -560,7 +569,8 @@
560569
<v>1</v>
561570
</e>
562571
</typesizes>
563-
<stats><relation>
572+
<stats>
573+
<relation>
564574
<name>compilations</name>
565575
<cardinality>8629</cardinality>
566576
<columnsizes>
@@ -16749,11 +16759,11 @@
1674916759
</relation>
1675016760
<relation>
1675116761
<name>isParenthesized</name>
16752-
<cardinality>84274</cardinality>
16762+
<cardinality>94666</cardinality>
1675316763
<columnsizes>
1675416764
<e>
1675516765
<k>id</k>
16756-
<v>84274</v>
16766+
<v>94666</v>
1675716767
</e>
1675816768
<e>
1675916769
<k>parentheses</k>
@@ -16771,7 +16781,7 @@
1677116781
<b>
1677216782
<a>1</a>
1677316783
<b>2</b>
16774-
<v>84274</v>
16784+
<v>94666</v>
1677516785
</b>
1677616786
</bs>
1677716787
</hist>
@@ -16785,13 +16795,13 @@
1678516795
<budget>12</budget>
1678616796
<bs>
1678716797
<b>
16788-
<a>12</a>
16789-
<b>13</b>
16798+
<a>58</a>
16799+
<b>59</b>
1679016800
<v>2</v>
1679116801
</b>
1679216802
<b>
16793-
<a>31863</a>
16794-
<b>31864</b>
16803+
<a>34605</a>
16804+
<b>34606</b>
1679516805
<v>2</v>
1679616806
</b>
1679716807
</bs>

java/ql/lib/semmle/code/java/Expr.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,18 @@ class CompileTimeConstantExpr extends Expr {
377377
/** An expression parent is an element that may have an expression as its child. */
378378
class ExprParent extends @exprparent, Top { }
379379

380+
/**
381+
* An error expression.
382+
*
383+
* These may be generated by upgrade or downgrade scripts when databases
384+
* cannot be fully converted.
385+
*/
386+
class ErrorExpr extends Expr, @errorexpr {
387+
override string toString() { result = "<error expr>" }
388+
389+
override string getAPrimaryQlClass() { result = "ErrorExpr" }
390+
}
391+
380392
/**
381393
* An array access.
382394
*

java/ql/lib/semmle/code/java/Statement.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ class Stmt extends StmtParent, ExprParent, @stmt {
5959
/** A statement parent is any element that can have a statement as its child. */
6060
class StmtParent extends @stmtparent, Top { }
6161

62+
/**
63+
* An error statement.
64+
*
65+
* These may be generated by upgrade or downgrade scripts when databases
66+
* cannot be fully converted.
67+
*/
68+
class ErrorStmt extends Stmt, @errorstmt {
69+
override string toString() { result = "<error stmt>" }
70+
71+
override string getAPrimaryQlClass() { result = "ErrorStmt" }
72+
}
73+
6274
/** A block of statements. */
6375
class BlockStmt extends Stmt, @block {
6476
/** Gets a statement that is an immediate child of this block. */

0 commit comments

Comments
 (0)