mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Merge pull request #17490 from aschackmull/java/capture-in-obinit
Java: Fix support for variable capture inside object initializers.
This commit is contained in:
@@ -147,7 +147,14 @@ private module CaptureInput implements VariableCapture::InputSig<Location> {
|
||||
}
|
||||
|
||||
class Callable extends J::Callable {
|
||||
predicate isConstructor() { this instanceof Constructor }
|
||||
predicate isConstructor() {
|
||||
// InstanceInitializers are called from constructors and are equally likely
|
||||
// to capture variables for the purpose of field initialization, so we treat
|
||||
// them as constructors for the heuristic identification of whether to allow
|
||||
// this-to-this summaries.
|
||||
this instanceof Constructor or
|
||||
this instanceof InstanceInitializer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user