@Override public void perform(final GraphRewrite event, final EvaluationContext context) { ExecutionStatistics.get().begin("ProcyonDecompilationOperation.perform"); int threads = WindupExecutors.getDefaultThreadCount(); LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> allClasses = getFilesToDecompile(event.getGraphContext()); List<ClassDecompileRequest> classesToDecompile = new ArrayList<>(10000); // Just a guess as to the average size for (JavaClassFileModel classFileModel : allClasses) { if (configurationService.shouldScanPackage(classFileModel.getPackageName())) { File outputDir = DecompilerUtil.getOutputDirectoryForClass(event.getGraphContext(), classFileModel); classesToDecompile.add(new ClassDecompileRequest(outputDir.toPath(), classFileModel.asFile().toPath(), outputDir.toPath())); } } Collections.sort(classesToDecompile, (ClassDecompileRequest o1, ClassDecompileRequest o2) -> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(classesToDecompile.size()); AddDecompiledItemsToGraph addDecompiledItemsToGraph = new AddDecompiledItemsToGraph(progressEstimate, event); ProcyonDecompiler decompiler = new ProcyonDecompiler(new ProcyonConfiguration().setIncludeNested(false)); decompiler.setExecutorService(WindupExecutors.newFixedThreadPool(threads), threads); decompiler.decompileClassFiles(classesToDecompile, addDecompiledItemsToGraph); decompiler.close(); ExecutionStatistics.get().end("ProcyonDecompilationOperation.perform"); }
@Override public void perform(final GraphRewrite event, final EvaluationContext context) { ExecutionStatistics.get().begin("ProcyonDecompilationOperation.perform"); int threads = WindupExecutors.getDefaultThreadCount(); LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> allClasses = getFilesToDecompile(event.getGraphContext()); List<ClassDecompileRequest> classesToDecompile = new ArrayList<>(10000); // Just a guess as to the average size for (JavaClassFileModel classFileModel : allClasses) { if (configurationService.shouldScanPackage(classFileModel.getPackageName())) { File outputDir = DecompilerUtil.getOutputDirectoryForClass(event.getGraphContext(), classFileModel); classesToDecompile.add(new ClassDecompileRequest(outputDir.toPath(), classFileModel.asFile().toPath(), outputDir.toPath())); } } Collections.sort(classesToDecompile, (ClassDecompileRequest o1, ClassDecompileRequest o2) -> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(classesToDecompile.size()); AddDecompiledItemsToGraph addDecompiledItemsToGraph = new AddDecompiledItemsToGraph(progressEstimate, event); ProcyonDecompiler decompiler = new ProcyonDecompiler(new ProcyonConfiguration().setIncludeNested(false)); decompiler.setExecutorService(WindupExecutors.newFixedThreadPool(threads), threads); decompiler.decompileClassFiles(classesToDecompile, addDecompiledItemsToGraph); decompiler.close(); ExecutionStatistics.get().end("ProcyonDecompilationOperation.perform"); }