8054717: SJavac should track changes in the public apis of classpath classes!

Added functionality for tracking changes in public APIs of classpath classes.

Reviewed-by: jlahoda, erikj
This commit is contained in:
Andreas Lundblad 2015-06-09 15:57:45 +02:00
parent 66dcce4334
commit 3a31593507
88 changed files with 2917 additions and 1990 deletions

View file

@ -51,35 +51,45 @@ public class CompileWithInvisibleSources extends SJavacTester {
// gensrc2 contains broken code in beta.B, thus exclude that package
// gensrc3 contains a proper beta.B
void test() throws Exception {
Files.createDirectory(BIN);
clean(TEST_ROOT);
Files.createDirectories(BIN);
clean(GENSRC, GENSRC2, GENSRC3, BIN);
Map<String,Long> previous_bin_state = collectState(BIN);
ToolBox tb = new ToolBox();
tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
"package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }");
"package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }");
tb.writeFile(GENSRC2.resolve("beta/B.java"),
"package beta; public class B { broken");
"package beta; public class B { broken");
tb.writeFile(GENSRC2.resolve("gamma/C.java"),
"package gamma; public class C { }");
"package gamma; public class C { }");
tb.writeFile(GENSRC3.resolve("beta/B.java"),
"package beta; public class B { }");
"package beta; public class B { }");
compile("gensrc", "-x", "beta", "-sourcepath", "gensrc2",
"-sourcepath", "gensrc3", "-d", "bin", "-h", "headers", "-j", "1",
compile(GENSRC.toString(),
"-x", "beta",
"-sourcepath", GENSRC2.toString(),
"-sourcepath", GENSRC3.toString(),
"-d", BIN.toString(),
"-h", HEADERS.toString(),
"-j", "1",
SERVER_ARG);
System.out.println("The first compile went well!");
Map<String,Long> new_bin_state = collectState(BIN);
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
"bin/alfa/omega/A.class",
"bin/javac_state");
BIN + "/alfa/omega/A.class",
BIN + "/javac_state");
System.out.println("----- Compile with exluded beta went well!");
clean(BIN);
compileExpectFailure("gensrc", "-sourcepath", "gensrc2", "-sourcepath", "gensrc3",
"-d", "bin", "-h", "headers", "-j", "1",
compileExpectFailure(GENSRC.toString(),
"-sourcepath", GENSRC2.toString(),
"-sourcepath", GENSRC3.toString(),
"-d", BIN.toString(),
"-h", HEADERS.toString(),
"-j", "1",
SERVER_ARG);
System.out.println("----- Compile without exluded beta failed, as expected! Good!");