8056989: Sjavac --server option should be optional

8147568: NullPointerException in option parsing

Made --server option optional (and background=true implied)

Reviewed-by: jlahoda, erikj
This commit is contained in:
Andreas Lundblad 2016-01-24 11:32:38 +01:00
parent efa7c6652a
commit 5cd3c7cac8
25 changed files with 48 additions and 81 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -67,10 +67,10 @@ public class ClientMain {
Log.debug("=========================================================="); Log.debug("==========================================================");
// Prepare sjavac object // Prepare sjavac object
boolean background = Util.extractBooleanOption("background", options.getServerConf(), true); boolean useServer = options.getServerConf() != null;
Sjavac sjavac; Sjavac sjavac;
// Create an sjavac implementation to be used for compilation // Create an sjavac implementation to be used for compilation
if (background) { if (useServer) {
try { try {
sjavac = new SjavacClient(options); sjavac = new SjavacClient(options);
} catch (PortFileInaccessibleException e) { } catch (PortFileInaccessibleException e) {
@ -83,7 +83,8 @@ public class ClientMain {
int rc = sjavac.compile(args, out, err); int rc = sjavac.compile(args, out, err);
if (!background) // If sjavac is running in the foreground we should shut it down at this point
if (!useServer)
sjavac.shutdown(); sjavac.shutdown();
return rc; return rc;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -310,8 +310,6 @@ public class SjavacImpl implements Sjavac {
err = "Please specify output directory."; err = "Please specify output directory.";
} else if (options.isJavaFilesAmongJavacArgs()) { } else if (options.isJavaFilesAmongJavacArgs()) {
err = "Sjavac does not handle explicit compilation of single .java files."; err = "Sjavac does not handle explicit compilation of single .java files.";
} else if (options.getServerConf() == null) {
err = "No server configuration provided.";
} else if (!options.getImplicitPolicy().equals("none")) { } else if (!options.getImplicitPolicy().equals("none")) {
err = "The only allowed setting for sjavac is -implicit:none"; err = "The only allowed setting for sjavac is -implicit:none";
} else if (options.getSources().isEmpty() && options.getStateDir() != null) { } else if (options.getSources().isEmpty() && options.getStateDir() != null) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,8 +47,6 @@ import java.nio.file.attribute.FileTime;
public class ClasspathDependencies extends SjavacBase { public class ClasspathDependencies extends SjavacBase {
static final String server = "--server:portfile=testserver,background=false";
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
Path root = Paths.get(ClasspathDependencies.class.getSimpleName() + "Test"); Path root = Paths.get(ClasspathDependencies.class.getSimpleName() + "Test");
@ -64,7 +62,7 @@ public class ClasspathDependencies extends SjavacBase {
headline("Create a test dependency, Dep.class, and put it in the classpath dir"); headline("Create a test dependency, Dep.class, and put it in the classpath dir");
String depCode = "package dep; public class Dep { public void m1() {} }"; String depCode = "package dep; public class Dep { public void m1() {} }";
toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode); toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode);
int rc = compile(server, "-d", classesDep, "--state-dir=" + classesDep, srcDep); int rc = compile("-d", classesDep, "--state-dir=" + classesDep, srcDep);
check(rc == 0, "Compilation failed unexpectedly"); check(rc == 0, "Compilation failed unexpectedly");
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@ -73,7 +71,7 @@ public class ClasspathDependencies extends SjavacBase {
"package pkg;" + "package pkg;" +
"import dep.Dep;" + "import dep.Dep;" +
"public class C { Dep dep; public void m() { new Dep().m1(); } }"); "public class C { Dep dep; public void m() { new Dep().m1(); } }");
rc = compile(server, "-d", classes, "--state-dir=" + classes, src, "-cp", classesDep); rc = compile("-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
check(rc == 0, "Compilation failed unexpectedly"); check(rc == 0, "Compilation failed unexpectedly");
FileTime modTime1 = Files.getLastModifiedTime(classes.resolve("pkg/C.class")); FileTime modTime1 = Files.getLastModifiedTime(classes.resolve("pkg/C.class"));
@ -82,12 +80,12 @@ public class ClasspathDependencies extends SjavacBase {
Thread.sleep(2000); Thread.sleep(2000);
depCode = depCode.replaceAll("}$", "private void m2() {} }"); depCode = depCode.replaceAll("}$", "private void m2() {} }");
toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode); toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode);
rc = compile(server, "-d", classesDep, "--state-dir=" + classesDep, srcDep); rc = compile("-d", classesDep, "--state-dir=" + classesDep, srcDep);
check(rc == 0, "Compilation failed unexpectedly"); check(rc == 0, "Compilation failed unexpectedly");
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
headline("Make sure that this does not trigger recompilation of C.java"); headline("Make sure that this does not trigger recompilation of C.java");
rc = compile(server, "-d", classes, "--state-dir=" + classes, src, "-cp", classesDep); rc = compile("-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
check(rc == 0, "Compilation failed unexpectedly"); check(rc == 0, "Compilation failed unexpectedly");
FileTime modTime2 = Files.getLastModifiedTime(classes.resolve("pkg/C.class")); FileTime modTime2 = Files.getLastModifiedTime(classes.resolve("pkg/C.class"));
check(modTime1.equals(modTime2), "Recompilation erroneously triggered"); check(modTime1.equals(modTime2), "Recompilation erroneously triggered");
@ -97,12 +95,12 @@ public class ClasspathDependencies extends SjavacBase {
Thread.sleep(2000); Thread.sleep(2000);
depCode = depCode.replace("m1()", "m1(String... arg)"); depCode = depCode.replace("m1()", "m1(String... arg)");
toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode); toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode);
rc = compile(server, "-d", classesDep, "--state-dir=" + classesDep, srcDep); rc = compile("-d", classesDep, "--state-dir=" + classesDep, srcDep);
check(rc == 0, "Compilation failed unexpectedly"); check(rc == 0, "Compilation failed unexpectedly");
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
headline("Make sure that recompilation of C.java is triggered"); headline("Make sure that recompilation of C.java is triggered");
rc = compile(server, "-d", classes, "--state-dir=" + classes, src, "-cp", classesDep); rc = compile("-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
check(rc == 0, "Compilation failed unexpectedly"); check(rc == 0, "Compilation failed unexpectedly");
FileTime modTime3 = Files.getLastModifiedTime(classes.resolve("pkg/C.class")); FileTime modTime3 = Files.getLastModifiedTime(classes.resolve("pkg/C.class"));
check(modTime2.compareTo(modTime3) < 0, "Recompilation not triggered"); check(modTime2.compareTo(modTime3) < 0, "Recompilation not triggered");

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -64,7 +64,6 @@ public class CompileCircularSources extends SJavacTester {
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-j", "3", "-j", "3",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenAdded(previous_bin_state, verifyThatFilesHaveBeenAdded(previous_bin_state,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -60,8 +60,7 @@ public class CompileExcludingDependency extends SJavacTester {
"-x", "alfa/omega/*", "-x", "alfa/omega/*",
"-sourcepath", GENSRC.toString(), "-sourcepath", GENSRC.toString(),
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN);
SERVER_ARG);
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,7 +62,7 @@ public class CompileWithAtFile extends SJavacTester {
Files.createDirectory(BIN); Files.createDirectory(BIN);
Map<String,Long> previous_bin_state = collectState(BIN); Map<String,Long> previous_bin_state = collectState(BIN);
compile("@" + GENSRC + "/list.txt", "--server:portfile=testserver,background=false"); compile("@" + GENSRC + "/list.txt");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -70,8 +70,7 @@ public class CompileWithInvisibleSources extends SJavacTester {
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1");
SERVER_ARG);
System.out.println("The first compile went well!"); System.out.println("The first compile went well!");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
@ -87,8 +86,7 @@ public class CompileWithInvisibleSources extends SJavacTester {
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1");
SERVER_ARG);
System.out.println("----- Compile without exluded beta failed, as expected! Good!"); System.out.println("----- Compile without exluded beta failed, as expected! Good!");
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -68,8 +68,7 @@ public class CompileWithOverrideSources extends SJavacTester {
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1");
SERVER_ARG);
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
BIN + "/alfa/omega/A.class", BIN + "/alfa/omega/A.class",
@ -84,8 +83,7 @@ public class CompileWithOverrideSources extends SJavacTester {
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1");
SERVER_ARG);
System.out.println("----- Compile without exluded beta failed, as expected! Good!"); System.out.println("----- Compile without exluded beta failed, as expected! Good!");
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -58,7 +58,6 @@ public class HiddenFiles extends SjavacBase {
// This compilation should fail (return RC_FATAL) since A.java refers to B.java and B.java // This compilation should fail (return RC_FATAL) since A.java refers to B.java and B.java
// is excluded. // is excluded.
int rc = compile("-x", "pkg/B.java", SRC.toString(), int rc = compile("-x", "pkg/B.java", SRC.toString(),
"--server:portfile=testportfile,background=false",
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + STATE_DIR); "--state-dir=" + STATE_DIR);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -55,17 +55,14 @@ public class IgnoreSymbolFile {
new File("classes").mkdirs(); new File("classes").mkdirs();
String server = "--server:portfile=testserver,background=false"; int rc1 = compile("-d", "classes",
int rc1 = compile(server,
"-d", "classes",
"--state-dir=classes", "--state-dir=classes",
"-Werror", "-Werror",
"src"); "src");
if (rc1 == 0) if (rc1 == 0)
error("compilation succeeded unexpectedly"); error("compilation succeeded unexpectedly");
int rc2 = compile(server, int rc2 = compile("-d", "classes",
"-d", "classes",
"--state-dir=classes", "--state-dir=classes",
"-Werror", "-Werror",
"-XDignore.symbol.file=true", "-XDignore.symbol.file=true",

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,8 +52,7 @@ public class IncCompInheritance extends SjavacBase {
toolbox.writeFile(src.resolve("pkgc/C.java"), c); toolbox.writeFile(src.resolve("pkgc/C.java"), c);
// Initial compile (should succeed) // Initial compile (should succeed)
String server = "--server:portfile=testserver,background=false"; int rc1 = compile("-d", classes, "--state-dir=" + classes, src);
int rc1 = compile(server, "-d", classes, "--state-dir=" + classes, src);
if (rc1 != 0) if (rc1 != 0)
throw new AssertionError("Compilation failed unexpectedly"); throw new AssertionError("Compilation failed unexpectedly");
@ -65,7 +64,7 @@ public class IncCompInheritance extends SjavacBase {
// Incremental compile (C should now be recompiled even though it // Incremental compile (C should now be recompiled even though it
// depends on A only through inheritance via B). // depends on A only through inheritance via B).
// Since A.m is removed, this should fail. // Since A.m is removed, this should fail.
int rc2 = compile(server, "-d", classes, "--state-dir=" + classes, src); int rc2 = compile("-d", classes, "--state-dir=" + classes, src);
if (rc2 == 0) if (rc2 == 0)
throw new AssertionError("Compilation succeeded unexpectedly"); throw new AssertionError("Compilation succeeded unexpectedly");
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,6 @@ public class IncCompileChangeNative extends SJavacTester {
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyNewerFiles(previous_bin_state, new_bin_state, verifyNewerFiles(previous_bin_state, new_bin_state,
@ -106,7 +105,6 @@ public class IncCompileChangeNative extends SJavacTester {
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyNewerFiles(previous_bin_state, new_bin_state, verifyNewerFiles(previous_bin_state, new_bin_state,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -71,7 +71,6 @@ public class IncCompileDropClasses extends SJavacTester {
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state, verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,7 +62,6 @@ public class IncCompileFullyQualifiedRef extends SJavacTester {
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> previous_bin_state = collectState(BIN); Map<String,Long> previous_bin_state = collectState(BIN);
@ -77,7 +76,6 @@ public class IncCompileFullyQualifiedRef extends SJavacTester {
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -69,7 +69,6 @@ public class IncCompileNoChanges extends SJavacTester {
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyEqual(new_bin_state, previous_bin_state); verifyEqual(new_bin_state, previous_bin_state);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,6 @@ public class IncCompileUpdateNative extends SJavacTester {
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyNewerFiles(previous_bin_state, new_bin_state, verifyNewerFiles(previous_bin_state, new_bin_state,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -81,7 +81,6 @@ public class IncCompileWithChanges extends SJavacTester {
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);

View file

@ -125,7 +125,6 @@ public class IncludeExcludePatterns extends SjavacBase {
toolbox.cleanDirectory(BIN); toolbox.cleanDirectory(BIN);
toolbox.cleanDirectory(STATE_DIR); toolbox.cleanDirectory(STATE_DIR);
String args = filterArgs + " " + SRC String args = filterArgs + " " + SRC
+ " --server:portfile=testportfile,background=false"
+ " -d " + BIN + " -d " + BIN
+ " --state-dir=" + STATE_DIR; + " --state-dir=" + STATE_DIR;
int rc = compile((Object[]) args.split(" ")); int rc = compile((Object[]) args.split(" "));

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,6 @@ public class NoState extends SJavacTester {
tb.writeFile(GENSRC.resolve("pkg/A.java"), "package pkg; class A {}"); tb.writeFile(GENSRC.resolve("pkg/A.java"), "package pkg; class A {}");
Files.createDirectory(BIN); Files.createDirectory(BIN);
compile("-d", BIN.toString(), compile("-d", BIN.toString(),
"--server:portfile=testserver,background=false",
GENSRC + "/pkg/A.java"); GENSRC + "/pkg/A.java");
// Make sure file was compiled // Make sure file was compiled

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,8 +47,7 @@ public class PackagePathMismatch extends SjavacBase {
"package a.b.c; class Test { }"); "package a.b.c; class Test { }");
// Compile should fail since package a.b.c does not match path a/x/c. // Compile should fail since package a.b.c does not match path a/x/c.
int rc1 = compile("--server:portfile=testserver,background=false", int rc1 = compile("-d", classes,
"-d", classes,
"--state-dir=" + classes, "--state-dir=" + classes,
src); src);
if (rc1 == 0) if (rc1 == 0)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -61,7 +61,6 @@ class ParallelCompilations extends SJavacTester {
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-j", "10", "-j", "10",
SERVER_ARG,
"--log=debug"); "--log=debug");
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -63,8 +63,7 @@ public class PermittedArtifact extends SJavacTester {
"--permit-artifact=" + BIN + "/alfa/omega/AA.class", "--permit-artifact=" + BIN + "/alfa/omega/AA.class",
"-src", GENSRC.toString(), "-src", GENSRC.toString(),
"-d", BIN.toString(), "-d", BIN.toString(),
"--state-dir=" + BIN, "--state-dir=" + BIN);
SERVER_ARG);
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,10 +30,6 @@ import com.sun.tools.sjavac.Main;
public class SJavacTester { public class SJavacTester {
static final String SERVER_ARG = "--server:"
+ "portfile=testportfile,"
+ "background=false";
final ToolBox tb = new ToolBox(); final ToolBox tb = new ToolBox();
final Path TEST_ROOT = Paths.get(getClass().getSimpleName()); final Path TEST_ROOT = Paths.get(getClass().getSimpleName());
@ -90,7 +86,6 @@ public class SJavacTester {
"--state-dir=" + BIN, "--state-dir=" + BIN,
"-h", HEADERS.toString(), "-h", HEADERS.toString(),
"-j", "1", "-j", "1",
SERVER_ARG,
"--log=debug"); "--log=debug");
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -59,8 +59,7 @@ public class StateDir extends SJavacTester {
compile("--state-dir=" + BAR, compile("--state-dir=" + BAR,
"-src", GENSRC.toString(), "-src", GENSRC.toString(),
"-d", BIN.toString(), "-d", BIN.toString());
SJavacTester.SERVER_ARG);
Map<String,Long> new_bin_state = collectState(BIN); Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,