Class/Object

org.opalj.br

ClassFile

Related Docs: object ClassFile | package br

Permalink

final class ClassFile extends ConcreteSourceElement

Represents a single class file which either defines a class type or an interface type. (Annotation types are also interface types and Enums are class types.)

Note

Equality of ClassFile objects is reference based and a class file's hash code is the same as thisType's hash code.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ClassFile
  2. ConcreteSourceElement
  3. SourceElement
  4. CommonSourceElementAttributes
  5. CommonAttributes
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val accessFlags: Int

    Permalink

    The access flags of this class.

    The access flags of this class. To further analyze the access flags either use the corresponding convenience methods (e.g., isEnumDeclaration()) or the class org.opalj.bi.AccessFlagsIterator or the classes which inherit from org.opalj.bi.AccessFlag.

    Definition Classes
    ClassFileConcreteSourceElement
  5. def annotations: Annotations

    Permalink

    The list of all annotations.

    The list of all annotations. In general, if a specific annotation is searched for the method runtimeVisibleAnnotations or runtimeInvisibleAnnotations should be used.

    Definition Classes
    CommonSourceElementAttributes
  6. final def asClassFile: ClassFile.this.type

    Permalink
    Definition Classes
    ClassFileSourceElement
  7. def asField: Field

    Permalink
    Definition Classes
    SourceElement
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def asMethod: Method

    Permalink
    Definition Classes
    SourceElement
  10. def asVirtualClass: VirtualClass

    Permalink
  11. val attributes: Attributes

    Permalink

    This class file's reified attributes.

    This class file's reified attributes. Which attributes are reified depends on the configuration of the class file reader; e.g., org.opalj.br.reader.Java8Framework. The JVM specification defines the following attributes:

    • InnerClasses
    • EnclosingMethod
    • Synthetic
    • Signature
    • SourceFile
    • SourceDebugExtension
    • Deprecated
    • RuntimeVisibleAnnotations
    • RuntimeInvisibleAnnotations The BootstrapMethods attribute, which is also defined by the JVM specification, is, however, resolved and is not part of the attributes table of the class file. The BootstrapMethods attribute is basically the container for the bootstrap methods referred to by the org.opalj.br.instructions.INVOKEDYNAMIC instructions.
    Definition Classes
    ClassFileCommonAttributes
  12. def classSignature: Option[ClassSignature]

    Permalink

    Each class file optionally defines a class signature.

  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def constructors: Iterator[Method]

    Permalink

    All constructors/instance initialization methods (<init>) defined by this class.

    All constructors/instance initialization methods (<init>) defined by this class.

    (This does not include static initializers.)

  15. def enclosingMethod: Option[EnclosingMethod]

    Permalink
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    ClassFile → AnyRef → Any
  18. val fields: Fields

    Permalink

    The declared fields.

    The declared fields. May be empty. The list is sorted by name.

  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def findField(name: String): Option[Field]

    Permalink

    Returns the field with the given name, if any.

    Returns the field with the given name, if any.

    Note

    The complexity is O(log2 n); this algorithm uses binary search.

  21. def findMethod(name: String, descriptor: MethodDescriptor, matcher: AccessFlagsMatcher): Option[Method]

    Permalink
  22. def findMethod(name: String, descriptor: MethodDescriptor): Option[Method]

    Permalink

    Returns the method with the given name and descriptor that is declared by this class file.

    Returns the method with the given name and descriptor that is declared by this class file.

    Note

    The complexity is O(log2 n); this algorithm uses a binary search algorithm.

  23. def findMethod(name: String): Option[Method]

    Permalink

    Returns the method with the given name, if any.

    Returns the method with the given name, if any.

    Note

    The complexity is O(log2 n); this algorithm uses binary search.

    ,

    Though the methods are sorted, no guarantee is given which method is returned if multiple methods are defined with the same name.

  24. def foreachNestedClass(f: (ClassFile) ⇒ Unit)(implicit classFileRepository: ClassFileRepository): Unit

    Permalink

    Iterates over all direct and indirect nested classes of this class file.

    Iterates over all direct and indirect nested classes of this class file.

    Example:
    1. To collect all nested types:

      var allNestedTypes: Set[ObjectType] = Set.empty
      foreachNestedClasses(innerclassesProject, { nc ⇒ allNestedTypes += nc.thisType })
  25. def fqn: String

    Permalink

    The fully qualified name of the type defined by this class file.

  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def hasDefaultConstructor: Boolean

    Permalink
  28. def hashCode(): Int

    Permalink

    This class file's hasCode.

    This class file's hasCode. The hashCode is (by purpose) identical to the id of the ObjectType it implements.

    Definition Classes
    ClassFile → AnyRef → Any
  29. def id: Int

    Permalink

    The unique id associated with the type defined by this class file.

  30. def innerClasses: Option[InnerClasses]

    Permalink

    Returns the inner classes attribute, if defined.

    Returns the inner classes attribute, if defined.

    Note

    The inner classes attribute contains (for inner classes) also a reference to its outer class. Furthermore, it contains references to other inner classes that are not an inner class of this class. If you are just interested in the inner classes of this class, use the method nested classes.

    See also

    nestedClasses

  31. def instanceMethods: Iterable[Method]

    Permalink

    All defined instance methods.

    All defined instance methods. I.e., all methods that are not static, constructors, or static initializers.

  32. val interfaceTypes: Seq[ObjectType]

    Permalink

    The set of implemented interfaces.

    The set of implemented interfaces. May be empty.

  33. def isAbstract: Boolean

    Permalink
  34. def isAnnotationDeclaration: Boolean

    Permalink
  35. def isAnonymousInnerClass: Boolean

    Permalink

    Returns true if this class file defines an anonymous inner class.

    Returns true if this class file defines an anonymous inner class.

    This method relies on the inner classes attribute to identify anonymous inner classes.

  36. final def isClass: Boolean

    Permalink
    Definition Classes
    ClassFileSourceElement
  37. def isClassDeclaration: Boolean

    Permalink
  38. def isDeprecated: Boolean

    Permalink

    Returns true if this (field, method, class) declaration is declared as deprecated.

    Returns true if this (field, method, class) declaration is declared as deprecated.

    Note

    The deprecated attribute is always set by the Java compiler when either the deprecated annotation or the JavaDoc tag is used.

    Definition Classes
    CommonSourceElementAttributes
  39. def isEffectivelyFinal: Boolean

    Permalink

    Returns true if the class is final or if it only defines private constructors.

  40. def isEnumDeclaration: Boolean

    Permalink
  41. def isField: Boolean

    Permalink
    Definition Classes
    SourceElement
  42. def isFinal: Boolean

    Permalink
  43. def isInnerClass: Boolean

    Permalink
  44. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  45. def isInterfaceDeclaration: Boolean

    Permalink

    Returns true if this class file represents an interface.

    Returns true if this class file represents an interface.

    Note

    From the JVM point-of-view annotations are also interfaces!

  46. def isMethod: Boolean

    Permalink
    Definition Classes
    SourceElement
  47. def isPackageVisible: Boolean

    Permalink

    true if the class file has package visibility.

    true if the class file has package visibility. If false the method isPublic will return true.

    Note

    There is no private or protected visibility.

  48. def isPublic: Boolean

    Permalink

    true if the class file has public visibility.

    true if the class file has public visibility. If false the method isPackageVisible will return true.

    Note

    There is no private or protected visibility.

  49. def isSynthetic: Boolean

    Permalink

    True if this element was created by the compiler and the attribute Synthetic is present.

    True if this element was created by the compiler and the attribute Synthetic is present. Compilers are, however, free to use the attribute or the corresponding access flag.

    Definition Classes
    CommonSourceElementAttributes
  50. def isVirtual: Boolean

    Permalink
    Definition Classes
    SourceElement
  51. def isVirtualType: Boolean

    Permalink

    Returns true if this class file has no direct representation in the source code.

    Returns true if this class file has no direct representation in the source code.

    See also

    VirtualTypeFlag for further information.

  52. final def majorVersion: UShort

    Permalink
  53. val methods: Methods

    Permalink

    The declared methods.

    The declared methods. May be empty. The list is first sorted by name, and then by method descriptor.

  54. final def minorVersion: UShort

    Permalink
  55. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  56. def nestedClasses(implicit classFileRepository: ClassFileRepository): Seq[ObjectType]

    Permalink

    Returns the set of all immediate nested classes of this class.

    Returns the set of all immediate nested classes of this class. I.e., returns those nested classes that are not defined in the scope of a nested class of this class.

  57. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  58. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  59. def outerType: Option[(ObjectType, Int)]

    Permalink

    Each class has at most one explicit, direct outer type.

    Each class has at most one explicit, direct outer type. Note that a local class (a class defined in the scope of a method) or an anonymous class do not specify an outer type.

    returns

    The object type of the outer type as well as the access flags of this inner class.

  60. def runtimeInvisibleAnnotations: Annotations

    Permalink
  61. def runtimeInvisibleTypeAnnotations: TypeAnnotations

    Permalink
    Definition Classes
    CommonAttributes
  62. def runtimeVisibleAnnotations: Annotations

    Permalink
  63. def runtimeVisibleTypeAnnotations: TypeAnnotations

    Permalink
    Definition Classes
    CommonAttributes
  64. def sourceDebugExtension: Option[Array[Byte]]

    Permalink

    The SourceDebugExtension attribute is an optional attribute [...].

    The SourceDebugExtension attribute is an optional attribute [...]. There can be at most one SourceDebugExtension attribute. The data (which is modified UTF8 String may, however, not be representable using a String object (see the spec. for further details.)

    The returned Array must not be mutated.

  65. def sourceFile: Option[String]

    Permalink

    The SourceFile attribute is an optional attribute [...].

    The SourceFile attribute is an optional attribute [...]. There can be at most one SourceFile attribute.

  66. def staticInitializer: Option[Method]

    Permalink

    The static initializer of this class.

    The static initializer of this class.

    Note

    The way how the static initializer is identified has changed with Java 7. In a class file whose version number is 51.0 or above, the method must have its ACC_STATIC flag set. Other methods named <clinit> in a class file are of no consequence.

  67. val superclassType: Option[ObjectType]

    Permalink

    The class type from which this class inherits.

    The class type from which this class inherits. None if this class file defines java.lang.Object.

  68. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  69. val thisType: ObjectType

    Permalink

    The type implemented by this class file.

  70. def toString(): String

    Permalink
    Definition Classes
    ClassFile → AnyRef → Any
  71. def typeAnnotations: TypeAnnotations

    Permalink

    The list of all type annotations.

    The list of all type annotations. In general, if a specific type annotation is searched for, the method runtimeVisibleTypeAnnotations or runtimeInvisibleTypeAnnotations should be used.

    Definition Classes
    CommonAttributes
  72. def updateAttributes(newAttributes: Attributes): ClassFile

    Permalink
    Attributes
    protected[org.opalj.br]
  73. val version: UShortPair

    Permalink
  74. def visibilityModifier: Option[VisibilityModifier]

    Permalink
    Definition Classes
    ConcreteSourceElement
  75. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  76. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  77. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ConcreteSourceElement

Inherited from SourceElement

Inherited from CommonAttributes

Inherited from AnyRef

Inherited from Any

Ungrouped