Class LineNumberFormatter

java.lang.Object
com.strobel.decompiler.LineNumberFormatter

public class LineNumberFormatter extends Object
A LineNumberFormatter is used to rewrite an existing .java file, introducing line number information. It can handle either, or both, of the following jobs:
  • Introduce line numbers as leading comments.
  • Stretch the file so that the line number comments match the physical lines.
  • Constructor Details

    • LineNumberFormatter

      public LineNumberFormatter(File file, List<LineNumberPosition> lineNumberPositions, EnumSet<LineNumberFormatter.LineNumberOption> options)
      Constructs an instance.
      Parameters:
      file - the file whose line numbers should be fixed
      lineNumberPositions - a recipe for how to fix the line numbers in 'file'.
      options - controls how 'this' represents line numbers in the resulting file
  • Method Details

    • reformatFile

      public void reformatFile() throws IOException
      Rewrites the file passed to 'this' constructor so that the actual line numbers match the recipe passed to 'this' constructor.
      Throws:
      IOException