CodeQL library for Java/Kotlin
codeql/java-all 1.1.0 (changelog, source)

Member predicate LocalVariableDeclExpr::getInitOrPatternSource

Gets the local expression that initializes this variable declaration, if any.

Note this includes explicit T varname = init;, as well as e instanceof T varname and switch(e) ... case T varname. To get only explicit initializers, use getInit.

Note that record pattern variables like e instance of T Record(T varname) do not have either an explicit initializer or a pattern source.

Expr getInitOrPatternSource()