Returns a new Iterable
over all source elements of the project.
Returns a new Iterable
over all source elements of the project. The set
of all source elements consists of (in this order): all methods + all fields +
all class files.
Returns the additional project information that is currently available.
Returns the additional project information that is currently available.
If some analyses are still running it may be possible that additional information will be made available as part of the execution of those analyses.
This method redetermines the available project information on each call.
Returns the given field's class file.
Returns the given field's class file. This method is only defined if the field was previously added to this project. (I.e., the class file which defines the field was added.)
Returns the given method's class file.
Returns the given method's class file. This method is only defined if the method was previously added to this project. (I.e., the class file which defines the method was added.)
Returns the class file that defines the given objectType
; if any.
Returns the class file that defines the given objectType
; if any.
Some object type. (This method is defined for all ObjectType
s.)
The number of classes (including inner and annoymous classes as well as interfaces, annotations, etc.) defined in libraries and in the analyzed project.
Creates a new Project
which also includes this as well as the other project's
class files.
Creates a new Project
which also includes the given class files.
All fields defined by this project as well as the visible fields defined by the libraries.
The number of field defined in libraries and in the analyzed project.
Unregisters this project from the OPALLogger and then calls super.finalize
.
Unregisters this project from the OPALLogger and then calls super.finalize
.
Returns the information attached to this project that is identified by the
given ProjectInformationKey
.
Returns the information attached to this project that is identified by the
given ProjectInformationKey
.
If the information was not yet required the information is computed and returned. Subsequent calls will directly return the information.
(Development Time) Every analysis using ProjectInformationKeys must list All requirements; failing to specify a requirement can end up in a deadlock.
ProjectInformationKey for further information.
Tests if the information identified by the given ProjectInformationKey is available.
Tests if the information identified by the given ProjectInformationKey
is available. If the information is not (yet) available, the information
will not be computed and None
will be returned.
ProjectInformationKey for further information.
Returns true if the given type file belongs to the library part of the project.
Returns true if the given type file belongs to the library part of the project. This is generally the case if no class file was loaded for the given type.
Returns true if the given class file belongs to the library part of the project.
Returns true if the given class file belongs to the library part of the project. This is only the case if the class file was explicitly identified as being part of the library. By default all class files are considered to belong to the code base that will be analyzed.
If true
then only the public interface
of the methods of the library's classes is available.
Returns the list of all library packages that contain at least one class.
Returns the list of all library packages that contain at least one class.
For example, in case of the JDK the package java
does not directly contain
any class – only its subclasses. This package is, hence, not returned by this
function, but the package java.lang
is.
This method's result is not cached.
The logging context associated with this project.
The logging context associated with this project. Using the logging context after the project is no longer referenced (garbage collected) is not possible.
Returns all available ClassFile
objects for the given objectTypes
that
pass the given filter
.
Returns all available ClassFile
objects for the given objectTypes
that
pass the given filter
. ObjectType
s for which no ClassFile
is available
are ignored.
The set of all method names of the given types.
All methods defined by this project as well as the visible methods defined by the libraries.
The number of methods defined in libraries and in the analyzed project.
Returns the list of all packages that contain at least one class.
Returns the list of all packages that contain at least one class.
For example, in case of the JDK the package java
does not directly contain
any class – only its subclasses. This package is, hence, not returned by this
function, but the package java.lang
is.
This method's result is not cached.
Number of packages.
Number of packages.
The result is (re)calculated for each call.
Iterates over all methods with a body in parallel.
Iterates over all methods with a body in parallel.
This method maximizes utilization by allowing each thread to pick the next unanalyzed method as soon as the thread has finished analyzing the previous method. I.e., each thread is not assigned a fixed batch of methods. Additionally, the methods are analyzed ordered by their length (longest first).
Returns the number of (non-synthetic) source elements per method length (size in length of the method's code array).
Returns the number of (non-synthetic) source elements per method length (size in length of the method's code array). The number of class members of nested classes are also taken into consideration.
Returns the (number of) (non-synthetic) methods per method length (size in length of the method's code array).
Returns the list of all project packages that contain at least one class.
Returns the list of all project packages that contain at least one class.
For example, in case of the JDK the package java
does not directly contain
any class – only its subclasses. This package is, hence, not returned by this
function, but the package java.lang
is.
This method's result is not cached.
Determines for all packages of this project that contain at least one class the "root" packages and stores the mapping between the package and its root package.
Determines for all packages of this project that contain at least one class the "root" packages and stores the mapping between the package and its root package.
For example, let's assume that we have project which has the following packages that contain at least one class:
In other words the set of rootPackages can then be determined using:
<Project>.rootPackages().values.toSet
a Map which contains for each package name the root package name.
This method's result is not cached.
Returns the source (for example, a File
object or URL
object) from which
the class file was loaded that defines the given object type, if any.
Returns the source (for example, a File
object or URL
object) from which
the class file was loaded that defines the given object type, if any.
Some object type. (This method is defined for all ObjectType
s.)
The number of all source elements (fields, methods and class files).
Some basic statistics about this project.
Some basic statistics about this project.
((Re)Calculated on-demand.)
Converts this project abstraction into a standard Java HashMap
.
Converts this project abstraction into a standard Java HashMap
.
This method is intended to be used by Java projects that want to interact with OPAL.
Primary abstraction of a Java project; i.e., a set of classes that constitute a library, framework or application as well as the libraries or frameworks used by the former.
This class has several purposes:
ClassFile
s.Thread Safety
This class is thread-safe.
Prototyping Analyses/Querying Projects
Projects can easily be created and queried using the Scala
REPL
. For example, to create a project, you can use:Now, to determine the number of methods that have at least one parameter of type
int
, you can use:The type of the source of the class file. E.g., a
URL
, aFile
, aString
or a Pair(JarFile,JarEntry)
. This information is needed for, e.g., presenting users meaningful messages w.r.t. the location of issues. We abstract over the type of the resource to facilitate the embedding in existing tools such as IDEs. E.g., in EclipseIResource
's are used to identify the location of a resource (e.g., a source or class file.)