Source:
public static void main(String[] args) { try { CommandLine cmd = argumentParser.parseCommandLine(args); if (argumentParser.shouldPrintHelp()) { argumentParser.printHelp(); System.exit(EXIT_SUCCESS); } pathnames = new ArrayList<>(); if (cmd.getArgs().length >= 1) { pathnames.addAll(Arrays.asList(cmd.getArgs())); } if (pathnames.size() == 0) { checkSrcRoot(); } Set<String> filenames = getSwiftSourceFiles(); if (filenames.size() == 0) { exitWithMissingSourceFileError(); } long numErrors = 0; MaxLengths maxLengths = argumentParser.parseMaxLengths(); Severity maxSeverity = argumentParser.getMaxSeverity(); for (String filename: filenames) { File inputFile = new File(filename); FileInputStream inputStream = new FileInputStream(inputFile); SwiftLexer lexer = new SwiftLexer(new ANTLRInputStream(inputStream)); CommonTokenStream stream = new CommonTokenStream(lexer); SwiftParser swiftParser = new SwiftParser(stream); SwiftParser.TopLevelContext tree = swiftParser.topLevel(); try (Printer printer = new Printer(inputFile, maxSeverity)) { MainListener listener = new MainListener(printer, maxLengths); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); FileListener fileListener = new FileListener(printer, inputFile, maxLengths); fileListener.verify(); numErrors += printer.getNumErrorMessages(); } } if (numErrors >= 1L) { System.exit(EXIT_FAILURE); } } catch (IOException e) { System.err.println("Source file analysis failed. Reason: " + e.getMessage()); System.exit(EXIT_FAILURE); } catch (ParseException | ArgumentParserException e) { System.err.println(e.getMessage()); argumentParser.printHelp(); System.exit(EXIT_FAILURE); } }

Target:
public static void main(String[] args) { try { pathNames = new ArrayList<>(); CommandLine cmd = argumentParser.parseCommandLine(args); if (argumentParser.shouldPrintHelp()) { argumentParser.printHelp(); System.exit(EXIT_SUCCESS); } if (cmd.getArgs().length >= 1) { pathNames.addAll(Arrays.asList(cmd.getArgs())); } if (pathNames.size() == 0) { checkSrcRoot(); } Set<String> filenames = getSwiftSourceFiles(); if (filenames.size() == 0) { exitWithMissingSourceFileError(); } long numErrors = 0; MaxLengths maxLengths = argumentParser.parseMaxLengths(); Severity maxSeverity = argumentParser.getMaxSeverity(); for (String filename : filenames) { File inputFile = new File(filename); FileInputStream inputStream = new FileInputStream(inputFile); SwiftLexer lexer = new SwiftLexer(new ANTLRInputStream(inputStream)); CommonTokenStream stream = new CommonTokenStream(lexer); SwiftParser swiftParser = new SwiftParser(stream); SwiftParser.TopLevelContext tree = swiftParser.topLevel(); try (Printer printer = new Printer(inputFile, maxSeverity)) { MainListener listener = new MainListener(printer, maxLengths); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); FileListener fileListener = new FileListener(printer, inputFile, maxLengths); fileListener.verify(); numErrors += printer.getNumErrorMessages(); } } if (numErrors >= 1L) { System.exit(EXIT_FAILURE); } } catch (IOException e) { System.err.println("Source file analysis failed. Reason: " + e.getMessage()); System.exit(EXIT_FAILURE); } catch (ParseException | ArgumentParserException e) { System.err.println(e.getMessage()); argumentParser.printHelp(); System.exit(EXIT_FAILURE); } }