Commit Graph

42524 Commits

Author SHA1 Message Date
Tamas Vajk
857a74cf14 Adjust class label generation to handle classes in field initializers 2022-05-12 22:37:06 +01:00
Tamas Vajk
394ec56d9d Add test case for local class declaration in field initializer 2022-05-12 22:37:06 +01:00
Chris Smowton
4ceb2f13c4 Add test 2022-05-12 22:37:06 +01:00
Chris Smowton
2600dcd182 Fix extracting type accesses relating to proprerty getters/setters and SAM-converted methods
These should be handled the same as regular methods: extract type accesses for parameters and methods only if we're extracting "from source", i.e. at some point we're descended from extractFileContents.
2022-05-12 22:37:06 +01:00
Chris Smowton
301fa11450 Only extract parameter and method type-accesses once
Previously we extracted them whenever something was non-external, but this led to re-extraction when an instance of a generic type defined in source was extracted multiple times.
2022-05-12 22:37:06 +01:00
Chris Smowton
8d970a3cbd Don't extract private members of instantiated or external classes
This is both consistent with the Java extractor's behaviour, and prevents us from trying to refer to anonymous types (e.g. anonymous objects that directly initialize properties) out of scope.
2022-05-12 22:37:06 +01:00
Tamas Vajk
fbae0f5053 Revert dataflow changes, extract actual iterator function 2022-05-12 22:37:06 +01:00
Tamas Vajk
538e05995a Fix dataflow for kotlin.Array.iterator() 2022-05-12 22:37:03 +01:00
Tamas Vajk
776322bac2 Add foreach dataflow tests 2022-05-12 22:36:28 +01:00
Chris Smowton
7e17074b41 Allow arithmetic functions not mapping to Java equivalents 2022-05-12 22:36:28 +01:00
Chris Smowton
b1849f5f0a Expand error message 2022-05-12 22:36:28 +01:00
Chris Smowton
22e48ca39a Accept test changes 2022-05-12 22:36:28 +01:00
Chris Smowton
16af811b69 Allow imprecise matching for Kotlin -> Java method translation
This allows the particular case of Collection.toArray(IntFunction<T>) to match, since both Java and Kotlin functions take an IntFunction<T> but they use different function-local type variables.

This would also allow toArray(Array<T>) to work similarly.
2022-05-12 22:36:28 +01:00
Chris Smowton
77056c9bff Add test expectations 2022-05-12 22:36:28 +01:00
Chris Smowton
71d2e7be3e Don't replace own callables, and use a more exact replacement-finding test 2022-05-12 22:36:28 +01:00
Chris Smowton
ce87a89009 Replace Map and similar functions with their Java cousins
This didn't appear to be necessary because the Kotlin and Java versions of Map (for example) are designed to be compatible, but in certain cases their functions have the same erasure but not the same type (e.g. Map.getOrDefault(K, V) vs. Map.getOrDefault(Object, V).

These have different erasures which was leading to callable-binding inconsistencies.
2022-05-12 22:36:28 +01:00
Tamas Vajk
fa0bd0366c Fix extension property labels 2022-05-12 22:36:28 +01:00
Tamas Vajk
25fce5f6bb Identify data classes during extraction 2022-05-12 22:36:28 +01:00
Chris Smowton
1e78f2893c Add test for special method getters 2022-05-12 22:36:28 +01:00
Chris Smowton
134f88fe8e Accept test results 2022-05-12 22:36:27 +01:00
Chris Smowton
12e3401ae0 Map special getters onto their correct JVM names
These include Collection.size() for example, which has a Kotlin property called `size` but whose getter is not named `getSize()`.

