Class JavaClassFileMetadata

java.lang.Object
sootup.java.core.JavaClassFileMetadata

public final class JavaClassFileMetadata extends Object
Immutable source and nesting attributes of a Java classfile.
  • Constructor Details

    • JavaClassFileMetadata

      public JavaClassFileMetadata(@Nullable String sourceFile, @Nullable String sourceDebugExtension, @Nullable JavaClassType enclosingClass, @Nullable MethodSignature enclosingMethod, @NonNull List<JavaInnerClassInfo> innerClasses)
      Parameters:
      sourceFile - the SourceFile attribute, or null if absent
      sourceDebugExtension - the decoded, unparsed SourceDebugExtension attribute, or null if absent
      enclosingClass - the owner from EnclosingMethod, or null if that attribute is absent
      enclosingMethod - the enclosing method or constructor; null when the attribute is absent or its method_index is zero (an initializer)
      innerClasses - InnerClasses entries in classfile order; a defensive copy is made
      Throws:
      IllegalArgumentException - if the enclosing method does not belong to the enclosing class
  • Method Details

    • empty

      public static @NonNull JavaClassFileMetadata empty()
    • getSourceFile

      public @NonNull Optional<String> getSourceFile()
    • getSourceDebugExtension

      public @NonNull Optional<String> getSourceDebugExtension()
      Returns decoded SourceDebugExtension text (for example SMAP), without interpreting it.
    • getEnclosingClass

      public @NonNull Optional<JavaClassType> getEnclosingClass()
      Returns the EnclosingMethod owner, including when the class is declared in an initializer.
    • getEnclosingMethod

      public @NonNull Optional<MethodSignature> getEnclosingMethod()
      Returns the enclosing method or constructor; initializers have no method signature.
    • getInnerClasses

      public @NonNull List<JavaInnerClassInfo> getInnerClasses()
      Returns an immutable list of all InnerClasses entries in their classfile order.