Module Reflection

Provides classes and predicates for working with Java Reflection.

Import path

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
reflectivelyWritten

Classes

ClassMethodAccess

A MethodAccess on a Class element.

NewInstance

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

ReflectiveAnnotationAccess

A call to Class.getAnnotation(..).

ReflectiveClassIdentifierMethodAccess

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

ReflectiveFieldAccess

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

ReflectiveMethodAccess

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