Compare commits

...

5 Commits

Author SHA1 Message Date
yo-h
687ef87e56 Merge commit '7e0e7d500426b6d943446305735df9ab0f6ea5ac' into yo-h/java17-options 2022-03-19 15:28:23 -04:00
yo-h
2e24f39d5f Java 17: exclude non-source locations in some tests 2021-11-26 17:56:03 -05:00
yo-h
34b3c0863c Java 17: adjust expected test output 2021-11-26 17:56:02 -05:00
yo-h
0315b00023 Merge commit '055017d' into HEAD 2021-11-26 15:50:57 -05:00
yo-h
490346460a Java: adjust test options for JDK 17 upgrade 2021-09-01 16:30:57 -04:00
15 changed files with 33 additions and 15 deletions

View File

@@ -3,5 +3,5 @@ import semmle.code.java.dataflow.ModulusAnalysis
import semmle.code.java.dataflow.Bound
from Expr e, Bound b, int delta, int mod
where exprModulus(e, b, delta, mod)
where exprModulus(e, b, delta, mod) and e.getCompilationUnit().fromSource()
select e, b.toString(), delta, mod

View File

@@ -8,5 +8,5 @@ private string getDirectionString(boolean d) {
}
from Expr e, Bound b, int delta, boolean upper, Reason reason
where bounded(e, b, delta, upper, reason)
where bounded(e, b, delta, upper, reason) and e.getCompilationUnit().fromSource()
select e, b.toString(), delta, getDirectionString(upper), reason

View File

@@ -1,6 +1,6 @@
| BooleanLiterals.java:5:3:5:6 | true | true | true |
| BooleanLiterals.java:6:3:6:7 | false | false | false |
| BooleanLiterals.java:8:8:8:26 | 4\\u0072\\u0075\\u0065 | true | true |
| BooleanLiterals.java:8:3:8:26 | \\u0074\\u0072\\u0075\\u0065 | true | true |
| BooleanLiterals.java:13:3:13:6 | true | true | true |
| BooleanLiterals.java:13:11:13:14 | true | true | true |
| BooleanLiterals.java:14:3:14:7 | false | false | false |

View File

@@ -13,7 +13,7 @@
| CharLiterals.java:18:3:18:10 | '\\uDC00' | \ufffd | 56320 |
| CharLiterals.java:20:3:20:16 | '\\u005C\\u005C' | \\ | 92 |
| CharLiterals.java:21:3:21:16 | '\\u005C\\u0027' | ' | 39 |
| CharLiterals.java:22:8:22:15 | 7a\\u0027 | a | 97 |
| CharLiterals.java:22:3:22:15 | \\u0027a\\u0027 | a | 97 |
| CharLiterals.java:27:4:27:6 | 'a' | a | 97 |
| CharLiterals.java:28:4:28:6 | 'a' | a | 97 |
| CharLiterals.java:33:3:33:5 | 'a' | a | 97 |

View File

@@ -12,7 +12,7 @@
| DoubleLiterals.java:17:3:17:10 | 4.9e-324 | 4.9E-324 | 4.9E-324 |
| DoubleLiterals.java:18:3:18:28 | 0x0.0_0000_0000_0001P-1022 | 4.9E-324 | 4.9E-324 |
| DoubleLiterals.java:19:3:19:13 | 0x1.0P-1074 | 4.9E-324 | 4.9E-324 |
| DoubleLiterals.java:21:8:21:20 | 0\\u002E\\u0030 | 0.0 | 0.0 |
| DoubleLiterals.java:21:3:21:20 | \\u0030\\u002E\\u0030 | 0.0 | 0.0 |
| DoubleLiterals.java:26:4:26:6 | 0.0 | 0.0 | 0.0 |
| DoubleLiterals.java:27:4:27:6 | 0.0 | 0.0 | 0.0 |
| DoubleLiterals.java:28:4:28:6 | 1.0 | 1.0 | 1.0 |

View File

@@ -11,7 +11,7 @@
| FloatLiterals.java:16:3:16:10 | 1.4e-45f | 1.4E-45 | 1.4E-45 |
| FloatLiterals.java:17:3:17:18 | 0x0.000002P-126f | 1.4E-45 | 1.4E-45 |
| FloatLiterals.java:18:3:18:13 | 0x1.0P-149f | 1.4E-45 | 1.4E-45 |
| FloatLiterals.java:20:8:20:26 | 0\\u002E\\u0030\\u0066 | 0.0 | 0.0 |
| FloatLiterals.java:20:3:20:26 | \\u0030\\u002E\\u0030\\u0066 | 0.0 | 0.0 |
| FloatLiterals.java:25:4:25:6 | 0.f | 0.0 | 0.0 |
| FloatLiterals.java:26:4:26:6 | 0.f | 0.0 | 0.0 |
| FloatLiterals.java:27:4:27:7 | 1.0f | 1.0 | 1.0 |

View File

@@ -1,4 +1,10 @@
import semmle.code.java.Expr
class SrcFloatingPointLiteral extends FloatingPointLiteral {
SrcFloatingPointLiteral() {
this.getCompilationUnit().fromSource()
}
}
from FloatingPointLiteral lit
select lit, lit.getValue(), lit.getFloatValue()

