Class ClassFileReader

java.lang.Object
org.checkerframework.afu.scenelib.io.classfile.ClassFileReader

public class ClassFileReader extends Object
A ClassFileReader provides methods for reading in annotations from a class file into an AScene.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
     
    static boolean
     
    static final String
     
    static boolean
     
    static boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    If s is not a valid representation of a class, print a warning message and return false.
    static void
    main(String[] args)
    From the command line, read annotations from a class file and write them to an index file.
    static void
    read(AScene scene, InputStream input)
    Reads the annotations from the class file indicated by the InputStream and inserts them into scene.
    static void
    read(AScene scene, String fileName)
    Reads the annotations from the class file fileName and inserts them into scene.
    static void
    read(AScene scene, org.objectweb.asm.ClassReader classReader)
    Reads the annotations from the class file indicated by the ClassReader and inserts them into scene.
    static void
    readFromClass(AScene scene, String className)
    Reads the annotations from the class className, assumed to be in your classpath, and inserts them into scene.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INDEX_UTILS_VERSION

      public static final String INDEX_UTILS_VERSION
      See Also:
    • ignore_bridge_methods

      public static boolean ignore_bridge_methods
    • help

      public static boolean help
    • version

      public static boolean version
    • verbose

      public static boolean verbose
  • Constructor Details

    • ClassFileReader

      public ClassFileReader()
  • Method Details

    • main

      public static void main(String[] args) throws IOException
      From the command line, read annotations from a class file and write them to an index file. Also see the Anncat tool, which is more versatile (and which calls this as a subroutine).

      For usage information, supply the -h or --help option.

      For programmatic access to this tool, use the read() methods instead.

      Parameters:
      args - options and classes to analyze;
      Throws:
      IOException - if a class file cannot be found
    • checkClass

      public static boolean checkClass(String arg)
      If s is not a valid representation of a class, print a warning message and return false.
    • read

      public static void read(AScene scene, String fileName) throws IOException
      Reads the annotations from the class file fileName and inserts them into scene. fileName should be a file name that can be resolved from the current working directory, which means it should end in ".class" for standard Java class files.
      Parameters:
      scene - the scene into which the annotations should be inserted
      fileName - the file name of the class the annotations should be read from
      Throws:
      IOException - if there is a problem reading from fileName
    • readFromClass

      public static void readFromClass(AScene scene, String className) throws IOException
      Reads the annotations from the class className, assumed to be in your classpath, and inserts them into scene.
      Parameters:
      scene - the scene into which the annotations should be inserted
      className - the name of the class to read in
      Throws:
      IOException - if there is a problem reading className
    • read

      public static void read(AScene scene, InputStream input) throws IOException
      Reads the annotations from the class file indicated by the InputStream and inserts them into scene.
      Parameters:
      scene - the scene into which the annotations should be inserted
      input - an input stream containing the class that the annotations should be read from
      Throws:
      IOException - if there is a problem reading from in
    • read

      public static void read(AScene scene, org.objectweb.asm.ClassReader classReader)
      Reads the annotations from the class file indicated by the ClassReader and inserts them into scene.
      Parameters:
      scene - the scene into which the annotations should be inserted
      classReader - the ClassReader for the class thet the annotations should be read from