Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.apache.tools.ant.BuildException;
Expand Down Expand Up @@ -124,7 +125,7 @@ protected void compile() {
try {
Class<?> mainClazz = CustomJavacClassLoader.findMainCompilerClass(getProject());
if (mainClazz != null) {
super.add(CustomJavacClassLoader.createCompiler(mainClazz));
super.add(CustomJavacClassLoader.createCompiler(mainClazz, canUseRelease()));
}
} catch (ClassNotFoundException | MalformedURLException | URISyntaxException ex) {
if (ex instanceof BuildException) {
Expand Down
16 changes: 6 additions & 10 deletions nbbuild/antsrc/org/netbeans/nbbuild/CustomJavacClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ static synchronized Class<?> findMainCompilerClass(Project prj) throws Malformed
* {@link #findMainCompilerClass(org.apache.tools.ant.Project)} method
* @return instance of Ant Javac compiler using the {@code mainClass}
*/
static Javac13 createCompiler(Class<?> mainClass) {
return new NbJavacCompiler(mainClass);
static Javac13 createCompiler(Class<?> mainClass, boolean canUseRelease) {
return new NbJavacCompiler(mainClass, canUseRelease);
}

private static void assertIsolatedClassLoader(Class<?> c, URLClassLoader loader) throws ClassNotFoundException, BuildException {
Expand Down Expand Up @@ -153,24 +153,20 @@ private static boolean isNbJavacClass(String name) {
private static final class NbJavacCompiler extends Javac13 {

private final Class<?> mainClazz;
private final boolean canUseRelease;

NbJavacCompiler(Class<?> mainClazz) {
NbJavacCompiler(Class<?> mainClazz, boolean canUseRelease) {
this.mainClazz = mainClazz;
this.canUseRelease = canUseRelease;
}

@Override
public boolean execute() throws BuildException {
attributes.log("Using modern compiler", Project.MSG_VERBOSE);
Commandline cmd = setupModernJavacCommand();
final String[] args = cmd.getArguments();
boolean bootClasspath = false;
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-Xbootclasspath/p:")) { // ide/html
bootClasspath = true;
}
}
for (int i = 0; i < args.length; i++) {
if (!bootClasspath) {
if (canUseRelease) {
if ("-target".equals(args[i]) || "-source".equals(args[i])) {
args[i] = "--release";
if (args[i + 1].startsWith("1.")) {
Expand Down
Loading