These would normally be accounted for using `@JvmName`, but some core methods are lowered by a special compiler pass instead.
2022-05-12 22:36:27 +01:00
Chris Smowton
cb6941d212 Account for JVM type equivalency when recognising unspecialised types
(As before, these are not really unspecialised, they are instantiated by their own type parameters, but this replicates the behaviour of the Java extractor)
2022-05-12 22:36:27 +01:00
github-actions[bot]
11c95c576e Post-release preparation for codeql-cli-2.9.2 2022-05-12 18:21:57 +00:00
Tom Hvitved
e68a727f9a Drop redundant columns from files and folders relations in xml.dbscheme 2022-05-12 20:21:48 +02:00
github-actions[bot]
b7cbd8fd75 Post-release preparation for codeql-cli-2.9.2 2022-05-12 18:21:38 +00:00
Geoffrey White
776857e08b C++: Change note. 2022-05-12 18:26:32 +01:00
Geoffrey White
7a35a346dc C++: Increase query precision to 'high'. 2022-05-12 17:46:16 +01:00
Geoffrey White
0ad6289618 C++: Fix typos. 2022-05-12 16:32:20 +01:00
Nick Rolfe
6c52831143 Java: sync spelling correction in shared qll 2022-05-12 16:11:29 +01:00
Nick Rolfe
1115227f9d Merge remote-tracking branch 'origin/main' into nickrolfe/misspelling 2022-05-12 16:10:27 +01:00
Nick Rolfe
320b6a1942 QL for QL: don't check spelling of deprecated nodes 2022-05-12 16:07:17 +01:00
Nick Rolfe
70666f6351 QL for QL: fix typos in comments 2022-05-12 16:03:39 +01:00
Nick Rolfe
8caad12011 Ruby: fix typos in comments 2022-05-12 16:02:20 +01:00
Nick Rolfe
2efa38aaa6 Python: fix typos in comments 2022-05-12 16:02:20 +01:00
Nick Rolfe
2ed42c327c JS: fix typos in comments 2022-05-12 16:02:19 +01:00
Mathias Vorreiter Pedersen
39551fd84d Merge pull request #9114 from geoffw0/xxe7
C++: Repair support for createLSParser in the CWE-611 XXE query.
2022-05-12 15:47:53 +01:00
Jeroen Ketema
941485d66f Merge pull request #9130 from jketema/cpp17-init
C++: Handle C++17 if and switch initializers
2022-05-12 16:37:44 +02:00
Harry Maclean
64206a1c29 Ruby: Add getAPrimaryQlClass to CfgNodes classes 2022-05-12 15:32:36 +01:00
Anders Schack-Mulligen
8c8440a58a Merge pull request #9101 from hvitved/dataflow/include-hidden
Data flow: Add `Configuration::includeHiddenNodes()`
2022-05-12 15:36:12 +02:00
Geoffrey White
df30d2286c Merge branch 'main' into xxe7 2022-05-12 14:35:16 +01:00
Nick Rolfe
128fac4414 Java: fix typos in comments 2022-05-12 14:28:49 +01:00
Nick Rolfe
a50601c367 C#: fix typos in comments 2022-05-12 14:28:40 +01:00
Nick Rolfe
76cf8d1659 C++: fix typos in comments 2022-05-12 14:28:26 +01:00
Nick Rolfe
844eef173c QL for QL: add predicate for other typos not in the shared typo db 2022-05-12 14:25:39 +01:00
Ian Lynagh
75ca116ef9 Kotlin: QLDoc tweaks from intrigus 2022-05-12 14:12:01 +01:00
Jeroen Ketema
723f3b09fe C++: Address review comments 2022-05-12 15:09:06 +02:00
Ian Lynagh
02101fab6a Kotlin: Don't use capture_output or text
Older python versions don't support them
2022-05-12 14:08:19 +01:00
Taus
a0f8e2f0b1 Python: Modernise py/jinja2/autoescape-false
A simple rewrite to use API graphs instead.

The handling of falsy values is potentially a bit more restrictive now,
as it only accounts for local flow. We should probably figure out a
better way of capturing this pattern, but I felt that this was out of
scope for the present PR.
2022-05-12 12:55:42 +00:00
Erik Krogh Kristensen
762f7bf7fe Merge pull request #9115 from erik-krogh/fileAndFolder
JS: resolve main module when there is a folder with the same name as the main file
2022-05-12 14:55:28 +02:00
Jeroen Ketema
72823e9576 Apply suggestions from code review
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-05-12 14:54:43 +02:00