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

Module Reflection

Provides classes and predicates for working with Java Reflection.

Import path

import semmle.code.java.Reflection

Imports

DefUse

Provides classes and predicates for def-use and use-use pairs. Built on top of the SSA library for maximal precision.

JDKAnnotations

Provides classes that represent standard annotations from the JDK.

Serializability

Provides classes and predicates for working with Java Serialization.

java

Provides all default Java QL imports.

Predicates

inferClassParameterType

Given an expression whose type is Class<T>, infer a possible set of types for T.

referencedInXmlFile

Holds if a field’s name and declaring type are referenced in an XML file. Usually, this implies that the field may be accessed reflectively.

reflectivelyRead

Holds if f is a field that may be read by reflection.

reflectivelyWritten

Holds if f is a field that may be written by reflection.

Classes

ClassMethodCall

A MethodCall on a Class instance.

NewInstance

A call to Class.newInstance() or Constructor.newInstance().

ReflectiveClassIdentifierMethodCall

A call to a Java standard library method which constructs or returns a Class<T> from a String.

ReflectiveGetAnnotationCall

A call to Class.getAnnotation(..).

ReflectiveGetConstructorsCall

A call to Class.getConstructors(..) or Class.getDeclaredConstructors(..).

ReflectiveGetFieldCall

A call to Class.getField(..) that accesses a field.

ReflectiveGetMethodCall

A call to Class.getMethod(..) or Class.getDeclaredMethod(..).

ReflectiveGetMethodsCall

A call to Class.getMethods(..) or Class.getDeclaredMethods(..).

Aliases

ClassMethodAccess

DEPRECATED: Alias for ClassMethodCall.

ReflectiveAnnotationAccess

DEPRECATED: Alias for ReflectiveGetAnnotationCall.

ReflectiveClassIdentifierMethodAccess

DEPRECATED: Alias for ReflectiveClassIdentifierMethodCall.

ReflectiveConstructorsAccess

DEPRECATED: Alias for ReflectiveGetConstructorsCall.

ReflectiveFieldAccess

DEPRECATED: Alias for ReflectiveGetFieldCall.

ReflectiveMethodAccess

DEPRECATED: Alias for ReflectiveGetMethodCall.

ReflectiveMethodsAccess

DEPRECATED: Alias for ReflectiveGetMethodsCall.