8042699: sjavac does not track dependencies
Using / in some places and . in other places break package comparisons. The fix standardizes on dots. Reviewed-by: jjg
This commit is contained in:
parent
2c6668c63d
commit
cb6df44f8e
@ -313,7 +313,7 @@ public class Source implements Comparable<Source> {
|
||||
int sp = fn.lastIndexOf(File.separatorChar);
|
||||
String pkg = "";
|
||||
if (sp != -1) {
|
||||
pkg = fn.substring(0,sp);
|
||||
pkg = fn.substring(0,sp).replace('/','.');
|
||||
}
|
||||
// Is this a module-info.java file?
|
||||
if (fn.endsWith("module-info.java")) {
|
||||
|
@ -95,15 +95,15 @@ class SJavac {
|
||||
System.out.println("\nInitial compile of gensrc.");
|
||||
System.out.println("----------------------------");
|
||||
populate(gensrc,
|
||||
"alfa/AINT.java",
|
||||
"package alfa; public interface AINT { void aint(); }",
|
||||
"alfa/omega/AINT.java",
|
||||
"package alfa.omega; public interface AINT { void aint(); }",
|
||||
|
||||
"alfa/A.java",
|
||||
"package alfa; public class A implements AINT { "+
|
||||
"alfa/omega/A.java",
|
||||
"package alfa.omega; public class A implements AINT { "+
|
||||
"public final static int DEFINITION = 17; public void aint() { } }",
|
||||
|
||||
"alfa/AA.java",
|
||||
"package alfa;"+
|
||||
"alfa/omega/AA.java",
|
||||
"package alfa.omega;"+
|
||||
"// A package private class, not contributing to the public api.\n"+
|
||||
"class AA {"+
|
||||
" // A properly nested static inner class.\n"+
|
||||
@ -127,7 +127,7 @@ class SJavac {
|
||||
"package beta;public interface BINT { void foo(); }",
|
||||
|
||||
"beta/B.java",
|
||||
"package beta; import alfa.A; public class B {"+
|
||||
"package beta; import alfa.omega.A; public class B {"+
|
||||
"private int b() { return A.DEFINITION; } native void foo(); }");
|
||||
|
||||
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
|
||||
@ -151,16 +151,16 @@ class SJavac {
|
||||
System.out.println("\nTesting that deleting AA.java deletes all");
|
||||
System.out.println("generated inner class as well as AA.class");
|
||||
System.out.println("-----------------------------------------");
|
||||
removeFrom(gensrc, "alfa/AA.java");
|
||||
removeFrom(gensrc, "alfa/omega/AA.java");
|
||||
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
|
||||
"--server:portfile=testserver,background=false", "--log=debug");
|
||||
Map<String,Long> new_bin_state = collectState(bin);
|
||||
verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state,
|
||||
"bin/alfa/AA$1.class",
|
||||
"bin/alfa/AA$AAAA.class",
|
||||
"bin/alfa/AA$AAA.class",
|
||||
"bin/alfa/AAAAA.class",
|
||||
"bin/alfa/AA.class");
|
||||
"bin/alfa/omega/AA$1.class",
|
||||
"bin/alfa/omega/AA$AAAA.class",
|
||||
"bin/alfa/omega/AA$AAA.class",
|
||||
"bin/alfa/omega/AAAAA.class",
|
||||
"bin/alfa/omega/AA.class");
|
||||
|
||||
previous_bin_state = new_bin_state;
|
||||
Map<String,Long> new_headers_state = collectState(headers);
|
||||
@ -175,8 +175,8 @@ class SJavac {
|
||||
System.out.println("Since we did not modify the native api of B.");
|
||||
System.out.println("-------------------------------------------------------------");
|
||||
|
||||
populate(gensrc,"alfa/A.java",
|
||||
"package alfa; public class A implements AINT { "+
|
||||
populate(gensrc,"alfa/omega/A.java",
|
||||
"package alfa.omega; public class A implements AINT { "+
|
||||
"public final static int DEFINITION = 18; public void aint() { } private void foo() { } }");
|
||||
|
||||
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
|
||||
@ -184,8 +184,8 @@ class SJavac {
|
||||
Map<String,Long> new_bin_state = collectState(bin);
|
||||
|
||||
verifyNewerFiles(previous_bin_state, new_bin_state,
|
||||
"bin/alfa/A.class",
|
||||
"bin/alfa/AINT.class",
|
||||
"bin/alfa/omega/A.class",
|
||||
"bin/alfa/omega/AINT.class",
|
||||
"bin/beta/B.class",
|
||||
"bin/beta/BINT.class",
|
||||
"bin/javac_state");
|
||||
@ -202,7 +202,7 @@ class SJavac {
|
||||
System.out.println("---------------------------------------------------------");
|
||||
|
||||
populate(gensrc,"beta/B.java",
|
||||
"package beta; import alfa.A; public class B {"+
|
||||
"package beta; import alfa.omega.A; public class B {"+
|
||||
"private int b() { return A.DEFINITION; } }");
|
||||
|
||||
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
|
||||
@ -226,7 +226,7 @@ class SJavac {
|
||||
System.out.println("------------------------------------------------------------------------");
|
||||
|
||||
populate(gensrc,"beta/B.java",
|
||||
"package beta; import alfa.A; public class B {"+
|
||||
"package beta; import alfa.omega.A; public class B {"+
|
||||
"private int b() { return A.DEFINITION; } "+
|
||||
"@java.lang.annotation.Native final static int alfa = 42; }");
|
||||
|
||||
@ -252,7 +252,7 @@ class SJavac {
|
||||
System.out.println("-------------------------------------------------------------------");
|
||||
|
||||
populate(gensrc,"beta/B.java",
|
||||
"package beta; import alfa.A; public class B {"+
|
||||
"package beta; import alfa.omega.A; public class B {"+
|
||||
"private int b() { return A.DEFINITION; } "+
|
||||
"@java.lang.annotation.Native final static int alfa = 43; }");
|
||||
|
||||
@ -282,8 +282,8 @@ class SJavac {
|
||||
delete(bin);
|
||||
previous_bin_state = collectState(bin);
|
||||
|
||||
populate(gensrc,"alfa/A.java",
|
||||
"package alfa; import beta.B; import gamma.C; public class A { B b; C c; }",
|
||||
populate(gensrc,"alfa/omega/A.java",
|
||||
"package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }",
|
||||
"beta/B.java",
|
||||
"package beta; public class B { broken",
|
||||
"gamma/C.java",
|
||||
@ -297,7 +297,7 @@ class SJavac {
|
||||
"--server:portfile=testserver,background=false");
|
||||
Map<String,Long> new_bin_state = collectState(bin);
|
||||
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
|
||||
"bin/alfa/A.class",
|
||||
"bin/alfa/omega/A.class",
|
||||
"bin/beta/B.class",
|
||||
"bin/gamma/C.class",
|
||||
"bin/javac_state");
|
||||
@ -325,8 +325,8 @@ class SJavac {
|
||||
delete(bin);
|
||||
previous_bin_state = collectState(bin);
|
||||
|
||||
populate(gensrc,"alfa/A.java",
|
||||
"package alfa; import beta.B; import gamma.C; public class A { B b; C c; }");
|
||||
populate(gensrc,"alfa/omega/A.java",
|
||||
"package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }");
|
||||
populate(gensrc2,"beta/B.java",
|
||||
"package beta; public class B { broken",
|
||||
"gamma/C.java",
|
||||
@ -341,7 +341,7 @@ class SJavac {
|
||||
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/A.class",
|
||||
"bin/alfa/omega/A.class",
|
||||
"bin/javac_state");
|
||||
|
||||
System.out.println("----- Compile with exluded beta went well!");
|
||||
@ -365,18 +365,18 @@ class SJavac {
|
||||
delete(bin);
|
||||
previous_bin_state = collectState(bin);
|
||||
|
||||
populate(gensrc,"alfa/A.java",
|
||||
"package alfa; public class A { beta.B b; }",
|
||||
populate(gensrc,"alfa/omega/A.java",
|
||||
"package alfa.omega; public class A { beta.B b; }",
|
||||
"beta/B.java",
|
||||
"package beta; public class B { gamma.C c; }",
|
||||
"gamma/C.java",
|
||||
"package gamma; public class C { alfa.A a; }");
|
||||
"package gamma; public class C { alfa.omega.A a; }");
|
||||
|
||||
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "3",
|
||||
"--server:portfile=testserver,background=false","--log=debug");
|
||||
Map<String,Long> new_bin_state = collectState(bin);
|
||||
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
|
||||
"bin/alfa/A.class",
|
||||
"bin/alfa/omega/A.class",
|
||||
"bin/beta/B.class",
|
||||
"bin/gamma/C.class",
|
||||
"bin/javac_state");
|
||||
@ -396,17 +396,17 @@ class SJavac {
|
||||
previous_bin_state = collectState(bin);
|
||||
|
||||
populate(gensrc,
|
||||
"alfa/A.java",
|
||||
"package alfa; public class A { beta.B b; }",
|
||||
"alfa/omega/A.java",
|
||||
"package alfa.omega; public class A { beta.B b; }",
|
||||
"beta/B.java",
|
||||
"package beta; public class B { }");
|
||||
|
||||
compile("-x", "beta", "-src", "gensrc", "-x", "alfa", "-sourcepath", "gensrc",
|
||||
compile("-x", "beta", "-src", "gensrc", "-x", "alfa/omega", "-sourcepath", "gensrc",
|
||||
"-d", "bin", "--server:portfile=testserver,background=false");
|
||||
|
||||
Map<String,Long> new_bin_state = collectState(bin);
|
||||
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
|
||||
"bin/alfa/A.class",
|
||||
"bin/alfa/omega/A.class",
|
||||
"bin/javac_state");
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
* @summary Test all aspects of sjavac.
|
||||
*
|
||||
* @bug 8004658
|
||||
* @bug 8042699
|
||||
* @summary Add internal smart javac wrapper to solve JEP 139
|
||||
*
|
||||
* @run main SJavacWrapper
|
||||
|
Loading…
x
Reference in New Issue
Block a user