Class StubGenerator

java.lang.Object
org.checkerframework.framework.stub.StubGenerator

public class StubGenerator extends Object
Generates a stub file from a single class or an entire package.

TODO: StubGenerator needs to be reimplemented, because it no longer works due to changes in JDK 9.

See the Checker Framework Manual:
Using stub classes
  • Constructor Details

    • StubGenerator

      public StubGenerator()
      Constructs a StubGenerator that outputs to System.out.
    • StubGenerator

      public StubGenerator(PrintStream out)
      Constructs a StubGenerator that outputs to the provided output stream.
      Parameters:
      out - the output stream
    • StubGenerator

      public StubGenerator(OutputStream out)
      Constructs a StubGenerator that outputs to the provided output stream.
      Parameters:
      out - the output stream
  • Method Details

    • stubFromField

      public void stubFromField(Element elt)
      Prints the stub declaration of the given field. Does nothing if elt is not a field.
      Parameters:
      elt - a field
    • stubFromPackage

      public void stubFromPackage(PackageElement packageElement)
      Generates the stub file for all the classes within the provided package.
      Parameters:
      packageElement - the package whose classes are written to the stub file
    • stubFromMethod

      public void stubFromMethod(ExecutableElement elt)
      Prints the stub declaration of the given method or constructor. Does nothing if elt is neither a method nor a constructor.
      Parameters:
      elt - a method or constructor
    • stubFromType

      public void stubFromType(TypeElement typeElement)
      Generates the stub file for the provided class. The generated file includes the package name.
      Parameters:
      typeElement - the class to generate a stub file for
    • main

      public static void main(String[] args)
      The main entry point to StubGenerator.
      Parameters:
      args - command-line arguments