Skip to content

Commit

Permalink
Stop using deprecated plexus-compiler API
Browse files Browse the repository at this point in the history
ECJ always supported --source and --encoding parameters so these checks
were leftovers from copied code relevant for ancient javac versions.
  • Loading branch information
akurtakov committed Oct 9, 2024
1 parent d564019 commit d15a880
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ public String[] buildCompilerArguments(CompilerConfiguration config, CustomCompi
args.add(config.getTargetVersion());
}

if (!suppressSource(config) && StringUtils.isEmpty(config.getSourceVersion())) {
if (StringUtils.isEmpty(config.getSourceVersion())) {
// If omitted, later JDKs complain about a 1.1 target
args.add("-source");
args.add("1.3");
} else if (!suppressSource(config)) {
} else {
args.add("-source");
args.add(config.getSourceVersion());
}
Expand All @@ -325,22 +325,14 @@ public String[] buildCompilerArguments(CompilerConfiguration config, CustomCompi
}
}

if (!suppressEncoding(config) && !StringUtils.isEmpty(config.getSourceEncoding())) {
if (!StringUtils.isEmpty(config.getSourceEncoding())) {
args.add("-encoding");
args.add(config.getSourceEncoding());
}

return args.toArray(new String[args.size()]);
}

private static boolean suppressSource(CompilerConfiguration config) {
return "1.3".equals(config.getCompilerVersion());
}

private static boolean suppressEncoding(CompilerConfiguration config) {
return "1.3".equals(config.getCompilerVersion());
}

/**
* Compile the java sources in a external process, calling an external executable, like javac.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,6 @@ protected CompilerConfiguration getCompilerConfiguration(List<String> compileSou

compilerConfiguration.setWorkingDirectory(basedir);

compilerConfiguration.setCompilerVersion(compilerVersion);

compilerConfiguration.setBuildDirectory(buildDirectory);

compilerConfiguration.setOutputFileName(outputFileName);
Expand Down

0 comments on commit d15a880

Please sign in to comment.