Source:
private List<SwiftBaseListener> createListeners(Set<Rules> enabledRules, Printer printer, CommonTokenStream tokenStream, ConstructLengths constructLengths) throws CliArgumentParserException { List<SwiftBaseListener> listeners = new LinkedList<>(); Set<String> classNames = enabledRules.stream().map(Rules::getClassName).collect(Collectors.toSet()); for (String className : classNames) { try { CommentExtractor commentExtractor = new CommentExtractor(tokenStream); if (className.equals(FileListener.class.getName())) { continue; } else if (className.equals(CommentWhitespaceListener.class.getName())) { CommentWhitespaceListener commentWhitespaceListener = new CommentWhitespaceListener(printer, commentExtractor.getSingleLineComments(), commentExtractor.getMultilineComments()); commentWhitespaceListener.analyze(); } else if (className.equals(TodoCommentListener.class.getName())) { TodoCommentListener todoCommentListener = new TodoCommentListener(printer, commentExtractor.getSingleLineComments(), commentExtractor.getMultilineComments()); todoCommentListener.analyze(); } else if (className.equals(BraceStyleListener.class.getName())) { listeners.add(new BraceStyleListener(printer, tokenStream)); } else if (className.equals(BlankLineListener.class.getName())) { listeners.add(new BlankLineListener(printer, tokenStream)); } else { Constructor listenerConstructor = Class.forName(className).getConstructor(Printer.class); listeners.add((SwiftBaseListener) listenerConstructor.newInstance(printer)); } } catch (ReflectiveOperationException e) { throw new CliArgumentParserException("Listeners were not successfully created: " + e); } } listeners.add(new MinLengthListener(printer, constructLengths, enabledRules)); listeners.add(new MaxLengthListener(printer, constructLengths, enabledRules)); DeclarationListener decListener = new DeclarationListener(listeners); listeners.add(decListener); return listeners; }

Target:
private List<SwiftBaseListener> createListeners(Set<Rules> enabledRules, Printer printer, CommonTokenStream tokenStream, ConstructLengths constructLengths) throws CLIArgumentParserException { List<SwiftBaseListener> listeners = new LinkedList<>(); Set<String> classNames = enabledRules.stream().map(Rules::getClassName).collect(Collectors.toSet()); for (String className : classNames) { try { CommentExtractor commentExtractor = new CommentExtractor(tokenStream); if (className.equals(FileListener.class.getName())) { continue; } else if (className.equals(CommentWhitespaceListener.class.getName())) { CommentWhitespaceListener commentWhitespaceListener = new CommentWhitespaceListener(printer, commentExtractor.getSingleLineComments(), commentExtractor.getMultilineComments()); commentWhitespaceListener.analyze(); } else if (className.equals(TodoCommentListener.class.getName())) { TodoCommentListener todoCommentListener = new TodoCommentListener(printer, commentExtractor.getSingleLineComments(), commentExtractor.getMultilineComments()); todoCommentListener.analyze(); } else if (className.equals(BraceStyleListener.class.getName())) { listeners.add(new BraceStyleListener(printer, tokenStream)); } else if (className.equals(BlankLineListener.class.getName())) { listeners.add(new BlankLineListener(printer, tokenStream)); } else { Constructor listenerConstructor = Class.forName(className).getConstructor(Printer.class); listeners.add((SwiftBaseListener) listenerConstructor.newInstance(printer)); } } catch (ReflectiveOperationException e) { throw new CLIArgumentParserException("Listeners were not successfully created: " + e); } } listeners.add(new MinLengthListener(printer, constructLengths, enabledRules)); listeners.add(new MaxLengthListener(printer, constructLengths, enabledRules)); DeclarationListener decListener = new DeclarationListener(listeners); listeners.add(decListener); return listeners; }