View File

@@ -18,7 +18,7 @@
| IntegerLiterals.java:23:3:23:13 | 0xffff_ffff | -1 | -1 |
| IntegerLiterals.java:24:3:24:16 | 0377_7777_7777 | -1 | -1 |
| IntegerLiterals.java:25:3:25:43 | 0b1111_1111_1111_1111_1111_1111_1111_1111 | -1 | -1 |
| IntegerLiterals.java:27:8:27:8 | 0 | 0 | 0 |
| IntegerLiterals.java:27:3:27:8 | \\u0030 | 0 | 0 |
| IntegerLiterals.java:32:4:32:4 | 0 | 0 | 0 |
| IntegerLiterals.java:33:4:33:4 | 0 | 0 | 0 |
| IntegerLiterals.java:34:4:34:4 | 1 | 1 | 1 |

View File

@@ -1,4 +1,10 @@
import semmle.code.java.Expr
from IntegerLiteral lit
class SrcIntegerLiteral extends IntegerLiteral {
SrcIntegerLiteral() {
this.getCompilationUnit().fromSource()
}
}
from SrcIntegerLiteral lit
select lit, lit.getValue(), lit.getIntValue()

View File

@@ -1,6 +1,12 @@
import java
from Literal l
class SrcLiteral extends Literal {
SrcLiteral() {
this.getCompilationUnit().fromSource()
}
}
from SrcLiteral l
where
l instanceof IntegerLiteral or
l instanceof LongLiteral or

View File

@@ -18,7 +18,7 @@
| LongLiterals.java:23:3:23:24 | 0xffff_ffff_ffff_ffffL | -1 |
| LongLiterals.java:24:3:24:31 | 017_7777_7777_7777_7777_7777L | -1 |
| LongLiterals.java:25:3:25:84 | 0b1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L | -1 |
| LongLiterals.java:27:8:27:14 | 0\\u004C | 0 |
| LongLiterals.java:27:3:27:14 | \\u0030\\u004C | 0 |
| LongLiterals.java:32:4:32:5 | 0L | 0 |
| LongLiterals.java:33:4:33:5 | 0L | 0 |
| LongLiterals.java:34:4:34:5 | 1L | 1 |

View File

@@ -1,3 +1,3 @@
| NullLiterals.java:5:3:5:6 | null | null |
| NullLiterals.java:7:8:7:26 | null | null |
| NullLiterals.java:7:3:7:26 | null | null |
| NullLiterals.java:12:12:12:15 | null | null |

View File

@@ -21,7 +21,7 @@
| StringLiterals.java:29:3:29:10 | "\\uDC00" | \ufffd | |
| StringLiterals.java:30:3:30:31 | "hello\\uD800hello\\uDC00world" | hello\ufffdhello\ufffdworld | |
| StringLiterals.java:32:3:32:16 | "\\u005C\\u0022" | " | |
| StringLiterals.java:33:8:33:20 | 2\\u0061\\u0022 | a | |
| StringLiterals.java:33:3:33:20 | \\u0022\\u0061\\u0022 | a | |
| StringLiterals.java:38:3:40:5 | """ \t \n\t\ttest "text" and escaped \\u0022\n\t\t""" | test "text" and escaped "\n | text-block |
| StringLiterals.java:42:3:44:5 | """\n\t\t\tindented\n\t\t""" | \tindented\n | text-block |
| StringLiterals.java:45:3:47:5 | """\n\tno indentation last line\n\t\t""" | no indentation last line\n | text-block |
@@ -35,7 +35,7 @@
| StringLiterals.java:70:3:71:18 | """\n\t\t3 quotes:""\\"""" | 3 quotes:""" | text-block |
| StringLiterals.java:72:3:75:5 | """\n\t\tline \\\n\t\tcontinuation \\\n\t\t""" | line continuation | text-block |
| StringLiterals.java:76:3:80:5 | """\n\t\tExplicit line breaks:\\n\n\t\t\\r\\n\n\t\t\\r\n\t\t""" | Explicit line breaks:\n\n\r\n\n\r\n | text-block |
| StringLiterals.java:83:10:85:16 | 2"\\u0022\n\t\ttest\n\t\t\\u0022\\uu0022" | test\n | |
| StringLiterals.java:83:3:85:16 | \\uuu0022"\\u0022\n\t\ttest\n\t\t\\u0022\\uu0022" | test\n | |
| StringLiterals.java:91:3:91:19 | "hello" + "world" | helloworld | |
| StringLiterals.java:92:3:93:20 | """\n\t\thello""" + "world" | helloworld | text-block |
| StringLiterals.java:94:10:94:12 | "a" | a | |

View File

@@ -1 +1 @@
//semmle-extractor-options: --javac-args --enable-preview -source 16 -target 16
//semmle-extractor-options: --javac-args -source 17 -target 17

View File

@@ -1 +1 @@
//semmle-extractor-options: --javac-args --enable-preview -source 16 -target 16
//semmle-extractor-options: --javac-args -source 17 -target 17