Class JClass

java.lang.Object
pascal.taie.util.AbstractResultHolder
pascal.taie.language.classes.JClass
All Implemented Interfaces:
Serializable, Annotated, Indexable, ResultHolder

public class JClass extends AbstractResultHolder implements Annotated, Indexable, Serializable
Represents classes in the program. Each instance contains various information of a class, including class name, modifiers, declared methods and fields, etc.
See Also:
  • Constructor Details

  • Method Details

    • build

      public void build(JClassBuilder builder)
      This method should be called after creating this instance.
    • getClassLoader

      public JClassLoader getClassLoader()
    • getName

      public String getName()
    • getModuleName

      public String getModuleName()
    • getSimpleName

      public String getSimpleName()
    • getType

      public ClassType getType()
    • getGSignature

      @Nullable @Experimental public ClassGSignature getGSignature()
    • getModifiers

      public Set<Modifier> getModifiers()
    • isPublic

      public boolean isPublic()
    • isProtected

      public boolean isProtected()
    • isPrivate

      public boolean isPrivate()
    • isInterface

      public boolean isInterface()
    • isAbstract

      public boolean isAbstract()
    • isStatic

      public boolean isStatic()
    • isFinal

      public boolean isFinal()
    • isStrictFP

      public boolean isStrictFP()
    • isSynthetic

      public boolean isSynthetic()
    • getSuperClass

      @Nullable public JClass getSuperClass()
    • getInterfaces

      public Collection<JClass> getInterfaces()
    • hasOuterClass

      public boolean hasOuterClass()
    • getOuterClass

      @Nullable public JClass getOuterClass()
    • getDeclaredFields

      public Collection<JField> getDeclaredFields()
    • getDeclaredField

      @Nullable public JField getDeclaredField(String fieldName)
      Attempts to retrieve the field with the given name.
      Throws:
      AmbiguousMemberException - if this class has multiple fields with the given name.
    • getDeclaredField

      @Nullable public JField getDeclaredField(String fieldName, Type fieldType)
      Attempts to retrieve the field with given name and type.
      Returns:
      the target field with given name and type, or null if such field does not exist.
    • getDeclaredField

      @Nullable public JField getDeclaredField(String fieldName, String typeName)
      Attempts to retrieve the field with given name and type.
      Parameters:
      fieldName - name of the field
      typeName - name of the field type
      Returns:
      the target field with given name and type, or null if such field does not exist.
    • getDeclaredMethods

      public Collection<JMethod> getDeclaredMethods()
    • getDeclaredMethod

      @Nullable public JMethod getDeclaredMethod(String methodName)
      Attempts to retrieve the method with the given name.
      Throws:
      AmbiguousMemberException - if this class has multiple methods with the given name.
    • getDeclaredMethod

      @Nullable public JMethod getDeclaredMethod(Subsignature subsignature)
      Attempts to retrieve the method with given subsignature.
      Parameters:
      subsignature - subsignature of the method
      Returns:
      the target method with given subsignature, or null if such method does not exist.
    • getClinit

      @Nullable public JMethod getClinit()
    • hasAnnotation

      public boolean hasAnnotation(String annotationType)
      Specified by:
      hasAnnotation in interface Annotated
      Returns:
      true if this annotated object has an annotation of annotationType.
    • getAnnotation

      @Nullable public Annotation getAnnotation(String annotationType)
      Specified by:
      getAnnotation in interface Annotated
      Returns:
      the Annotation of type annotationType if it is present in this annotated; otherwise, null is returned.
    • getAnnotations

      public Collection<Annotation> getAnnotations()
      Specified by:
      getAnnotations in interface Annotated
      Returns:
      all annotations in this annotated object.
    • isApplication

      public boolean isApplication()
    • isPhantom

      public boolean isPhantom()
    • getPhantomField

      @Nullable public JField getPhantomField(String fieldName, Type fieldType)
    • addPhantomField

      public void addPhantomField(String fieldName, Type fieldType, JField field)
    • getIndex

      public int getIndex()
      Specified by:
      getIndex in interface Indexable
      Returns:
      index of this object. The index should be a non-negative integer.
    • toString

      public String toString()
      Overrides:
      toString in class Object