Skip to content

Commit

Permalink
perf: move code outside loop in FileCompilerConfig.initializeCompiler (
Browse files Browse the repository at this point in the history
  • Loading branch information
rmkellogg authored and woutersmeenk committed Aug 29, 2021
1 parent 71700bd commit 525e979
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public FileCompilerConfig(List<SpoonFile> files) {
public void initializeCompiler(JDTBatchCompiler compiler) {
JDTBasedSpoonCompiler jdtCompiler = compiler.getJdtCompiler();
List<CompilationUnit> cuList = new ArrayList<>();
Environment env = jdtCompiler.getEnvironment();

for (SpoonFile f : getFiles(compiler)) {

Expand All @@ -50,7 +51,6 @@ public void initializeCompiler(JDTBatchCompiler compiler) {
}

String fName = f.isActualFile() ? f.getPath() : f.getName();
Environment env = jdtCompiler.getEnvironment();
cuList.add(new CompilationUnit(f.getContentChars(env), fName, env.getEncoding().displayName()));
}

Expand Down

0 comments on commit 525e979

Please sign in to comment.