Source:
public static List<SwiftBaseListener> createListeners(Set<Rules> enabledRules, Printer printer, CommonTokenStream tokenStream) throws ArgumentParserException { List<SwiftBaseListener> listeners = new LinkedList<>(); Set<String> classNames = enabledRules.stream().map(Rules::getClassName).collect(Collectors.toSet()); for (String className : classNames) { try { if (className.equals(FileListener.class.getName())) { continue; } else if (className.equals(CommentWhitespaceListener.class.getName())) { CommentAnalyzer commentAnalyzer = new CommentWhitespaceListener(tokenStream, printer); commentAnalyzer.analyze(); } else if (className.equals(TodoCommentListener.class.getName())) { CommentAnalyzer todoCommentListener = new TodoCommentListener(tokenStream, printer); 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 (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { throw new ArgumentParserException("Listeners were not successfully created: " + e); } } return listeners; }

Target:
public static List<SwiftBaseListener> createListeners(Set<Rules> enabledRules, Printer printer, CommonTokenStream tokenStream) throws ArgumentParserException { 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 (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { throw new ArgumentParserException("Listeners were not successfully created: " + e); } } return listeners; }