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 the underlying ObjectType's hash code; i.e., ' 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 In case of Java 9 (org.opalj.br.reader.Java9Framework) the following attributes are added:
    • Module_attribute
    • TODO ConcealedPackages_attribute
    • TODO Version_attribute
    • TODO MainClass_attribute
    • TODO TargetPlatform_attribute The BootstrapMethods attribute, which is also defined by the JVM specification, may, however, be resolved and is then no longer 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 bootstrapMethodTable: Option[BootstrapMethodTable]

    Permalink

    Returns this class file's bootstrap method table.

    Returns this class file's bootstrap method table.

    Note

    A class file's bootstrap method table may be removed at load time if the corresponding org.opalj.br.instructions.INVOKEDYNAMIC instructions are rewritten.

  13. def classSignature: Option[ClassSignature]

    Permalink

    Each class file optionally defines a class signature.

  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. 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.)

  16. def copy(version: UShortPair = this.version, accessFlags: Int = this.accessFlags, thisType: ObjectType = this.thisType, superclassType: Option[ObjectType] = this.superclassType, interfaceTypes: Seq[ObjectType] = this.interfaceTypes, fields: Fields = this.fields, methods: Methods = this.methods, attributes: Attributes = this.attributes): ClassFile

    Permalink

    Creates a shallow copy of this class file object.

    Creates a shallow copy of this class file object.

    fields

    The new set of fields; it need to be ordered by means of the ordering defined by Field.

    methods

    The new set of methods; it need to be ordered by means of the ordering defined by Method.

  17. def enclosingMethod: Option[EnclosingMethod]

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

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

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

    Permalink

    The declared fields.

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

  21. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def findDirectlyOverridingMethod(packageName: String, method: Method)(implicit logContext: LogContext): Option[Method]

    Permalink
  23. def findDirectlyOverridingMethod(packageName: String, visibility: Option[VisibilityModifier], name: String, descriptor: MethodDescriptor)(implicit logContext: LogContext): Option[Method]

    Permalink

    Returns the method which directly overrides a method with the given properties.

    Returns the method which directly overrides a method with the given properties.

    Note

    This method is only defined for proper virtual methods.

  24. def findField(name: String, fieldType: FieldType): Option[Field]

    Permalink

    Returns the field with the given name and type.

  25. def findField(name: String): Chain[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.

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

    Permalink
  27. 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.

  28. def findMethod(name: String): Chain[Method]

    Permalink

    Returns the methods (including constructors and static initializers) with the given name, if any.

    Returns the methods (including constructors and static initializers) with the given name, if any.

    Note

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

  29. 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 })
  30. final def foreachTypeAnnotation[U](f: (TypeAnnotation) ⇒ U): Unit

    Permalink
    Definition Classes
    CommonAttributes
  31. def fqn: String

    Permalink

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

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

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

    Permalink

    Returns true if this class defines a so-called default constructor.

    Returns true if this class defines a so-called default constructor. A default constructor needs to be present, e.g., when the class is serializable.

    The default constructor is the constructor that takes no parameters.

    Note

    The result is recomputed.

  34. 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
  35. def id: Int

    Permalink

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

  36. 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

  37. 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.

  38. val interfaceTypes: Seq[ObjectType]

    Permalink

    The set of implemented interfaces.

    The set of implemented interfaces. May be empty.

  39. def isAbstract: Boolean

    Permalink
  40. def isAnnotationDeclaration: Boolean

    Permalink
  41. 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.

  42. final def isClass: Boolean

    Permalink
    Definition Classes
    ClassFileSourceElement
  43. def isClassDeclaration: Boolean

    Permalink
  44. 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
  45. def isEffectivelyFinal: Boolean

    Permalink

    Returns true if the class is final or if it only defines private constructors and it is therefore not possible to inherit from this class.

    Returns true if the class is final or if it only defines private constructors and it is therefore not possible to inherit from this class.

    An abstract type (abstract classes and interfaces) is never effectively final.

  46. def isEnumDeclaration: Boolean

    Permalink
  47. def isField: Boolean

    Permalink
    Definition Classes
    SourceElement
  48. def isFinal: Boolean

    Permalink
  49. def isInnerClass: Boolean

    Permalink
  50. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  51. 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!

    See also

    org.opalj.br.analyses.Project to determine if this interface declaration is a functional interface.

  52. def isMethod: Boolean

    Permalink
    Definition Classes
    SourceElement
  53. def isModuleDeclaration: Boolean

    Permalink
  54. 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

    A class file cannot have private or protected visibility.

  55. 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.

  56. 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
  57. def isVirtual: Boolean

    Permalink
    Definition Classes
    SourceElement
  58. 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.

  59. final def jdkVersion: String

    Permalink
  60. final def majorVersion: UShort

    Permalink
  61. 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.

  62. final def minorVersion: UShort

    Permalink
  63. def module: Option[Module]

    Permalink

    Returns Java 9's module attribute if defined.

  64. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  65. 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.

  66. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  68. 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.

  69. def runtimeInvisibleAnnotations: Annotations

    Permalink
  70. def runtimeInvisibleTypeAnnotations: TypeAnnotations

    Permalink
    Definition Classes
    CommonAttributes
  71. def runtimeVisibleAnnotations: Annotations

    Permalink
  72. def runtimeVisibleTypeAnnotations: TypeAnnotations

    Permalink
    Definition Classes
    CommonAttributes
  73. 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.

  74. 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.

  75. 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.

  76. 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 or a module.

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

    Permalink
    Definition Classes
    AnyRef
  78. def synthesizedClassFiles: Option[SynthesizedClassFiles]

    Permalink

    Returns OPAL's SynthesizedClassFiles attribute if it is defined.

  79. val thisType: ObjectType

    Permalink

    The type implemented by this class file.

  80. def toString(): String

    Permalink
    Definition Classes
    ClassFile → AnyRef → Any
  81. val version: UShortPair

    Permalink

    A pair of unsigned short values identifying the class file version number.

    A pair of unsigned short values identifying the class file version number. UShortPair(minorVersion, majorVersion).

  82. def visibilityModifier: Option[VisibilityModifier]

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  85. 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